av_get_bits_per_sample_fmt() is deprecated.
Unified · Split
| @@ -778,8 +778,8 @@ static void do_audio_out(AVFormatContext *s, · 777 unmodified lines | |||
| 778 | int size_out, frame_bytes, ret, resample_changed; | 778 | int size_out, frame_bytes, ret, resample_changed; |
| 779 | AVCodecContext *enc= ost->st->codec; | 779 | AVCodecContext *enc= ost->st->codec; |
| 780 | AVCodecContext *dec= ist->st->codec; | 780 | AVCodecContext *dec= ist->st->codec; |
| 781 | int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8; | 781 | int osize = av_get_bytes_per_sample(enc->sample_fmt); |
| 782 | int isize= av_get_bits_per_sample_fmt(dec->sample_fmt)/8; | 782 | int isize = av_get_bytes_per_sample(dec->sample_fmt); |
| 783 | const int coded_bps = av_get_bits_per_sample(enc->codec->id); | 783 | const int coded_bps = av_get_bits_per_sample(enc->codec->id); |
| 784 | 784 | ||
| 785 | need_realloc: | 785 | need_realloc: |
| @@ -1481,7 +1481,7 @@ static int output_packet(AVInputStream *ist, int ist_index, · 695 unmodified lines | |||
| 1481 | #endif | 1481 | #endif |
| 1482 | 1482 | ||
| 1483 | AVPacket avpkt; | 1483 | 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); |
| 1485 | 1485 | ||
| 1486 | if(ist->next_pts == AV_NOPTS_VALUE) | 1486 | if(ist->next_pts == AV_NOPTS_VALUE) |
| 1487 | ist->next_pts= ist->pts; | 1487 | ist->next_pts= ist->pts; |
| @@ -2032,7 +2032,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) · 2031 unmodified lines | |||
| 2032 | if (is->reformat_ctx) { | 2032 | if (is->reformat_ctx) { |
| 2033 | const void *ibuf[6]= {is->audio_buf1}; | 2033 | const void *ibuf[6]= {is->audio_buf1}; |
| 2034 | void *obuf[6]= {is->audio_buf2}; | 2034 | 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)}; |
| 2036 | int ostride[6]= {2}; | 2036 | int ostride[6]= {2}; |
| 2037 | int len= data_size/istride[0]; | 2037 | int len= data_size/istride[0]; |
| 2038 | if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { | 2038 | if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { |
| @@ -2177,7 +2177,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, · 2176 unmodified lines | |||
| 2177 | } | 2177 | } |
| 2178 | 2178 | ||
| 2179 | data_size_tmp = samples * avctx->channels * | 2179 | 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); |
| 2181 | if (*data_size < data_size_tmp) { | 2181 | if (*data_size < data_size_tmp) { |
| 2182 | av_log(avctx, AV_LOG_ERROR, | 2182 | av_log(avctx, AV_LOG_ERROR, |
| 2183 | "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", | 2183 | "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", |
| @@ -1422,7 +1422,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, · 1421 unmodified lines | |||
| 1422 | } | 1422 | } |
| 1423 | } | 1423 | } |
| 1424 | *data_size = s->num_blocks * 256 * avctx->channels * | 1424 | *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); |
| 1426 | return FFMIN(buf_size, s->frame_size); | 1426 | return FFMIN(buf_size, s->frame_size); |
| 1427 | } | 1427 | } |
| 1428 | 1428 | ||
| @@ -1450,7 +1450,7 @@ static int decode_frame(AVCodecContext *avctx, · 1449 unmodified lines | |||
| 1450 | 1450 | ||
| 1451 | // check for size of decoded data | 1451 | // check for size of decoded data |
| 1452 | size = ctx->cur_frame_length * avctx->channels * | 1452 | 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); |
| 1454 | 1454 | ||
| 1455 | if (size > *data_size) { | 1455 | if (size > *data_size) { |
| 1456 | av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n"); | 1456 | 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 | |||
| 1714 | ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) * | 1714 | ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) * |
| 1715 | ctx->cur_frame_length * | 1715 | ctx->cur_frame_length * |
| 1716 | avctx->channels * | 1716 | avctx->channels * |
| 1717 | (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3)); | 1717 | av_get_bytes_per_sample(avctx->sample_fmt)); |
| 1718 | if (!ctx->crc_buffer) { | 1718 | if (!ctx->crc_buffer) { |
| 1719 | av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); | 1719 | av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); |
| 1720 | decode_end(avctx); | 1720 | decode_end(avctx); |
| @@ -1813,7 +1813,7 @@ static int dca_decode_frame(AVCodecContext * avctx, · 1812 unmodified lines | |||
| 1813 | } | 1813 | } |
| 1814 | 1814 | ||
| 1815 | out_size = 256 / 8 * s->sample_blocks * channels * | 1815 | 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); |
| 1817 | if (*data_size < out_size) | 1817 | if (*data_size < out_size) |
| 1818 | return -1; | 1818 | return -1; |
| 1819 | *data_size = out_size; | 1819 | *data_size = out_size; |
| @@ -187,8 +187,8 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, · 186 unmodified lines | |||
| 187 | 187 | ||
| 188 | s->sample_fmt[0] = sample_fmt_in; | 188 | s->sample_fmt[0] = sample_fmt_in; |
| 189 | s->sample_fmt[1] = sample_fmt_out; | 189 | s->sample_fmt[1] = sample_fmt_out; |
| 190 | s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0]) >> 3; | 190 | s->sample_size[0] = av_get_bytes_per_sample(s->sample_fmt[0]); |
| 191 | s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1]) >> 3; | 191 | s->sample_size[1] = av_get_bytes_per_sample(s->sample_fmt[1]); |
| 192 | 192 | ||
| 193 | if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { | 193 | if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { |
| 194 | if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, | 194 | if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, |
| @@ -1131,7 +1131,7 @@ int av_get_bits_per_sample(enum CodecID codec_id){ · 1130 unmodified lines | |||
| 1131 | 1131 | ||
| 1132 | #if FF_API_OLD_SAMPLE_FMT | 1132 | #if FF_API_OLD_SAMPLE_FMT |
| 1133 | int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) { | 1133 | 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; |
| 1135 | } | 1135 | } |
| 1136 | #endif | 1136 | #endif |
| 1137 | 1137 | ||
| @@ -447,7 +447,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) · 446 unmodified lines | |||
| 447 | avctx->sample_fmt = AV_SAMPLE_FMT_S16; | 447 | avctx->sample_fmt = AV_SAMPLE_FMT_S16; |
| 448 | else | 448 | else |
| 449 | avctx->sample_fmt = AV_SAMPLE_FMT_U8; | 449 | 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); |
| 451 | 451 | ||
| 452 | av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " | 452 | av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " |
| 453 | "block align = %d, sample rate = %d\n", | 453 | "block align = %d, sample rate = %d\n", |
| @@ -1646,7 +1646,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, · 1645 unmodified lines | |||
| 1646 | vc->audio_channels); | 1646 | vc->audio_channels); |
| 1647 | 1647 | ||
| 1648 | *data_size = len * vc->audio_channels * | 1648 | *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); |
| 1650 | 1650 | ||
| 1651 | return buf_size ; | 1651 | return buf_size ; |
| 1652 | } | 1652 | } |
| @@ -84,7 +84,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per · 83 unmodified lines | |||
| 84 | samples->refcount = 1; | 84 | samples->refcount = 1; |
| 85 | samples->free = ff_avfilter_default_free_buffer; | 85 | samples->free = ff_avfilter_default_free_buffer; |
| 86 | 86 | ||
| 87 | sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3; | 87 | sample_size = av_get_bytes_per_sample(sample_fmt); |
| 88 | chans_nb = av_get_channel_layout_nb_channels(channel_layout); | 88 | chans_nb = av_get_channel_layout_nb_channels(channel_layout); |
| 89 | 89 | ||
| 90 | per_channel_size = size/chans_nb; | 90 | per_channel_size = size/chans_nb; |
| @@ -527,7 +527,7 @@ static int mkv_write_tracks(AVFormatContext *s) · 526 unmodified lines | |||
| 527 | AVDictionaryEntry *tag; | 527 | AVDictionaryEntry *tag; |
| 528 | 528 | ||
| 529 | if (!bit_depth) | 529 | 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; |
| 531 | 531 | ||
| 532 | if (codec->codec_id == CODEC_ID_AAC) | 532 | if (codec->codec_id == CODEC_ID_AAC) |
| 533 | get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate); | 533 | get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate); |