Mercurial > mplayer.hg
comparison libmpdemux/demux_lavf.c @ 25789:5cdba0d1c4cf
Allow overriding the codec_tag for audio codecs, and always override
codec_tag for PCM codecs (codec_id from lavf is correct, but the
codec_tag may be non-zero and wrong).
Also fixes bugzilla #983
author | rtogni |
---|---|
date | Sun, 20 Jan 2008 12:57:53 +0000 |
parents | d4fe6e23283e |
children | 327e98d7d2be |
comparison
equal
deleted
inserted
replaced
25788:495cbb49fb1b | 25789:5cdba0d1c4cf |
---|---|
90 { CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, | 90 { CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, |
91 { CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, | 91 { CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, |
92 { CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, | 92 { CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, |
93 { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, | 93 { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, |
94 { CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, | 94 { CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, |
95 { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, | |
96 { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')}, | |
97 { CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, | |
98 { CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, | 95 { CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, |
99 { CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, | 96 { CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, |
100 { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, | 97 { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, |
101 { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, | 98 { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, |
102 { CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, | 99 { CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, |
103 { CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, | 100 { CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, |
104 { 0, 0 }, | 101 { 0, 0 }, |
105 }; | 102 }; |
106 | 103 |
107 const struct AVCodecTag *mp_wav_taglists[] = {codec_wav_tags, mp_wav_tags, 0}; | 104 const struct AVCodecTag *mp_wav_taglists[] = {codec_wav_tags, mp_wav_tags, 0}; |
105 | |
106 static const AVCodecTag mp_wav_override_tags[] = { | |
107 { CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, | |
108 { CODEC_ID_PCM_U8, 0}, | |
109 { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')}, | |
110 { CODEC_ID_PCM_S16LE, 0}, | |
111 { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, | |
112 { 0, 0 }, | |
113 }; | |
114 | |
115 const struct AVCodecTag *mp_wav_override_taglists[] = {mp_wav_override_tags, 0}; | |
108 | 116 |
109 static const AVCodecTag mp_bmp_tags[] = { | 117 static const AVCodecTag mp_bmp_tags[] = { |
110 { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')}, | 118 { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')}, |
111 { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, | 119 { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, |
112 { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, | 120 { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, |
269 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "lavf", i); | 277 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "lavf", i); |
270 if(!sh_audio) | 278 if(!sh_audio) |
271 break; | 279 break; |
272 priv->astreams[priv->audio_streams] = i; | 280 priv->astreams[priv->audio_streams] = i; |
273 priv->audio_streams++; | 281 priv->audio_streams++; |
282 // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag | |
283 codec->codec_tag= av_codec_get_tag(mp_wav_override_taglists, codec->codec_id); | |
274 // mp4a tag is used for all mp4 files no matter what they actually contain | 284 // mp4a tag is used for all mp4 files no matter what they actually contain |
275 if(codec->codec_tag == MKTAG('m', 'p', '4', 'a')) | 285 if(codec->codec_tag == MKTAG('m', 'p', '4', 'a')) |
276 codec->codec_tag= 0; | 286 codec->codec_tag= 0; |
277 if(codec->codec_id == CODEC_ID_ADPCM_IMA_AMV) | 287 if(codec->codec_id == CODEC_ID_ADPCM_IMA_AMV) |
278 codec->codec_tag= MKTAG('A','M','V','A'); | 288 codec->codec_tag= MKTAG('A','M','V','A'); |