Remove usage of deprecated libavcodec/audioconvert.h functions.
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Wed, 3 Nov 2010 20:19:34 +0000 (20:19 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Wed, 3 Nov 2010 20:19:34 +0000 (20:19 +0000)
Originally committed as revision 25668 to svn://svn.ffmpeg.org/ffmpeg/trunk

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

index 4d1b75416c5e5fdec3f8ffdc138e98ca8b5fef19..ad3f670e10276065bb39ebcbc5fe6e969f7beba6 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -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 *s,
     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 *ist, int ist_index,
 #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 *ist, int ist_index,
                             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 *opt, const char *arg)
 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);
     }
 }
index eecf16a14f895a7c6c7aa2b7dd98bcff78a5a5a8..0563e96edc535495185af6ca33787148361a608d 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -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 *is, double *pts_ptr)
                                                          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 *is, double *pts_ptr)
             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) {
index 352506b1598255da2a98b4e3d4b859a6bd974586..6993bb98a624708a54ea582cd02c3dda8252268b 100644 (file)
@@ -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 *avctx,
 
     // 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(AVCodecContext *avctx)
         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);
index 222b28ce83ea0c89124e928966b01d144c6ce2c2..89e2d71e5392ebcec5f7406bc0d05eb0885f7890 100644 (file)
@@ -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(int output_channels, int input_channels,
 
     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(int output_channels, int input_channels,
                                                          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;
index 8169b374b5c2a0d1595f7f36426eb6df2084209e..4d13e0aa6eab43ad7a864d98997e769955e5010e 100644 (file)
@@ -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_size, AVCodecContext *enc, int encode)
         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:
index 1d748c2855d28553ea3847d2fc3b6b1aec283525..5462b1a34ac8ebfd539621bcad6b93a96b861ace 100644 (file)
@@ -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_audio_buffer(AVFilterLink *link, int per
     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;
index 80bb08ef4f8ccff564ec1912d921c4a2db43914d..1430228c00c2e571fbb7ac6ae58ad6db26d3eba4 100644 (file)
@@ -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(AVFormatContext *s)
         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);