diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-11-27 14:52:38 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-11-28 11:18:50 -0500 |
commit | 261e9348ef377efc8672c6f8ade974cee7db8e49 (patch) | |
tree | ff98f739e44a47e958e029c54026725b0f610cb5 /libavformat/mov.c | |
parent | bfe5454cd238b16e7977085f880205229103eccb (diff) | |
download | ffmpeg-261e9348ef377efc8672c6f8ade974cee7db8e49.tar.gz |
lavf: add a common function for selecting a pcm codec from parameters
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 35c07bd0a2..c6ff84bbcd 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1057,33 +1057,12 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) */ enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags) { - if (flags & 1) { // floating point - if (flags & 2) { // big endian - if (bps == 32) return AV_CODEC_ID_PCM_F32BE; - else if (bps == 64) return AV_CODEC_ID_PCM_F64BE; - } else { - if (bps == 32) return AV_CODEC_ID_PCM_F32LE; - else if (bps == 64) return AV_CODEC_ID_PCM_F64LE; - } - } else { - if (flags & 2) { - if (bps == 8) - // signed integer - if (flags & 4) return AV_CODEC_ID_PCM_S8; - else return AV_CODEC_ID_PCM_U8; - else if (bps == 16) return AV_CODEC_ID_PCM_S16BE; - else if (bps == 24) return AV_CODEC_ID_PCM_S24BE; - else if (bps == 32) return AV_CODEC_ID_PCM_S32BE; - } else { - if (bps == 8) - if (flags & 4) return AV_CODEC_ID_PCM_S8; - else return AV_CODEC_ID_PCM_U8; - else if (bps == 16) return AV_CODEC_ID_PCM_S16LE; - else if (bps == 24) return AV_CODEC_ID_PCM_S24LE; - else if (bps == 32) return AV_CODEC_ID_PCM_S32LE; - } - } - return AV_CODEC_ID_NONE; + /* lpcm flags: + * 0x1 = float + * 0x2 = big-endian + * 0x4 = signed + */ + return ff_get_pcm_codec_id(bps, flags & 1, flags & 2, flags & 4 ? -1 : 0); } int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) |