annotate libmpdemux/ebml.c @ 35419:d86249ebbcca

Don't unconditionally reset Track, Chapter and Angle after playback. Only do so if they had been used (i.e. the current StreamType makes use of them).
author ib
date Thu, 29 Nov 2012 14:23:26 +0000
parents 9175a9a22051
children e626f90df47e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
1 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
2 * native ebml reader for the Matroska demuxer
29238
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
3 * copyright (c) 2004 Aurelien Jacobs <aurel@gnuage.org>
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
4 * based on the one written by Ronald Bultje for gstreamer
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
5 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
6 * This file is part of MPlayer.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
7 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
9 * it under the terms of the GNU General Public License as published by
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
11 * (at your option) any later version.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
12 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
16 * GNU General Public License for more details.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
17 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
18 * You should have received a copy of the GNU General Public License along
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 22605
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
21 */
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
22
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
23 #include "config.h"
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
24
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
25 #include <stdlib.h>
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
26
22605
4d81dbdf46b9 Add explicit location for headers from the stream/ directory.
diego
parents: 21507
diff changeset
27 #include "stream/stream.h"
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
28 #include "ebml.h"
21372
1767c271d710 Remove bswap.h, use libavutil/bswap.h instead.
diego
parents: 21344
diff changeset
29 #include "libavutil/common.h"
21507
fa99b3d31d13 Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents: 21388
diff changeset
30 #include "mpbswap.h"
21388
be5f168e42ae Use av_int2flt/av_int2dbl to read float values. This is simpler and more
reimar
parents: 21372
diff changeset
31 #include "libavutil/intfloat_readwrite.h"
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
32
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
33
18671
8fb542b97815 Protect SIZE_MAX use
rtogni
parents: 18558
diff changeset
34 #ifndef SIZE_MAX
8fb542b97815 Protect SIZE_MAX use
rtogni
parents: 18558
diff changeset
35 #define SIZE_MAX ((size_t)-1)
8fb542b97815 Protect SIZE_MAX use
rtogni
parents: 18558
diff changeset
36 #endif
8fb542b97815 Protect SIZE_MAX use
rtogni
parents: 18558
diff changeset
37
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
38 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
39 * Read: the element content data ID.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
40 * Return: the ID.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
41 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
42 uint32_t ebml_read_id(stream_t *s, int *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
43 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
44 int i, len_mask = 0x80;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
45 uint32_t id;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
46
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
47 for (i = 0, id = stream_read_char(s); i < 4 && !(id & len_mask); i++)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
48 len_mask >>= 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
49 if (i >= 4)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
50 return EBML_ID_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
51 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
52 *length = i + 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
53 while (i--)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
54 id = (id << 8) | stream_read_char(s);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
55 return id;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
56 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
57
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
58 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
59 * Read a variable length unsigned int.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
60 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
61 uint64_t ebml_read_vlen_uint(uint8_t *buffer, int *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
62 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
63 int i, j, num_ffs = 0, len_mask = 0x80;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
64 uint64_t num;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
65
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
66 for (i = 0, num = *buffer++; i < 8 && !(num & len_mask); i++)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
67 len_mask >>= 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
68 if (i >= 8)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
69 return EBML_UINT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
70 j = i + 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
71 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
72 *length = j;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
73 if ((int) (num &= (len_mask - 1)) == len_mask - 1)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
74 num_ffs++;
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
75 while (i--) {
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
76 num = (num << 8) | *buffer++;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
77 if ((num & 0xFF) == 0xFF)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
78 num_ffs++;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
79 }
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
80 if (j == num_ffs)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
81 return EBML_UINT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
82 return num;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
83 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
84
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
85 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
86 * Read a variable length signed int.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
87 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
88 int64_t ebml_read_vlen_int(uint8_t *buffer, int *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
89 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
90 uint64_t unum;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
91 int l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
92
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
93 /* read as unsigned number first */
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
94 unum = ebml_read_vlen_uint(buffer, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
95 if (unum == EBML_UINT_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
96 return EBML_INT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
97 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
98 *length = l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
99
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
100 return unum - ((1 << ((7 * l) - 1)) - 1);
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
101 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
102
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
103 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
104 * Read: element content length.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
105 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
106 uint64_t ebml_read_length(stream_t *s, int *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
107 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
108 int i, j, num_ffs = 0, len_mask = 0x80;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
109 uint64_t len;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
110
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
111 for (i = 0, len = stream_read_char(s); i < 8 && !(len & len_mask); i++)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
112 len_mask >>= 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
113 if (i >= 8)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
114 return EBML_UINT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
115 j = i + 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
116 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
117 *length = j;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
118 if ((int) (len &= (len_mask - 1)) == len_mask - 1)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
119 num_ffs++;
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
120 while (i--) {
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
121 len = (len << 8) | stream_read_char(s);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
122 if ((len & 0xFF) == 0xFF)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
123 num_ffs++;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
124 }
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
125 if (j == num_ffs)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
126 return EBML_UINT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
127 return len;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
128 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
129
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
130 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
131 * Read the next element as an unsigned int.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
132 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
133 uint64_t ebml_read_uint(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
134 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
135 uint64_t len, value = 0;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
136 int l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
137
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
138 len = ebml_read_length(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
139 if (len == EBML_UINT_INVALID || len < 1 || len > 8)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
140 return EBML_UINT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
141 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
142 *length = len + l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
143
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
144 while (len--)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
145 value = (value << 8) | stream_read_char(s);
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
146
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
147 return value;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
148 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
149
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
150 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
151 * Read the next element as a signed int.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
152 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
153 int64_t ebml_read_int(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
154 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
155 int64_t value = 0;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
156 uint64_t len;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
157 int l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
158
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
159 len = ebml_read_length(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
160 if (len == EBML_UINT_INVALID || len < 1 || len > 8)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
161 return EBML_INT_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
162 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
163 *length = len + l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
164
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
165 len--;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
166 l = stream_read_char(s);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
167 if (l & 0x80)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
168 value = -1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
169 value = (value << 8) | l;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
170 while (len--)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
171 value = (value << 8) | stream_read_char(s);
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
172
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
173 return value;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
174 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
175
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
176 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
177 * Read the next element as a float.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
178 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
179 long double ebml_read_float(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
180 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
181 long double value;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
182 uint64_t len;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
183 int l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
184
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
185 len = ebml_read_length(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
186 switch (len) {
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
187 case 4:
21388
be5f168e42ae Use av_int2flt/av_int2dbl to read float values. This is simpler and more
reimar
parents: 21372
diff changeset
188 value = av_int2flt(stream_read_dword(s));
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
189 break;
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
190
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
191 case 8:
21388
be5f168e42ae Use av_int2flt/av_int2dbl to read float values. This is simpler and more
reimar
parents: 21372
diff changeset
192 value = av_int2dbl(stream_read_qword(s));
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
193 break;
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
194
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
195 default:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
196 return EBML_FLOAT_INVALID;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
197 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
198
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
199 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
200 *length = len + l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
201
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
202 return value;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
203 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
204
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
205 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
206 * Read the next element as an ASCII string.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
207 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
208 char *ebml_read_ascii(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
209 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
210 uint64_t len;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
211 char *str;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
212 int l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
213
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
214 len = ebml_read_length(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
215 if (len == EBML_UINT_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
216 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
217 if (len > SIZE_MAX - 1)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
218 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
219 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
220 *length = len + l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
221
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
222 str = malloc(len + 1);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
223 if (stream_read(s, str, len) != (int) len) {
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
224 free(str);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
225 return NULL;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
226 }
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
227 str[len] = '\0';
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
228
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
229 return str;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
230 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
231
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
232 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
233 * Read the next element as a UTF-8 string.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
234 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
235 char *ebml_read_utf8(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
236 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
237 return ebml_read_ascii(s, length);
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
238 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
239
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
240 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
241 * Skip the next element.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
242 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
243 int ebml_read_skip(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
244 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
245 uint64_t len;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
246 int l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
247
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
248 len = ebml_read_length(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
249 if (len == EBML_UINT_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
250 return 1;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
251 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
252 *length = len + l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
253
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
254 stream_skip(s, len);
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
255
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
256 return 0;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
257 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
258
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
259 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
260 * Read the next element, but only the header. The contents
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
261 * are supposed to be sub-elements which can be read separately.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
262 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
263 uint32_t ebml_read_master(stream_t *s, uint64_t *length)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
264 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
265 uint64_t len;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
266 uint32_t id;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
267
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
268 id = ebml_read_id(s, NULL);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
269 if (id == EBML_ID_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
270 return id;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
271
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
272 len = ebml_read_length(s, NULL);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
273 if (len == EBML_UINT_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
274 return EBML_ID_INVALID;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
275 if (length)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
276 *length = len;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
277
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
278 return id;
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
279 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
280
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
281
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
282 /*
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
283 * Read an EBML header.
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
284 */
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
285 char *ebml_read_header(stream_t *s, int *version)
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
286 {
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
287 uint64_t length, l, num;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
288 uint32_t id;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
289 char *str = NULL;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
290
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
291 if (ebml_read_master(s, &length) != EBML_ID_HEADER)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
292 return 0;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
293
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
294 if (version)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
295 *version = 1;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
296
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
297 while (length > 0) {
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
298 id = ebml_read_id(s, NULL);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
299 if (id == EBML_ID_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
300 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
301 length -= 2;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
302
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
303 switch (id) {
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
304 /* is our read version uptodate? */
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
305 case EBML_ID_EBMLREADVERSION:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
306 num = ebml_read_uint(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
307 if (num != EBML_VERSION)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
308 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
309 break;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
310
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
311 /* we only handle 8 byte lengths at max */
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
312 case EBML_ID_EBMLMAXSIZELENGTH:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
313 num = ebml_read_uint(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
314 if (num != sizeof(uint64_t))
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
315 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
316 break;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
317
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
318 /* we handle 4 byte IDs at max */
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
319 case EBML_ID_EBMLMAXIDLENGTH:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
320 num = ebml_read_uint(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
321 if (num != sizeof(uint32_t))
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
322 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
323 break;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
324
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
325 case EBML_ID_DOCTYPE:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
326 str = ebml_read_ascii(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
327 if (str == NULL)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
328 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
329 break;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
330
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
331 case EBML_ID_DOCTYPEREADVERSION:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
332 num = ebml_read_uint(s, &l);
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
333 if (num == EBML_UINT_INVALID)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
334 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
335 if (version)
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
336 *version = num;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
337 break;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
338
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
339 /* we ignore these two, they don't tell us anything we care about */
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
340 case EBML_ID_VOID:
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
341 case EBML_ID_EBMLVERSION:
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
342 case EBML_ID_DOCTYPEVERSION:
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
343 default:
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
344 if (ebml_read_skip(s, &l))
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
345 return NULL;
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
346 break;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
347 }
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
348 length -= l;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
349 }
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
350
31177
9175a9a22051 cosmetics: Reformat in K&R coding style.
diego
parents: 30702
diff changeset
351 return str;
11807
9a81d7b4c0b6 Added the new C based Matroska demuxer by Aurelien Jacobs.
mosu
parents:
diff changeset
352 }