annotate libmpdemux/mp_taglists.c @ 36569:6ff73f13785c

demux_roq: Simplify code by using calloc. This also fixes the issue that total_audio_sample_count was never initialized.
author reimar
date Mon, 20 Jan 2014 22:08:34 +0000
parents 15eb63049fcb
children 5df05eaefb67
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
1 /*
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
2 * This file is part of MPlayer.
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
3 *
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
7 * (at your option) any later version.
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
8 *
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
12 * GNU General Public License for more details.
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
13 *
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
17 */
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
18
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
19 #include "config.h"
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
20
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
21 #include <stdint.h>
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
22 #include "mp_msg.h"
29859
1a2c12c0de26 Fix declarations in mp_taglists.h and include it in mp_taglists.c to
reimar
parents: 29778
diff changeset
23 #include "mp_taglists.h"
34196
c910df5dc9ae Map 8svx fourcc to 8raw instead of relying on non-existing CODEC_ID.
diego
parents: 34156
diff changeset
24 #include "libavutil/common.h"
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
25 #include "libavformat/avformat.h"
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
26 // for AVCodecTag
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
27 #include "libavformat/internal.h"
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
28
34156
758264af214d Consistently use "struct AVCodecTag" and not sometimes just "AVCodecTag".
reimar
parents: 34155
diff changeset
29 static const struct AVCodecTag mp_wav_tags[] = {
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
30 { AV_CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
31 { AV_CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x') },
35465
bb29a2a95d31 10l: Add forgotten mp_taglists.c change to enable afc decoding.
cehoyos
parents: 35186
diff changeset
32 #if LIBAVUTIL_VERSION_MICRO >= 100
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
33 { AV_CODEC_ID_ADPCM_AFC, MKTAG('A', 'F', 'C', ' ') },
36173
c99608e4d695 Support Nintendo Gamecube DTK files.
cehoyos
parents: 36094
diff changeset
34 { AV_CODEC_ID_ADPCM_DTK, MKTAG('D', 'T', 'K', ' ') },
35465
bb29a2a95d31 10l: Add forgotten mp_taglists.c change to enable afc decoding.
cehoyos
parents: 35186
diff changeset
35 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
36 { AV_CODEC_ID_ADPCM_IMA_APC, MKTAG('A', 'P', 'C', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
37 { AV_CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
38 { AV_CODEC_ID_ADPCM_EA_R1, MKTAG('E', 'A', 'R', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
39 { AV_CODEC_ID_ADPCM_EA_R2, MKTAG('E', 'A', 'R', '2') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
40 { AV_CODEC_ID_ADPCM_EA_R3, MKTAG('E', 'A', 'R', '3') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
41 { AV_CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
42 { AV_CODEC_ID_ADPCM_IMA_EA_EACS, MKTAG('E', 'A', 'C', 'S') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
43 { AV_CODEC_ID_ADPCM_IMA_ISS, MKTAG('A', 'I', 'S', 'S') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
44 { AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
45 { AV_CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
46 { AV_CODEC_ID_ADPCM_XA, MKTAG('P', 'S', 'X', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
47 { AV_CODEC_ID_AMR_NB, MKTAG('n', 'b', 0, 0) },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
48 { AV_CODEC_ID_ATRAC1, MKTAG('A', 'T', 'R', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
49 { AV_CODEC_ID_BINKAUDIO_DCT, MKTAG('B', 'A', 'U', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
50 { AV_CODEC_ID_BINKAUDIO_RDFT, MKTAG('B', 'A', 'U', '2') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
51 { AV_CODEC_ID_BMV_AUDIO, MKTAG('B', 'M', 'V', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
52 { AV_CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
53 { AV_CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
54 { AV_CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3') },
34413
8eebe2a33894 libmpdemux/mp_taglists.c: Replace #ifdef with #if directives
siretart
parents: 34411
diff changeset
55 #if LIBAVUTIL_VERSION_MICRO >= 100
35735
894b2d8a9405 Also support EVRC in qcp.
cehoyos
parents: 35715
diff changeset
56 { AV_CODEC_ID_EVRC, MKTAG('s', 'e', 'v', 'c') },
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
57 { AV_CODEC_ID_FFWAVESYNTH, MKTAG('F', 'F', 'W', 'S') },
34404
95f802285711 Allow compilation with Libav
siretart
parents: 34363
diff changeset
58 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
59 { AV_CODEC_ID_G723_1, MKTAG('7', '2', '3', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
60 { AV_CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
61 { AV_CODEC_ID_ILBC, MKTAG('i', 'l', 'b', 'c') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
62 { AV_CODEC_ID_MLP, MKTAG('M', 'L', 'P', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
63 { AV_CODEC_ID_MP1, 0x50 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
64 { AV_CODEC_ID_MP4ALS, MKTAG('A', 'L', 'S', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
65 { AV_CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
66 { AV_CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
67 { AV_CODEC_ID_NELLYMOSER, MKTAG('n', 'm', 'o', 's') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
68 { AV_CODEC_ID_OPUS, MKTAG('o', 'p', 'u', 's') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
69 { AV_CODEC_ID_PCM_LXF, MKTAG('P', 'L', 'X', 'F') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
70 { AV_CODEC_ID_PCM_S16LE_PLANAR, MKTAG('1', '6', 'P', 'L') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
71 { AV_CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
72 { AV_CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
73 { AV_CODEC_ID_RA_144, MKTAG('1', '4', '_', '4') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
74 { AV_CODEC_ID_RA_288, MKTAG('2', '8', '_', '8') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
75 { AV_CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
76 { AV_CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
77 { AV_CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
78 { AV_CODEC_ID_TAK, MKTAG('T', 'A', 'K', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
79 { AV_CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
80 { AV_CODEC_ID_TWINVQ, MKTAG('T', 'W', 'I', '2') },
34910
3629ef4a19ce Support LucasArts SMUSH and VIMA decoding.
cehoyos
parents: 34742
diff changeset
81 #if LIBAVUTIL_VERSION_MICRO >= 100
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
82 { AV_CODEC_ID_VIMA, MKTAG('V', 'I', 'M', 'A') },
34910
3629ef4a19ce Support LucasArts SMUSH and VIMA decoding.
cehoyos
parents: 34742
diff changeset
83 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
84 { AV_CODEC_ID_VMDAUDIO, MKTAG('V', 'M', 'D', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
85 { AV_CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
86 { AV_CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
87 { AV_CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n') },
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
88 { 0, 0 },
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
89 };
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
90
34156
758264af214d Consistently use "struct AVCodecTag" and not sometimes just "AVCodecTag".
reimar
parents: 34155
diff changeset
91 static const struct AVCodecTag mp_codecid_override_tags[] = {
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
92 { AV_CODEC_ID_8SVX_EXP, MKTAG('8', 'e', 'x', 'p') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
93 { AV_CODEC_ID_8SVX_FIB, MKTAG('8', 'f', 'i', 'b') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
94 { MKBETAG('8','S','V','X'), MKTAG('8', 'r', 'a', 'w') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
95 { AV_CODEC_ID_AAC, MKTAG('M', 'P', '4', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
96 { AV_CODEC_ID_AAC_LATM, MKTAG('M', 'P', '4', 'L') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
97 { AV_CODEC_ID_AC3, 0x2000 },
35813
3e1597463be1 Support decoding G722 in au.
cehoyos
parents: 35735
diff changeset
98 { AV_CODEC_ID_ADPCM_G722, 0x28f },
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
99 { AV_CODEC_ID_ADPCM_IMA_EA_SEAD, MKTAG('S', 'E', 'A', 'D') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
100 { AV_CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A') },
36471
15eb63049fcb Support Atrac 3+ in oma files.
cehoyos
parents: 36383
diff changeset
101 #if LIBAVUTIL_VERSION_MICRO >= 100
15eb63049fcb Support Atrac 3+ in oma files.
cehoyos
parents: 36383
diff changeset
102 { AV_CODEC_ID_ATRAC3P, 0xE923AABF},
15eb63049fcb Support Atrac 3+ in oma files.
cehoyos
parents: 36383
diff changeset
103 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
104 { AV_CODEC_ID_DTS, 0x2001 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
105 { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
106 { AV_CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
107 { AV_CODEC_ID_ESCAPE124, MKTAG('E', '1', '2', '4') },
34413
8eebe2a33894 libmpdemux/mp_taglists.c: Replace #ifdef with #if directives
siretart
parents: 34411
diff changeset
108 #if LIBAVUTIL_VERSION_MICRO >= 100
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
109 { AV_CODEC_ID_ESCAPE130, MKTAG('E', '1', '3', '0') },
34404
95f802285711 Allow compilation with Libav
siretart
parents: 34363
diff changeset
110 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
111 { AV_CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
36383
12b7f66d1a47 Support little endian G.726 as found in Sun au files.
cehoyos
parents: 36380
diff changeset
112 #if LIBAVUTIL_VERSION_MICRO >= 100
12b7f66d1a47 Support little endian G.726 as found in Sun au files.
cehoyos
parents: 36380
diff changeset
113 { AV_CODEC_ID_ADPCM_G726LE, MKTAG('6', '2', '7', 'G') },
12b7f66d1a47 Support little endian G.726 as found in Sun au files.
cehoyos
parents: 36380
diff changeset
114 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
115 { AV_CODEC_ID_G729, MKTAG('G', '7', '2', '9') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
116 { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
117 { AV_CODEC_ID_MP3, 0x55 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
118 { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'V') },
34920
1431b26d1427 Support FFmpeg Packed Animation File decoder.
cehoyos
parents: 34910
diff changeset
119 #if LIBAVUTIL_VERSION_MICRO >= 100
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
120 { AV_CODEC_ID_PAF_AUDIO, MKTAG('P', 'A', 'F', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
121 { AV_CODEC_ID_PAF_VIDEO, MKTAG('P', 'A', 'F', 'V') },
34920
1431b26d1427 Support FFmpeg Packed Animation File decoder.
cehoyos
parents: 34910
diff changeset
122 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
123 { AV_CODEC_ID_PCM_BLURAY, MKTAG('B', 'P', 'C', 'M') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
124 { AV_CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
125 { AV_CODEC_ID_PCM_U8, 1 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
126 { AV_CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
127 { AV_CODEC_ID_PCM_S16LE, 1 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
128 { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
129 { AV_CODEC_ID_PCM_S24LE, 1 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
130 { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
131 { AV_CODEC_ID_PCM_S32LE, 1 },
36380
fd2f66e5d7c9 Support playback of f32le in mov.
cehoyos
parents: 36378
diff changeset
132 { AV_CODEC_ID_PCM_F32LE, MKTAG('2', '3', 'l', 'f') },
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
133 { AV_CODEC_ID_MP2, 0x50 },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
134 { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'G', '2') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
135 { AV_CODEC_ID_TRUEHD, MKTAG('T', 'R', 'H', 'D') },
36094
d94fff99b49b Support playing VC-1 in transport streams with -demuxer lavf.
cehoyos
parents: 35864
diff changeset
136 { AV_CODEC_ID_VC1, MKTAG('V', 'C', '-', '1') },
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
137 { 0, 0 },
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
138 };
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
139
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
140 static const struct AVCodecTag * const mp_codecid_override_taglists[] =
29551
19fa7aedb519 Rename mp_wav_override_tag* as mp_codecid_override_tag* to reflect that
cehoyos
parents: 29549
diff changeset
141 {mp_codecid_override_tags, 0};
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
142
34156
758264af214d Consistently use "struct AVCodecTag" and not sometimes just "AVCodecTag".
reimar
parents: 34155
diff changeset
143 static const struct AVCodecTag mp_bmp_tags[] = {
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
144 { AV_CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
145 { AV_CODEC_ID_ANM, MKTAG('A', 'N', 'M', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
146 { AV_CODEC_ID_ANSI, MKTAG('T', 'X', 'T', '4') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
147 { AV_CODEC_ID_AVS, MKTAG('A', 'V', 'S', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
148 { AV_CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
149 { AV_CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
150 { AV_CODEC_ID_BMP, MKTAG('b', 'm', 'p', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
151 { AV_CODEC_ID_BMV_VIDEO, MKTAG('B', 'M', 'V', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
152 { AV_CODEC_ID_C93, MKTAG('C', '9', '3', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
153 { AV_CODEC_ID_CDGRAPHICS, MKTAG('C', 'D', 'G', 'R') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
154 { AV_CODEC_ID_CDXL, MKTAG('C', 'D', 'X', 'L') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
155 { AV_CODEC_ID_CMV, MKTAG('M', 'V', 'I', 'f') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
156 { AV_CODEC_ID_DFA, MKTAG('C', 'D', 'F', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
157 { AV_CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
158 { AV_CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
159 { AV_CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
160 { AV_CODEC_ID_FLIC, MKTAG('f', 'l', 'i', 'c') },
36378
939ec5ba0c58 Preliminary support for FFmpeg HEVC decoder.
cehoyos
parents: 36173
diff changeset
161 #if LIBAVUTIL_VERSION_MICRO >= 100
939ec5ba0c58 Preliminary support for FFmpeg HEVC decoder.
cehoyos
parents: 36173
diff changeset
162 { AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
939ec5ba0c58 Preliminary support for FFmpeg HEVC decoder.
cehoyos
parents: 36173
diff changeset
163 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
164 { AV_CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
165 { AV_CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
166 { AV_CODEC_ID_JV, MKTAG('F', 'F', 'J', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
167 { AV_CODEC_ID_MAD, MKTAG('M', 'A', 'D', 'k') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
168 { AV_CODEC_ID_MDEC, MKTAG('M', 'D', 'E', 'C') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
169 { AV_CODEC_ID_MMVIDEO, MKTAG('M', 'M', 'V', ' ') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
170 { AV_CODEC_ID_MOTIONPIXELS, MKTAG('M', 'V', 'I', '1') },
35600
f15a80d56c7e Support FFmpeg Silicon Graphics Motion Video Compressor 1 and 2.
cehoyos
parents: 35599
diff changeset
171 #if LIBAVUTIL_VERSION_MICRO >= 100
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
172 { AV_CODEC_ID_MVC1, MKTAG('m', 'v', 'c', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
173 { AV_CODEC_ID_MVC2, MKTAG('m', 'v', 'c', '2') },
35600
f15a80d56c7e Support FFmpeg Silicon Graphics Motion Video Compressor 1 and 2.
cehoyos
parents: 35599
diff changeset
174 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
175 { AV_CODEC_ID_MXPEG, MKTAG('M', 'X', 'P', 'G') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
176 { AV_CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
177 { AV_CODEC_ID_RL2, MKTAG('R', 'L', '2', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
178 { AV_CODEC_ID_ROQ, MKTAG('R', 'o', 'Q', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
179 { AV_CODEC_ID_RV10, MKTAG('R', 'V', '1', '0') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
180 { AV_CODEC_ID_RV20, MKTAG('R', 'V', '2', '0') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
181 { AV_CODEC_ID_RV30, MKTAG('R', 'V', '3', '0') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
182 { AV_CODEC_ID_RV40, MKTAG('R', 'V', '4', '0') },
34910
3629ef4a19ce Support LucasArts SMUSH and VIMA decoding.
cehoyos
parents: 34742
diff changeset
183 #if LIBAVUTIL_VERSION_MICRO >= 100
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
184 { AV_CODEC_ID_SANM, MKTAG('S', 'A', 'N', 'M') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
185 { AV_CODEC_ID_SGIRLE, MKTAG('r', 'l', 'e', '1') },
34910
3629ef4a19ce Support LucasArts SMUSH and VIMA decoding.
cehoyos
parents: 34742
diff changeset
186 #endif
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
187 { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
188 { AV_CODEC_ID_TMV, MKTAG('t', 'm', 'v', '8') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
189 { AV_CODEC_ID_TGV, MKTAG('f', 'V', 'G', 'T') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
190 { AV_CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
191 { AV_CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
192 { AV_CODEC_ID_TXD, MKTAG('T', 'X', 'D', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
193 { AV_CODEC_ID_VP6A, MKTAG('V', 'P', '6', 'A') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
194 { AV_CODEC_ID_VMDVIDEO, MKTAG('V', 'M', 'D', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
195 { AV_CODEC_ID_WS_VQA, MKTAG('V', 'Q', 'A', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
196 { AV_CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V') },
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
197 { AV_CODEC_ID_YOP, MKTAG('Y', 'O', 'P', '1') },
26328
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
198 { 0, 0 },
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
199 };
11aac031b4b7 Split the lavf taglists out of the lavf muxer to allow using libmpmux
albeu
parents:
diff changeset
200
34636
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
201 static void get_taglists(const struct AVCodecTag *dst[3], int audio)
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
202 {
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
203 dst[0] = audio ? mp_wav_tags : mp_bmp_tags;
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
204 dst[1] = audio ? avformat_get_riff_audio_tags() : avformat_get_riff_video_tags();
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
205 dst[2] = NULL;
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
206 }
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
207
35864
9b88b87f5921 Fix mplayer compilation.
iive
parents: 35813
diff changeset
208 enum AVCodecID mp_tag2codec_id(uint32_t tag, int audio)
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
209 {
34636
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
210 const struct AVCodecTag *taglists[3];
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
211 get_taglists(taglists, audio);
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
212 return av_codec_get_id(taglists, tag);
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
213 }
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
214
35864
9b88b87f5921 Fix mplayer compilation.
iive
parents: 35813
diff changeset
215 uint32_t mp_codec_id2tag(enum AVCodecID codec_id, uint32_t old_tag, int audio)
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
216 {
34636
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
217 const struct AVCodecTag *taglists[3];
35715
8517826b0dbd Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents: 35613
diff changeset
218 // For some formats (like PCM) always trust AV_CODEC_ID_* more than codec_tag
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
219 uint32_t tag = av_codec_get_tag(mp_codecid_override_taglists, codec_id);
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
220 if (tag)
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
221 return tag;
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
222
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
223 // mp4a tag is used for all mp4 files no matter what they actually contain
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
224 // mp4v is sometimes also used for files containing e.g. mjpeg
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
225 if (audio && old_tag != MKTAG('m', 'p', '4', 'a') ||
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
226 !audio && old_tag != MKTAG('m', 'p', '4', 'v'))
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
227 tag = old_tag;
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
228 if (tag)
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
229 return tag;
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
230
34636
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
231 get_taglists(taglists, audio);
fde1a35cf043 Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
reimar
parents: 34413
diff changeset
232 return av_codec_get_tag(taglists, codec_id);
34155
505b49b171f4 Change codec tag/id conversion to not use ff_codec_bmp_tags/ff_codec_wav_tags.
reimar
parents: 34097
diff changeset
233 }