History

Replace usages of av_get_bits_per_sample_fmt() with av_get_bytes_per_sample().

av_get_bits_per_sample_fmt() is deprecated.

Justin Ruggles committed 15 years ago

Commit e6c52ce1 parent c5ee74012 files · +16 −16Browse files

Unified · Split

12 files
  1. ffmpeg.c +3 −3
  2. ffplay.c +1 −1
  3. libavcodec/aacdec.c +1 −1
  4. libavcodec/ac3dec.c +1 −1
  5. libavcodec/alsdec.c +2 −2
  6. libavcodec/dca.c +1 −1
  7. libavcodec/resample.c +2 −2
  8. libavcodec/utils.c +1 −1
  9. libavcodec/vmdav.c +1 −1
  10. libavcodec/vorbisdec.c +1 −1
  11. libavfilter/defaults.c +1 −1
  12. libavformat/matroskaenc.c +1 −1
ffmpeg.c+3−3
@@ -778,8 +778,8 @@ static void do_audio_out(AVFormatContext *s, · 777 unmodified lines
778778 int size_out, frame_bytes, ret, resample_changed;
779779 AVCodecContext *enc= ost->st->codec;
780780 AVCodecContext *dec= ist->st->codec;
781− int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8;
782− int isize= av_get_bits_per_sample_fmt(dec->sample_fmt)/8;
781+ int osize = av_get_bytes_per_sample(enc->sample_fmt);
782+ int isize = av_get_bytes_per_sample(dec->sample_fmt);
783783 const int coded_bps = av_get_bits_per_sample(enc->codec->id);
784784
785785 need_realloc:
@@ -1481,7 +1481,7 @@ static int output_packet(AVInputStream *ist, int ist_index, · 695 unmodified lines
14811481 #endif
14821482
14831483 AVPacket avpkt;
1484− int bps = av_get_bits_per_sample_fmt(ist->st->codec->sample_fmt)>>3;
1484+ int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
14851485
14861486 if(ist->next_pts == AV_NOPTS_VALUE)
14871487 ist->next_pts= ist->pts;
ffplay.c+1−1
@@ -2032,7 +2032,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) · 2031 unmodified lines
20322032 if (is->reformat_ctx) {
20332033 const void *ibuf[6]= {is->audio_buf1};
20342034 void *obuf[6]= {is->audio_buf2};
2035− int istride[6]= {av_get_bits_per_sample_fmt(dec->sample_fmt)/8};
2035+ int istride[6]= {av_get_bytes_per_sample(dec->sample_fmt)};
20362036 int ostride[6]= {2};
20372037 int len= data_size/istride[0];
20382038 if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {
libavcodec/aacdec.c+1−1
@@ -2177,7 +2177,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, · 2176 unmodified lines
21772177 }
21782178
21792179 data_size_tmp = samples * avctx->channels *
2180− (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
2180+ av_get_bytes_per_sample(avctx->sample_fmt);
21812181 if (*data_size < data_size_tmp) {
21822182 av_log(avctx, AV_LOG_ERROR,
21832183 "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
libavcodec/ac3dec.c+1−1
@@ -1422,7 +1422,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, · 1421 unmodified lines
14221422 }
14231423 }
14241424 *data_size = s->num_blocks * 256 * avctx->channels *
1425− (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
1425+ av_get_bytes_per_sample(avctx->sample_fmt);
14261426 return FFMIN(buf_size, s->frame_size);
14271427 }
14281428
libavcodec/alsdec.c+2−2
@@ -1450,7 +1450,7 @@ static int decode_frame(AVCodecContext *avctx, · 1449 unmodified lines
14501450
14511451 // check for size of decoded data
14521452 size = ctx->cur_frame_length * avctx->channels *
1453− (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3);
1453+ av_get_bytes_per_sample(avctx->sample_fmt);
14541454
14551455 if (size > *data_size) {
14561456 av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n");
@@ -1714,7 +1714,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 257 unmodified lines
17141714 ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) *
17151715 ctx->cur_frame_length *
17161716 avctx->channels *
1717− (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3));
1717+ av_get_bytes_per_sample(avctx->sample_fmt));
17181718 if (!ctx->crc_buffer) {
17191719 av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
17201720 decode_end(avctx);
libavcodec/dca.c+1−1
@@ -1813,7 +1813,7 @@ static int dca_decode_frame(AVCodecContext * avctx, · 1812 unmodified lines
18131813 }
18141814
18151815 out_size = 256 / 8 * s->sample_blocks * channels *
1816− (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
1816+ av_get_bytes_per_sample(avctx->sample_fmt);
18171817 if (*data_size < out_size)
18181818 return -1;
18191819 *data_size = out_size;
libavcodec/resample.c+2−2
@@ -187,8 +187,8 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, · 186 unmodified lines
187187
188188 s->sample_fmt[0] = sample_fmt_in;
189189 s->sample_fmt[1] = sample_fmt_out;
190− s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3;
191− s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3;
190+ s->sample_size[0] = av_get_bytes_per_sample(s->sample_fmt[0]);
191+ s->sample_size[1] = av_get_bytes_per_sample(s->sample_fmt[1]);
192192
193193 if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
194194 if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
libavcodec/utils.c+1−1
@@ -1131,7 +1131,7 @@ int av_get_bits_per_sample(enum CodecID codec_id){ · 1130 unmodified lines
11311131
11321132 #if FF_API_OLD_SAMPLE_FMT
11331133 int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) {
1134− return av_get_bits_per_sample_fmt(sample_fmt);
1134+ return av_get_bytes_per_sample(sample_fmt) << 3;
11351135 }
11361136 #endif
11371137
libavcodec/vmdav.c+1−1
@@ -447,7 +447,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) · 446 unmodified lines
447447 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
448448 else
449449 avctx->sample_fmt = AV_SAMPLE_FMT_U8;
450− s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3;
450+ s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt);
451451
452452 av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
453453 "block align = %d, sample rate = %d\n",
libavcodec/vorbisdec.c+1−1
@@ -1646,7 +1646,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, · 1645 unmodified lines
16461646 vc->audio_channels);
16471647
16481648 *data_size = len * vc->audio_channels *
1649− (av_get_bits_per_sample_fmt(avccontext->sample_fmt) / 8);
1649+ av_get_bytes_per_sample(avccontext->sample_fmt);
16501650
16511651 return buf_size ;
16521652 }
libavfilter/defaults.c+1−1
@@ -84,7 +84,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per · 83 unmodified lines
8484 samples->refcount = 1;
8585 samples->free = ff_avfilter_default_free_buffer;
8686
87− sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3;
87+ sample_size = av_get_bytes_per_sample(sample_fmt);
8888 chans_nb = av_get_channel_layout_nb_channels(channel_layout);
8989
9090 per_channel_size = size/chans_nb;
libavformat/matroskaenc.c+1−1
@@ -527,7 +527,7 @@ static int mkv_write_tracks(AVFormatContext *s) · 526 unmodified lines
527527 AVDictionaryEntry *tag;
528528
529529 if (!bit_depth)
530− bit_depth = av_get_bits_per_sample_fmt(codec->sample_fmt);
530+ bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
531531
532532 if (codec->codec_id == CODEC_ID_AAC)
533533 get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t