diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-29 13:58:57 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-29 14:00:44 +0100 |
commit | d7b20bfbb582c369518c73720fb4b0266714cde6 (patch) | |
tree | 27dfaa2c3e2f273e661555336b6ed6d6b9eb9e5e /libavformat/utils.c | |
parent | 076300bf8b43d5d56a91cd2ad845d596969c87cf (diff) | |
parent | 5c7bf2dddee5bdfa247ff0d57cb8a37d19077f66 (diff) | |
download | ffmpeg-streaming-d7b20bfbb582c369518c73720fb4b0266714cde6.zip ffmpeg-streaming-d7b20bfbb582c369518c73720fb4b0266714cde6.tar.gz |
Merge commit '5c7bf2dddee5bdfa247ff0d57cb8a37d19077f66'
* commit '5c7bf2dddee5bdfa247ff0d57cb8a37d19077f66':
lavf: move nuv fourcc audio tags from riff to nuv
lavf: add a common function for selecting a pcm codec from parameters
Conflicts:
libavformat/internal.h
libavformat/mov.c
libavformat/riff.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 3e87dbc..b7506de 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2440,6 +2440,37 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) return AV_CODEC_ID_NONE; } +enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags) +{ + if (flt) { + switch (bps) { + case 32: return be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE; + case 64: return be ? AV_CODEC_ID_PCM_F64BE : AV_CODEC_ID_PCM_F64LE; + default: return AV_CODEC_ID_NONE; + } + } else { + bps += 7; + bps >>= 3; + if (sflags & (1 << (bps - 1))) { + switch (bps) { + case 1: return AV_CODEC_ID_PCM_S8; + case 2: return be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE; + case 3: return be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE; + case 4: return be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE; + default: return AV_CODEC_ID_NONE; + } + } else { + switch (bps) { + case 1: return AV_CODEC_ID_PCM_U8; + case 2: return be ? AV_CODEC_ID_PCM_U16BE : AV_CODEC_ID_PCM_U16LE; + case 3: return be ? AV_CODEC_ID_PCM_U24BE : AV_CODEC_ID_PCM_U24LE; + case 4: return be ? AV_CODEC_ID_PCM_U32BE : AV_CODEC_ID_PCM_U32LE; + default: return AV_CODEC_ID_NONE; + } + } + } +} + unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum AVCodecID id) { int i; |