[FFmpeg-cvslog] r25668 - in trunk: ffmpeg.c ffplay.c libavcodec/alsdec.c libavcodec/resample.c libavcodec/utils.c libavfilter/defaults.c libavformat/matroskaenc.c

stefano subversion
Wed Nov 3 21:19:34 CET 2010


Author: stefano
Date: Wed Nov  3 21:19:34 2010
New Revision: 25668

Log:
Remove usage of deprecated libavcodec/audioconvert.h functions.

Modified:
   trunk/ffmpeg.c
   trunk/ffplay.c
   trunk/libavcodec/alsdec.c
   trunk/libavcodec/resample.c
   trunk/libavcodec/utils.c
   trunk/libavfilter/defaults.c
   trunk/libavformat/matroskaenc.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/ffmpeg.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -37,6 +37,7 @@
 #include "libavcodec/opt.h"
 #include "libavcodec/audioconvert.h"
 #include "libavcore/parseutils.h"
+#include "libavcore/samplefmt.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/fifo.h"
 #include "libavutil/intreadwrite.h"
@@ -769,8 +770,8 @@ static void do_audio_out(AVFormatContext
     int size_out, frame_bytes, ret;
     AVCodecContext *enc= ost->st->codec;
     AVCodecContext *dec= ist->st->codec;
-    int osize= av_get_bits_per_sample_format(enc->sample_fmt)/8;
-    int isize= av_get_bits_per_sample_format(dec->sample_fmt)/8;
+    int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8;
+    int isize= av_get_bits_per_sample_fmt(dec->sample_fmt)/8;
     const int coded_bps = av_get_bits_per_sample(enc->codec->id);
 
 need_realloc:
@@ -824,8 +825,8 @@ need_realloc:
                                                    dec->sample_fmt, 1, NULL, 0);
         if (!ost->reformat_ctx) {
             fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
-                avcodec_get_sample_fmt_name(dec->sample_fmt),
-                avcodec_get_sample_fmt_name(enc->sample_fmt));
+                av_get_sample_fmt_name(dec->sample_fmt),
+                av_get_sample_fmt_name(enc->sample_fmt));
             ffmpeg_exit(1);
         }
         ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt);
@@ -1443,7 +1444,7 @@ static int output_packet(AVInputStream *
 #endif
 
     AVPacket avpkt;
-    int bps = av_get_bits_per_sample_format(ist->st->codec->sample_fmt)>>3;
+    int bps = av_get_bits_per_sample_fmt(ist->st->codec->sample_fmt)>>3;
 
     if(ist->next_pts == AV_NOPTS_VALUE)
         ist->next_pts= ist->pts;
@@ -1760,7 +1761,7 @@ static int output_packet(AVInputStream *
                             ret = 0;
                             /* encode any samples remaining in fifo */
                             if (fifo_bytes > 0) {
-                                int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
+                                int osize = av_get_bits_per_sample_fmt(enc->sample_fmt) >> 3;
                                 int fs_tmp = enc->frame_size;
 
                                 av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL);
@@ -2817,9 +2818,9 @@ static int opt_thread_count(const char *
 static void opt_audio_sample_fmt(const char *arg)
 {
     if (strcmp(arg, "list"))
-        audio_sample_fmt = avcodec_get_sample_fmt(arg);
+        audio_sample_fmt = av_get_sample_fmt(arg);
     else {
-        list_fmts(avcodec_sample_fmt_string, SAMPLE_FMT_NB);
+        list_fmts(av_get_sample_fmt_string, SAMPLE_FMT_NB);
         ffmpeg_exit(0);
     }
 }

Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/ffplay.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -30,6 +30,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavcore/imgutils.h"
 #include "libavcore/parseutils.h"
+#include "libavcore/samplefmt.h"
 #include "libavformat/avformat.h"
 #include "libavdevice/avdevice.h"
 #include "libswscale/swscale.h"
@@ -2099,8 +2100,8 @@ static int audio_decode_frame(VideoState
                                                          dec->sample_fmt, 1, NULL, 0);
                 if (!is->reformat_ctx) {
                     fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
-                        avcodec_get_sample_fmt_name(dec->sample_fmt),
-                        avcodec_get_sample_fmt_name(SAMPLE_FMT_S16));
+                        av_get_sample_fmt_name(dec->sample_fmt),
+                        av_get_sample_fmt_name(SAMPLE_FMT_S16));
                         break;
                 }
                 is->audio_src_fmt= dec->sample_fmt;
@@ -2109,7 +2110,7 @@ static int audio_decode_frame(VideoState
             if (is->reformat_ctx) {
                 const void *ibuf[6]= {is->audio_buf1};
                 void *obuf[6]= {is->audio_buf2};
-                int istride[6]= {av_get_bits_per_sample_format(dec->sample_fmt)/8};
+                int istride[6]= {av_get_bits_per_sample_fmt(dec->sample_fmt)/8};
                 int ostride[6]= {2};
                 int len= data_size/istride[0];
                 if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {

Modified: trunk/libavcodec/alsdec.c
==============================================================================
--- trunk/libavcodec/alsdec.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/libavcodec/alsdec.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -36,6 +36,7 @@
 #include "bytestream.h"
 #include "bgmc.h"
 #include "dsputil.h"
+#include "libavcore/samplefmt.h"
 #include "libavutil/crc.h"
 
 #include <stdint.h>
@@ -1426,7 +1427,7 @@ static int decode_frame(AVCodecContext *
 
     // check for size of decoded data
     size = ctx->cur_frame_length * avctx->channels *
-           (av_get_bits_per_sample_format(avctx->sample_fmt) >> 3);
+           (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3);
 
     if (size > *data_size) {
         av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n");
@@ -1679,7 +1680,7 @@ static av_cold int decode_init(AVCodecCo
         ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) *
                                     ctx->cur_frame_length *
                                     avctx->channels *
-                                    (av_get_bits_per_sample_format(avctx->sample_fmt) >> 3));
+                                    (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3));
         if (!ctx->crc_buffer) {
             av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
             decode_end(avctx);

Modified: trunk/libavcodec/resample.c
==============================================================================
--- trunk/libavcodec/resample.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/libavcodec/resample.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -27,6 +27,7 @@
 #include "avcodec.h"
 #include "audioconvert.h"
 #include "libavutil/opt.h"
+#include "libavcore/samplefmt.h"
 
 struct AVResampleContext;
 
@@ -174,15 +175,15 @@ ReSampleContext *av_audio_resample_init(
 
     s->sample_fmt [0] = sample_fmt_in;
     s->sample_fmt [1] = sample_fmt_out;
-    s->sample_size[0] = av_get_bits_per_sample_format(s->sample_fmt[0])>>3;
-    s->sample_size[1] = av_get_bits_per_sample_format(s->sample_fmt[1])>>3;
+    s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0])>>3;
+    s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1])>>3;
 
     if (s->sample_fmt[0] != SAMPLE_FMT_S16) {
         if (!(s->convert_ctx[0] = av_audio_convert_alloc(SAMPLE_FMT_S16, 1,
                                                          s->sample_fmt[0], 1, NULL, 0))) {
             av_log(s, AV_LOG_ERROR,
                    "Cannot convert %s sample format to s16 sample format\n",
-                   avcodec_get_sample_fmt_name(s->sample_fmt[0]));
+                   av_get_sample_fmt_name(s->sample_fmt[0]));
             av_free(s);
             return NULL;
         }
@@ -193,7 +194,7 @@ ReSampleContext *av_audio_resample_init(
                                                          SAMPLE_FMT_S16, 1, NULL, 0))) {
             av_log(s, AV_LOG_ERROR,
                    "Cannot convert s16 sample format to %s sample format\n",
-                   avcodec_get_sample_fmt_name(s->sample_fmt[1]));
+                   av_get_sample_fmt_name(s->sample_fmt[1]));
             av_audio_convert_free(s->convert_ctx[0]);
             av_free(s);
             return NULL;

