[FFmpeg-devel] [PATCH] libavcodec/utils: av_get_exact_bits_per_sample fixed to return "1" for DSD codecs.

Ihar Tumashyk itumashyk at gmail.com
Sat Aug 1 01:16:21 CEST 2015


01.08.2015 у 02:01 Ganesh Ajjanagadde напісаў:
> On Fri, Jul 31, 2015 at 6:52 PM, Ihar A. Tumashyk <itumashyk at gmail.com> wrote:
>> All DSD codes have 1 bit per sample.
>> https://en.wikipedia.org/wiki/Direct_Stream_Digital
>>
>> Signed-off-by: Ihar A. Tumashyk <itumashyk at gmail.com>
>> ---
>>   libavcodec/utils.c | 9 +++++----
>>   1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>> index 5dbd0cf..52bfe01 100644
>> --- a/libavcodec/utils.c
>> +++ b/libavcodec/utils.c
>> @@ -3311,6 +3311,11 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
>>   int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
>>   {
>>       switch (codec_id) {
>> +    case AV_CODEC_ID_DSD_LSBF:
>> +    case AV_CODEC_ID_DSD_MSBF:
>> +    case AV_CODEC_ID_DSD_LSBF_PLANAR:
>> +    case AV_CODEC_ID_DSD_MSBF_PLANAR:
>> +        return 1;
>>       case AV_CODEC_ID_8SVX_EXP:
>>       case AV_CODEC_ID_8SVX_FIB:
>>       case AV_CODEC_ID_ADPCM_CT:
>> @@ -3321,10 +3326,6 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
>>       case AV_CODEC_ID_ADPCM_G722:
>>       case AV_CODEC_ID_ADPCM_YAMAHA:
>>           return 4;
>> -    case AV_CODEC_ID_DSD_LSBF:
>> -    case AV_CODEC_ID_DSD_MSBF:
>> -    case AV_CODEC_ID_DSD_LSBF_PLANAR:
>> -    case AV_CODEC_ID_DSD_MSBF_PLANAR:
>>       case AV_CODEC_ID_PCM_ALAW:
>>       case AV_CODEC_ID_PCM_MULAW:
>>       case AV_CODEC_ID_PCM_S8:
>> --
>> 2.1.4
>
> LGTM, but I am not the maintainer for it.
> Out of curiosity, did you run into this via code inspection or trying
> to fix something?

Yes, I'm working with DSF files and found that ffprobe returns wrong 
sample rates for these files. This is
because it divided by 8 while reading but (as compensation maybe to have 
correct bitrate) bps is 8.

Refer my next patch [PATCH 2/2] libavformat/dsfdec: Error 
dsf_read_header fixed.

>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



More information about the ffmpeg-devel mailing list