diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-07-07 17:50:09 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-07-07 17:50:09 +0000 |
commit | ac3e183403ecc246520fd8882eb8ff5e58473413 (patch) | |
tree | 6cfc486d8fae742fcb54a943907f82666163e82e /libavcodec | |
parent | 29c5cdcaec66b3e2a783eb1d34bdb8cba5d9192f (diff) | |
download | ffmpeg-ac3e183403ecc246520fd8882eb8ff5e58473413.tar.gz |
av_get_bits_per_sample and due simplifications
Originally committed as revision 5661 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 4 | ||||
-rw-r--r-- | libavcodec/utils.c | 28 |
2 files changed, 32 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 5509621d4b..a829fd6dd1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2499,6 +2499,10 @@ void avcodec_default_free_buffers(AVCodecContext *s); */ char av_get_pict_type_char(int pict_type); +/** + * returns codec bits per sample + */ +int av_get_bits_per_sample(enum CodecID codec_id); /* frame parsing */ typedef struct AVCodecParserContext { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 641c680470..b343ba085f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1304,6 +1304,34 @@ char av_get_pict_type_char(int pict_type){ } } +int av_get_bits_per_sample(enum CodecID codec_id){ + switch(codec_id){ + case CODEC_ID_PCM_ALAW: + case CODEC_ID_PCM_MULAW: + case CODEC_ID_PCM_S8: + case CODEC_ID_PCM_U8: + return 8; + case CODEC_ID_PCM_S16BE: + case CODEC_ID_PCM_S16LE: + case CODEC_ID_PCM_U16BE: + case CODEC_ID_PCM_U16LE: + return 16; + case CODEC_ID_PCM_S24DAUD: + case CODEC_ID_PCM_S24BE: + case CODEC_ID_PCM_S24LE: + case CODEC_ID_PCM_U24BE: + case CODEC_ID_PCM_U24LE: + return 24; + case CODEC_ID_PCM_S32BE: + case CODEC_ID_PCM_S32LE: + case CODEC_ID_PCM_U32BE: + case CODEC_ID_PCM_U32LE: + return 32; + default: + return 0; + } +} + /* av_log API */ static int av_log_level = AV_LOG_INFO; |