annotate Plugins/Input/aac/libmp4v2/mp4info.cpp @ 184:740c072f8e23 trunk

[svn] List sndfile extensions in the plugin configuration table.
author chainsaw
date Sun, 13 Nov 2005 14:27:07 -0800
parents fa848bd484d8
children 0a2ad94e8607
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 * The contents of this file are subject to the Mozilla Public
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 * License Version 1.1 (the "License"); you may not use this file
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 * except in compliance with the License. You may obtain a copy of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * the License at http://www.mozilla.org/MPL/
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 * Software distributed under the License is distributed on an "AS
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 * implied. See the License for the specific language governing
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 * rights and limitations under the License.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 * The Original Code is MPEG4IP.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 * The Initial Developer of the Original Code is Cisco Systems Inc.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15 * Portions created by Cisco Systems Inc. are
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 * Copyright (C) Cisco Systems Inc. 2001-2002. All Rights Reserved.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
17 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 * Portions created by Ximpo Group Ltd. are
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19 * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21 * Contributor(s):
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22 * Dave Mackie dmackie@cisco.com
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
23 * Bill May wmay@cisco.com
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
24 * Alix Marchandise-Franquet alix@cisco.com
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 * Ximpo Group Ltd. mp4v2@ximpo.com
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 #include "mp4common.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 static char* PrintAudioInfo(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 MP4FileHandle mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34 static const char* mpeg4AudioNames[] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 "MPEG-4 AAC main",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36 "MPEG-4 AAC LC",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 "MPEG-4 AAC SSR",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 "MPEG-4 AAC LTP",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 "MPEG-4 AAC HE",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40 "MPEG-4 AAC Scalable",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 "MPEG-4 TwinVQ",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 "MPEG-4 CELP",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43 "MPEG-4 HVXC",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44 NULL, NULL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45 "MPEG-4 TTSI",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 "MPEG-4 Main Synthetic",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47 "MPEG-4 Wavetable Syn",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48 "MPEG-4 General MIDI",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 "MPEG-4 Algo Syn and Audio FX",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 "MPEG-4 ER AAC LC",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 NULL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52 "MPEG-4 ER AAC LTP",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 "MPEG-4 ER AAC Scalable",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 "MPEG-4 ER TwinVQ",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 "MPEG-4 ER BSAC",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 "MPEG-4 ER ACC LD",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 "MPEG-4 ER CELP",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 "MPEG-4 ER HVXC",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 "MPEG-4 ER HILN",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 "MPEG-4 ER Parametric",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63 static const u_int8_t mpegAudioTypes[] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 MP4_MPEG2_AAC_MAIN_AUDIO_TYPE, // 0x66
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 MP4_MPEG2_AAC_LC_AUDIO_TYPE, // 0x67
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 MP4_MPEG2_AAC_SSR_AUDIO_TYPE, // 0x68
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 MP4_MPEG2_AUDIO_TYPE, // 0x69
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 MP4_MPEG1_AUDIO_TYPE, // 0x6B
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 // private types
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 MP4_VORBIS_AUDIO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 MP4_ALAW_AUDIO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 MP4_ULAW_AUDIO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 MP4_G723_AUDIO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77 static const char* mpegAudioNames[] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 "MPEG-2 AAC Main",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 "MPEG-2 AAC LC",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 "MPEG-2 AAC SSR",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81 "MPEG-2 Audio (13818-3)",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 "MPEG-1 Audio (11172-3)",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 // private types
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 "PCM16 (little endian)",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85 "Vorbis",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86 "G.711 aLaw",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
87 "G.711 uLaw",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88 "G.723.1",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89 "PCM16 (big endian)",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
90 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91 u_int8_t numMpegAudioTypes =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92 sizeof(mpegAudioTypes) / sizeof(u_int8_t);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94 const char* typeName = "Unknown";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 bool foundType = false;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96 u_int8_t type = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97 const char *media_data_name;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99 media_data_name = MP4GetTrackMediaDataName(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101 if (media_data_name == NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102 typeName = "Unknown - no media data name";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103 } else if (strcasecmp(media_data_name, "samr") == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104 typeName = "AMR";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 foundType = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106 } else if (strcasecmp(media_data_name, "sawb") == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
107 typeName = "AMR-WB";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 foundType = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
109 } else if (strcasecmp(media_data_name, "mp4a") == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
110
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
111 type = MP4GetTrackEsdsObjectTypeId(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
112
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113 switch (type) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
114 case MP4_MPEG4_AUDIO_TYPE: {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
115 u_int8_t* pAacConfig = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
116 u_int32_t aacConfigLength;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
117
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 MP4GetTrackESConfiguration(mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
119 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
120 &pAacConfig,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
121 &aacConfigLength);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 if (pAacConfig != NULL && aacConfigLength >= 2) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 type = (pAacConfig[0] >> 3) & 0x1f;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125 if (type == 0 || /* type == 5 || */ type == 10 || type == 11 ||
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126 type == 18 || type >= 28) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127 typeName = "MPEG-4 Unknown Profile";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129 typeName = mpeg4AudioNames[type - 1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 foundType = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 free(pAacConfig);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134 typeName = "MPEG-4 (no GAConfig)";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135 foundType = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139 // fall through
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 default:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141 for (u_int8_t i = 0; i < numMpegAudioTypes; i++) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142 if (type == mpegAudioTypes[i]) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 typeName = mpegAudioNames[i];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144 foundType = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 typeName = media_data_name;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 foundType = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154 u_int32_t timeScale =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155 MP4GetTrackTimeScale(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157 MP4Duration trackDuration =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158 MP4GetTrackDuration(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
159
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
160 double msDuration =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
161 (double) (MP4ConvertFromTrackDuration(mp4File, trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
162 trackDuration, MP4_MSECS_TIME_SCALE));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
163
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
164 u_int32_t avgBitRate =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
165 MP4GetTrackBitRate(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
166
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
167 char *sInfo = (char*)MP4Malloc(256);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
168
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
169 // type duration avgBitrate samplingFrequency
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
170 if (foundType)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
171 sprintf(sInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
172 "%u\taudio\t%s%s, %.3f secs, %u kbps, %u Hz\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
173 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
174 MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "enca - " : "",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
175 typeName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
176 msDuration / 1000.0,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
177 (avgBitRate + 500) / 1000,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
178 timeScale);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
179 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
180 sprintf(sInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
181 "%u\taudio\t%s%s(%u), %.3f secs, %u kbps, %u Hz\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
182 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
183 MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "enca - " : "",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
184 typeName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
185 type,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
186 msDuration / 1000.0,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
187 (avgBitRate + 500) / 1000,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
188 timeScale);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
189
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
190 return sInfo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
191 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
192 static const struct {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
193 uint8_t profile;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
194 const char *name;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
195 } VisualProfileToName[] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
196 { MPEG4_SP_L1, "MPEG-4 Simple @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
197 { MPEG4_SP_L2, "MPEG-4 Simple @ L2" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
198 { MPEG4_SP_L3, "MPEG-4 Simple @ L3" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
199 { MPEG4_SP_L0, "MPEG-4 Simple @ L0" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
200 { MPEG4_SSP_L1, "MPEG-4 Simple Scalable @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
201 { MPEG4_SSP_L2, "MPEG-4 Simple Scalable @ L2" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
202 { MPEG4_CP_L1, "MPEG-4 Core @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
203 { MPEG4_CP_L2, "MPEG-4 Core @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
204 { MPEG4_MP_L2, "MPEG-4 Main @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
205 { MPEG4_MP_L3, "MPEG-4 Main @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
206 { MPEG4_MP_L4, "MPEG-4 Main @ L4"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
207 { MPEG4_NBP_L2, "MPEG-4 N-bit @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
208 { MPEG4_STP_L1, "MPEG-4 Scalable Texture @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
209 { MPEG4_SFAP_L1, "MPEG-4 Simple Face Anim @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
210 { MPEG4_SFAP_L2, "MPEG-4 Simple Face Anim @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
211 { MPEG4_SFBAP_L1, "MPEG-4 Simple FBA @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
212 { MPEG4_SFBAP_L2, "MPEG-4 Simple FBA @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
213 { MPEG4_BATP_L1, "MPEG-4 Basic Anim Text @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
214 { MPEG4_BATP_L2, "MPEG-4 Basic Anim Text @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
215 { MPEG4_HP_L1, "MPEG-4 Hybrid @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
216 { MPEG4_HP_L2, "MPEG-4 Hybrid @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
217 { MPEG4_ARTSP_L1, "MPEG-4 Adv RT Simple @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
218 { MPEG4_ARTSP_L2, "MPEG-4 Adv RT Simple @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
219 { MPEG4_ARTSP_L3, "MPEG-4 Adv RT Simple @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
220 { MPEG4_ARTSP_L4, "MPEG-4 Adv RT Simple @ L4"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
221 { MPEG4_CSP_L1, "MPEG-4 Core Scalable @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
222 { MPEG4_CSP_L2, "MPEG-4 Core Scalable @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
223 { MPEG4_CSP_L3, "MPEG-4 Core Scalable @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
224 { MPEG4_ACEP_L1, "MPEG-4 Adv Coding Efficieny @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
225 { MPEG4_ACEP_L2, "MPEG-4 Adv Coding Efficieny @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
226 { MPEG4_ACEP_L3, "MPEG-4 Adv Coding Efficieny @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
227 { MPEG4_ACEP_L4, "MPEG-4 Adv Coding Efficieny @ L4"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
228 { MPEG4_ACP_L1, "MPEG-4 Adv Core Profile @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
229 { MPEG4_ACP_L2, "MPEG-4 Adv Core Profile @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
230 { MPEG4_AST_L1, "MPEG-4 Adv Scalable Texture @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
231 { MPEG4_AST_L2, "MPEG-4 Adv Scalable Texture @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
232 { MPEG4_AST_L3, "MPEG-4 Adv Scalable Texture @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
233 { MPEG4_S_STUDIO_P_L1, "MPEG-4 Simple Studio @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
234 { MPEG4_S_STUDIO_P_L2, "MPEG-4 Simple Studio @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
235 { MPEG4_S_STUDIO_P_L3, "MPEG-4 Simple Studio @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
236 { MPEG4_S_STUDIO_P_L4, "MPEG-4 Simple Studio @ L4"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
237 { MPEG4_C_STUDIO_P_L1, "MPEG-4 Core Studio @ L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
238 { MPEG4_C_STUDIO_P_L2, "MPEG-4 Core Studio @ L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
239 { MPEG4_C_STUDIO_P_L3, "MPEG-4 Core Studio @ L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
240 { MPEG4_C_STUDIO_P_L4, "MPEG-4 Core Studio @ L4"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
241 { MPEG4_ASP_L0, "MPEG-4 Adv Simple@L0"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
242 { MPEG4_ASP_L1, "MPEG-4 Adv Simple@L1"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
243 { MPEG4_ASP_L2, "MPEG-4 Adv Simple@L2"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
244 { MPEG4_ASP_L3, "MPEG-4 Adv Simple@L3"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
245 { MPEG4_ASP_L4, "MPEG-4 Adv Simple@L4"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
246 { MPEG4_ASP_L5, "MPEG-4 Adv Simple@L5"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
247 { MPEG4_ASP_L3B, "MPEG-4 Adv Simple@L3b"},
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
248 { MPEG4_FGSP_L0, "MPEG-4 FGS @ L0" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
249 { MPEG4_FGSP_L1, "MPEG-4 FGS @ L1" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
250 { MPEG4_FGSP_L2, "MPEG-4 FGS @ L2" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
251 { MPEG4_FGSP_L3, "MPEG-4 FGS @ L3" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
252 { MPEG4_FGSP_L4, "MPEG-4 FGS @ L4" },
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
253 { MPEG4_FGSP_L5, "MPEG-4 FGS @ L5" }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
254 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
255
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
256 static const char *Mpeg4VisualProfileName (uint8_t visual_profile)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
257 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
258 size_t size = sizeof(VisualProfileToName) / sizeof(*VisualProfileToName);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
259
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
260 for (size_t ix = 0; ix < size; ix++) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
261 if (visual_profile == VisualProfileToName[ix].profile) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
262 return (VisualProfileToName[ix].name);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
263 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
264 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
265 return (NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
266 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
267 static char* PrintVideoInfo(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
268 MP4FileHandle mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
269 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
270 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
271
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
272 static const u_int8_t mpegVideoTypes[] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
273 MP4_MPEG2_SIMPLE_VIDEO_TYPE, // 0x60
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
274 MP4_MPEG2_MAIN_VIDEO_TYPE, // 0x61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
275 MP4_MPEG2_SNR_VIDEO_TYPE, // 0x62
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
276 MP4_MPEG2_SPATIAL_VIDEO_TYPE, // 0x63
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
277 MP4_MPEG2_HIGH_VIDEO_TYPE, // 0x64
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
278 MP4_MPEG2_442_VIDEO_TYPE, // 0x65
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
279 MP4_MPEG1_VIDEO_TYPE, // 0x6A
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
280 MP4_JPEG_VIDEO_TYPE, // 0x6C
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
281 MP4_YUV12_VIDEO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
282 MP4_H263_VIDEO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
283 MP4_H261_VIDEO_TYPE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
284 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
285 static const char* mpegVideoNames[] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
286 "MPEG-2 Simple",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
287 "MPEG-2 Main",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
288 "MPEG-2 SNR",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
289 "MPEG-2 Spatial",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
290 "MPEG-2 High",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
291 "MPEG-2 4:2:2",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
292 "MPEG-1",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
293 "JPEG",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
294 "YUV12",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
295 "H.263",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
296 "H.261",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
297 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
298 u_int8_t numMpegVideoTypes =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
299 sizeof(mpegVideoTypes) / sizeof(u_int8_t);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
300 bool foundTypeName = false;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
301 const char* typeName = "Unknown";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
302
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
303 const char *media_data_name;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
304 uint8_t type = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
305
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
306 media_data_name = MP4GetTrackMediaDataName(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
307 char typebuffer[80];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
308 if (media_data_name == NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
309 typeName = "Unknown - no media data name";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
310 foundTypeName = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
311 } else if (strcasecmp(media_data_name, "avc1") == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
312 // avc
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
313 uint8_t profile, level;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
314 char profileb[20], levelb[20];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
315 if (MP4GetTrackH264ProfileLevel(mp4File, trackId, &profile, &level)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
316 if (profile == 66) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
317 strcpy(profileb, "Baseline");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
318 } else if (profile == 77) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
319 strcpy(profileb, "Main");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
320 } else if (profile == 88) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
321 strcpy(profileb, "Extended");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
322 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
323 sprintf(profileb, "Unknown Profile %x", profile);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
324 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
325 switch (level) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
326 case 10: case 20: case 30: case 40: case 50:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
327 sprintf(levelb, "%u", level / 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
328 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
329 case 11: case 12: case 13:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
330 case 21: case 22:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
331 case 31: case 32:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
332 case 41: case 42:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
333 case 51:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
334 sprintf(levelb, "%u.%u", level / 10, level % 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
335 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
336 default:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
337 sprintf(levelb, "unknown level %x", level);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
338 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
339 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
340 sprintf(typebuffer, "H264 %s@%s", profileb, levelb);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
341 typeName = typebuffer;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
342 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
343 typeName = "H.264 - profile/level error";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
344 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
345 foundTypeName = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
346 } else if (strcasecmp(media_data_name, "s263") == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
347 // 3gp h.263
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
348 typeName = "H.263";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
349 foundTypeName = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
350 } else if ((strcasecmp(media_data_name, "mp4v") == 0) ||
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
351 (strcasecmp(media_data_name, "encv") == 0)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
352 // note encv might needs it's own field eventually.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
353 type = MP4GetTrackEsdsObjectTypeId(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
354 if (type == MP4_MPEG4_VIDEO_TYPE) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
355 type = MP4GetVideoProfileLevel(mp4File);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
356 typeName = Mpeg4VisualProfileName(type);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
357 if (typeName == NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
358 typeName = "MPEG-4 Unknown Profile";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
359 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
360 foundTypeName = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
361 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
362 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
363 for (u_int8_t i = 0; i < numMpegVideoTypes; i++) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
364 if (type == mpegVideoTypes[i]) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
365 typeName = mpegVideoNames[i];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
366 foundTypeName = true;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
367 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
368 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
369 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
370 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
371 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
372 typeName = media_data_name;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
373 foundTypeName = true; // we don't have a type value to display
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
374 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
375
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
376 MP4Duration trackDuration =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
377 MP4GetTrackDuration(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
378
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
379 double msDuration =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
380 (double) (MP4ConvertFromTrackDuration(mp4File, trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
381 trackDuration, MP4_MSECS_TIME_SCALE));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
382
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
383 u_int32_t avgBitRate =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
384 MP4GetTrackBitRate(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
385
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
386 // Note not all mp4 implementations set width and height correctly
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
387 // The real answer can be buried inside the ES configuration info
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
388 u_int16_t width = MP4GetTrackVideoWidth(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
389
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
390 u_int16_t height = MP4GetTrackVideoHeight(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
391
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
392 double fps = MP4GetTrackVideoFrameRate(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
393
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
394 char *sInfo = (char*)MP4Malloc(256);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
395
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
396 // type duration avgBitrate frameSize frameRate
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
397 if (foundTypeName) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
398 sprintf(sInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
399 "%u\tvideo\t%s%s, %.3f secs, %u kbps, %ux%u @ %f fps\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
400 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
401 MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "encv - " : "",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
402 typeName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
403 msDuration / 1000.0,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
404 (avgBitRate + 500) / 1000,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
405 width,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
406 height,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
407 fps
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
408 );
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
409 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
410 sprintf(sInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
411 "%u\tvideo\t%s(%u), %.3f secs, %u kbps, %ux%u @ %f fps\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
412 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
413 typeName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
414 type,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
415 msDuration / 1000.0,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
416 (avgBitRate + 500) / 1000,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
417 width,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
418 height,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
419 fps
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
420 );
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
421 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
422
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
423 return sInfo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
424 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
425 static char* PrintCntlInfo(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
426 MP4FileHandle mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
427 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
428 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
429 const char *media_data_name = MP4GetTrackMediaDataName(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
430 const char *typeName = "Unknown";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
431
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
432 if (media_data_name == NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
433 typeName = "Unknown - no media data name";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
434 } else if (strcasecmp(media_data_name, "href") == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
435 typeName = "ISMA Href";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
436 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
437 typeName = media_data_name;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
438 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
439
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
440 MP4Duration trackDuration =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
441 MP4GetTrackDuration(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
442
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
443 double msDuration =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
444 (double) (MP4ConvertFromTrackDuration(mp4File, trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
445 trackDuration, MP4_MSECS_TIME_SCALE));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
446 char *sInfo = (char *)MP4Malloc(256);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
447
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
448 snprintf(sInfo, 256,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
449 "%u\tcontrol\t%s, %.3f secs\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
450 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
451 typeName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
452 msDuration / 1000.0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
453 return sInfo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
454 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
455
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
456
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
457 static char* PrintHintInfo(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
458 MP4FileHandle mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
459 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
460 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
461 MP4TrackId referenceTrackId =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
462 MP4GetHintTrackReferenceTrackId(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
463
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
464 char* payloadName = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
465 MP4GetHintTrackRtpPayload(mp4File, trackId, &payloadName);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
466
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
467 char *sInfo = (char*)MP4Malloc(256);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
468
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
469 sprintf(sInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
470 "%u\thint\tPayload %s for track %u\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
471 trackId,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
472 payloadName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
473 referenceTrackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
474
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
475 free(payloadName);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
476
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
477 return sInfo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
478 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
479
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
480 static char* PrintTrackInfo(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
481 MP4FileHandle mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
482 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
483 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
484 char* trackInfo = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
485
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
486 const char* trackType =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
487 MP4GetTrackType(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
488
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
489 if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
490 trackInfo = PrintAudioInfo(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
491 } else if (!strcmp(trackType, MP4_VIDEO_TRACK_TYPE)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
492 trackInfo = PrintVideoInfo(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
493 } else if (!strcmp(trackType, MP4_HINT_TRACK_TYPE)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
494 trackInfo = PrintHintInfo(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
495 } else if (strcmp(trackType, MP4_CNTL_TRACK_TYPE) == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
496 trackInfo = PrintCntlInfo(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
497 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
498 trackInfo = (char*)MP4Malloc(256);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
499 if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
500 sprintf(trackInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
501 "%u\tod\tObject Descriptors\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
502 trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
503 } else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
504 sprintf(trackInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
505 "%u\tscene\tBIFS\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
506 trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
507 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
508 sprintf(trackInfo,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
509 "%u\t%s\n",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
510 trackId, trackType);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
511 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
512 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
513
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
514 return trackInfo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
515 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
516
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
517 extern "C" char* MP4Info(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
518 MP4FileHandle mp4File,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
519 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
520 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
521 char* info = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
522
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
523 if (MP4_IS_VALID_FILE_HANDLE(mp4File)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
524 try {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
525 if (trackId == MP4_INVALID_TRACK_ID) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
526 info = (char*)MP4Calloc(4*1024);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
527
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
528 sprintf(info, "Track\tType\tInfo\n");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
529
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
530 u_int32_t numTracks = MP4GetNumberOfTracks(mp4File);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
531
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
532 for (u_int32_t i = 0; i < numTracks; i++) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
533 trackId = MP4FindTrackId(mp4File, i);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
534 char* trackInfo = PrintTrackInfo(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
535 strcat(info, trackInfo);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
536 MP4Free(trackInfo);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
537 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
538 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
539 info = PrintTrackInfo(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
540 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
541 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
542 catch (MP4Error* e) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
543 delete e;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
544 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
545 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
546
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
547 return info;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
548 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
549
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
550 extern "C" char* MP4FileInfo(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
551 const char* fileName,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
552 MP4TrackId trackId)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
553 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
554 MP4FileHandle mp4File =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
555 MP4Read(fileName);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
556
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
557 if (!mp4File) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
558 return NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
559 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
560
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
561 char* info = MP4Info(mp4File, trackId);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
562
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
563 MP4Close(mp4File);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
564
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
565 return info; // caller should free this
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
566 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
567