Modified: trunk/libavcodec/utils.c
==============================================================================
--- trunk/libavcodec/utils.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/libavcodec/utils.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -30,6 +30,7 @@
 #include "libavutil/crc.h"
 #include "libavutil/pixdesc.h"
 #include "libavcore/imgutils.h"
+#include "libavcore/samplefmt.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "libavutil/opt.h"
@@ -923,7 +924,7 @@ void avcodec_string(char *buf, int buf_s
         avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
         if (enc->sample_fmt != SAMPLE_FMT_NONE) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt));
+                     ", %s", av_get_sample_fmt_name(enc->sample_fmt));
         }
         break;
     case AVMEDIA_TYPE_DATA:

Modified: trunk/libavfilter/defaults.c
==============================================================================
--- trunk/libavfilter/defaults.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/libavfilter/defaults.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -20,6 +20,7 @@
  */
 
 #include "libavcore/imgutils.h"
+#include "libavcore/samplefmt.h"
 #include "libavcodec/audioconvert.h"
 #include "avfilter.h"
 
@@ -109,7 +110,7 @@ AVFilterBufferRef *avfilter_default_get_
     samples->refcount   = 1;
     samples->free       = avfilter_default_free_buffer;
 
-    sample_size = av_get_bits_per_sample_format(sample_fmt) >>3;
+    sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3;
     chans_nb = avcodec_channel_layout_num_channels(channel_layout);
 
     per_channel_size = size/chans_nb;

Modified: trunk/libavformat/matroskaenc.c
==============================================================================
--- trunk/libavformat/matroskaenc.c	Wed Nov  3 21:12:07 2010	(r25667)
+++ trunk/libavformat/matroskaenc.c	Wed Nov  3 21:19:34 2010	(r25668)
@@ -26,6 +26,7 @@
 #include "avc.h"
 #include "flacenc.h"
 #include "avlanguage.h"
+#include "libavcore/samplefmt.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/random_seed.h"
 #include "libavutil/lfg.h"
@@ -540,7 +541,7 @@ static int mkv_write_tracks(AVFormatCont
         AVMetadataTag *tag;
 
         if (!bit_depth)
-            bit_depth = av_get_bits_per_sample_format(codec->sample_fmt);
+            bit_depth = av_get_bits_per_sample_fmt(codec->sample_fmt);
 
         if (codec->codec_id == CODEC_ID_AAC)
             get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);



More information about the ffmpeg-cvslog mailing list