OLD | NEW |
1 // Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 1 // Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the LICENSE file in the root of the source | 4 // that can be found in the LICENSE file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 | 9 |
10 #include "EbmlBufferWriter.h" | 10 #include "EbmlBufferWriter.h" |
11 #include "EbmlIDs.h" | 11 #include "EbmlIDs.h" |
12 #include "WebMElement.h" | 12 #include "WebMElement.h" |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 | 14 |
15 #define kVorbisPrivateMaxSize 4000 | 15 #define kVorbisPrivateMaxSize 4000 |
16 | 16 |
17 void writeHeader(EbmlGlobal *glob) | 17 void writeHeader(EbmlGlobal *glob) { |
18 { | 18 EbmlLoc start; |
19 EbmlLoc start; | 19 Ebml_StartSubElement(glob, &start, EBML); |
20 Ebml_StartSubElement(glob, &start, EBML); | 20 Ebml_SerializeUnsigned(glob, EBMLVersion, 1); |
21 Ebml_SerializeUnsigned(glob, EBMLVersion, 1); | 21 Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1); // EBML Read Version |
22 Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1); //EBML Read Version | 22 Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4); // EBML Max ID Length |
23 Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4); //EBML Max ID Length | 23 Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8); // EBML Max Size Length |
24 Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8); //EBML Max Size Length | 24 Ebml_SerializeString(glob, DocType, "webm"); // Doc Type |
25 Ebml_SerializeString(glob, DocType, "webm"); //Doc Type | 25 Ebml_SerializeUnsigned(glob, DocTypeVersion, 2); // Doc Type Version |
26 Ebml_SerializeUnsigned(glob, DocTypeVersion, 2); //Doc Type Version | 26 Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2); // Doc Type Read Version |
27 Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2); //Doc Type Read Version | 27 Ebml_EndSubElement(glob, &start); |
28 Ebml_EndSubElement(glob, &start); | |
29 } | 28 } |
30 | 29 |
31 void writeSimpleBlock(EbmlGlobal *glob, unsigned char trackNumber, short timeCod
e, | 30 void writeSimpleBlock(EbmlGlobal *glob, unsigned char trackNumber, short timeCod
e, |
32 int isKeyframe, unsigned char lacingFlag, int discardable, | 31 int isKeyframe, unsigned char lacingFlag, int discardable, |
33 unsigned char *data, unsigned long dataLength) | 32 unsigned char *data, unsigned long dataLength) { |
34 { | 33 Ebml_WriteID(glob, SimpleBlock); |
35 Ebml_WriteID(glob, SimpleBlock); | 34 unsigned long blockLength = 4 + dataLength; |
36 unsigned long blockLength = 4 + dataLength; | 35 blockLength |= 0x10000000; // TODO check length < 0x0FFFFFFFF |
37 blockLength |= 0x10000000; //TODO check length < 0x0FFFFFFFF | 36 Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4); |
38 Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4); | 37 trackNumber |= 0x80; // TODO check track nubmer < 128 |
39 trackNumber |= 0x80; //TODO check track nubmer < 128 | 38 Ebml_Write(glob, &trackNumber, 1); |
40 Ebml_Write(glob, &trackNumber, 1); | 39 // Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes |
41 //Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes | 40 Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2); |
42 Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2); | 41 unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) |
discardable; |
43 unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1)
| discardable; | 42 Ebml_Write(glob, &flags, 1); |
44 Ebml_Write(glob, &flags, 1); | 43 Ebml_Write(glob, data, dataLength); |
45 Ebml_Write(glob, data, dataLength); | |
46 } | 44 } |
47 | 45 |
48 static UInt64 generateTrackID(unsigned int trackNumber) | 46 static UInt64 generateTrackID(unsigned int trackNumber) { |
49 { | 47 UInt64 t = time(NULL) * trackNumber; |
50 UInt64 t = time(NULL) * trackNumber; | 48 UInt64 r = rand(); |
51 UInt64 r = rand(); | 49 r = r << 32; |
52 r = r << 32; | 50 r += rand(); |
53 r += rand(); | 51 UInt64 rval = t ^ r; |
54 UInt64 rval = t ^ r; | 52 return rval; |
55 return rval; | |
56 } | 53 } |
57 | 54 |
58 void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, | 55 void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, |
59 char *codecId, unsigned int pixelWidth, unsigned int pixelH
eight, | 56 char *codecId, unsigned int pixelWidth, unsigned int pixelH
eight, |
60 double frameRate) | 57 double frameRate) { |
61 { | 58 EbmlLoc start; |
62 EbmlLoc start; | 59 Ebml_StartSubElement(glob, &start, TrackEntry); |
63 Ebml_StartSubElement(glob, &start, TrackEntry); | 60 Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); |
64 Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); | 61 UInt64 trackID = generateTrackID(trackNumber); |
65 UInt64 trackID = generateTrackID(trackNumber); | 62 Ebml_SerializeUnsigned(glob, TrackUID, trackID); |
66 Ebml_SerializeUnsigned(glob, TrackUID, trackID); | 63 Ebml_SerializeString(glob, CodecName, "VP8"); // TODO shouldn't be fixed |
67 Ebml_SerializeString(glob, CodecName, "VP8"); //TODO shouldn't be fixed | |
68 | 64 |
69 Ebml_SerializeUnsigned(glob, TrackType, 1); //video is always 1 | 65 Ebml_SerializeUnsigned(glob, TrackType, 1); // video is always 1 |
70 Ebml_SerializeString(glob, CodecID, codecId); | 66 Ebml_SerializeString(glob, CodecID, codecId); |
71 { | 67 { |
72 EbmlLoc videoStart; | 68 EbmlLoc videoStart; |
73 Ebml_StartSubElement(glob, &videoStart, Video); | 69 Ebml_StartSubElement(glob, &videoStart, Video); |
74 Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth); | 70 Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth); |
75 Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight); | 71 Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight); |
76 Ebml_SerializeFloat(glob, FrameRate, frameRate); | 72 Ebml_SerializeFloat(glob, FrameRate, frameRate); |
77 Ebml_EndSubElement(glob, &videoStart); //Video | 73 Ebml_EndSubElement(glob, &videoStart); // Video |
78 } | 74 } |
79 Ebml_EndSubElement(glob, &start); //Track Entry | 75 Ebml_EndSubElement(glob, &start); // Track Entry |
80 } | 76 } |
81 void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, | 77 void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, |
82 char *codecId, double samplingFrequency, unsigned int chann
els, | 78 char *codecId, double samplingFrequency, unsigned int chann
els, |
83 unsigned char *private, unsigned long privateSize) | 79 unsigned char *private, unsigned long privateSize) { |
84 { | 80 EbmlLoc start; |
85 EbmlLoc start; | 81 Ebml_StartSubElement(glob, &start, TrackEntry); |
86 Ebml_StartSubElement(glob, &start, TrackEntry); | 82 Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); |
87 Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); | 83 UInt64 trackID = generateTrackID(trackNumber); |
88 UInt64 trackID = generateTrackID(trackNumber); | 84 Ebml_SerializeUnsigned(glob, TrackUID, trackID); |
89 Ebml_SerializeUnsigned(glob, TrackUID, trackID); | 85 Ebml_SerializeUnsigned(glob, TrackType, 2); // audio is always 2 |
90 Ebml_SerializeUnsigned(glob, TrackType, 2); //audio is always 2 | 86 // I am using defaults for thesed required fields |
91 //I am using defaults for thesed required fields | 87 /* Ebml_SerializeUnsigned(glob, FlagEnabled, 1); |
92 /* Ebml_SerializeUnsigned(glob, FlagEnabled, 1); | 88 Ebml_SerializeUnsigned(glob, FlagDefault, 1); |
93 Ebml_SerializeUnsigned(glob, FlagDefault, 1); | 89 Ebml_SerializeUnsigned(glob, FlagForced, 1); |
94 Ebml_SerializeUnsigned(glob, FlagForced, 1); | 90 Ebml_SerializeUnsigned(glob, FlagLacing, flagLacing);*/ |
95 Ebml_SerializeUnsigned(glob, FlagLacing, flagLacing);*/ | 91 Ebml_SerializeString(glob, CodecID, codecId); |
96 Ebml_SerializeString(glob, CodecID, codecId); | 92 Ebml_SerializeData(glob, CodecPrivate, private, privateSize); |
97 Ebml_SerializeData(glob, CodecPrivate, private, privateSize); | |
98 | 93 |
99 Ebml_SerializeString(glob, CodecName, "VORBIS"); //fixed for now | 94 Ebml_SerializeString(glob, CodecName, "VORBIS"); // fixed for now |
100 { | 95 { |
101 EbmlLoc AudioStart; | 96 EbmlLoc AudioStart; |
102 Ebml_StartSubElement(glob, &AudioStart, Audio); | 97 Ebml_StartSubElement(glob, &AudioStart, Audio); |
103 Ebml_SerializeFloat(glob, SamplingFrequency, samplingFrequency); | 98 Ebml_SerializeFloat(glob, SamplingFrequency, samplingFrequency); |
104 Ebml_SerializeUnsigned(glob, Channels, channels); | 99 Ebml_SerializeUnsigned(glob, Channels, channels); |
105 Ebml_EndSubElement(glob, &AudioStart); | 100 Ebml_EndSubElement(glob, &AudioStart); |
106 } | 101 } |
107 Ebml_EndSubElement(glob, &start); | 102 Ebml_EndSubElement(glob, &start); |
108 } | 103 } |
109 void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc* startInfo, unsigned long
timeCodeScale, double duration) | 104 void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long
timeCodeScale, double duration) { |
110 { | 105 Ebml_StartSubElement(ebml, startInfo, Info); |
111 Ebml_StartSubElement(ebml, startInfo, Info); | 106 Ebml_SerializeUnsigned(ebml, TimecodeScale, timeCodeScale); |
112 Ebml_SerializeUnsigned(ebml, TimecodeScale, timeCodeScale); | 107 Ebml_SerializeFloat(ebml, Segment_Duration, duration * 1000.0); // Currently f
ixed to using milliseconds |
113 Ebml_SerializeFloat(ebml, Segment_Duration, duration * 1000.0); //Currently
fixed to using milliseconds | 108 Ebml_SerializeString(ebml, 0x4D80, "QTmuxingAppLibWebM-0.0.1"); |
114 Ebml_SerializeString(ebml, 0x4D80, "QTmuxingAppLibWebM-0.0.1"); | 109 Ebml_SerializeString(ebml, 0x5741, "QTwritingAppLibWebM-0.0.1"); |
115 Ebml_SerializeString(ebml, 0x5741, "QTwritingAppLibWebM-0.0.1"); | 110 Ebml_EndSubElement(ebml, startInfo); |
116 Ebml_EndSubElement(ebml, startInfo); | |
117 } | 111 } |
118 | 112 |
119 /* | 113 /* |
120 void Mkv_InitializeSegment(Ebml& ebml_out, EbmlLoc& ebmlLoc) | 114 void Mkv_InitializeSegment(Ebml& ebml_out, EbmlLoc& ebmlLoc) |
121 { | 115 { |
122 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x18538067); | 116 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x18538067); |
123 } | 117 } |
124 | 118 |
125 void Mkv_InitializeSeek(Ebml& ebml_out, EbmlLoc& ebmlLoc) | 119 void Mkv_InitializeSeek(Ebml& ebml_out, EbmlLoc& ebmlLoc) |
126 { | 120 { |
127 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x114d9b74); | 121 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x114d9b74); |
128 } | 122 } |
129 void Mkv_WriteSeekInformation(Ebml& ebml_out, SeekStruct& seekInformation) | 123 void Mkv_WriteSeekInformation(Ebml& ebml_out, SeekStruct& seekInformation) |
130 { | 124 { |
131 EbmlLoc ebmlLoc; | 125 EbmlLoc ebmlLoc; |
132 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x4dbb); | 126 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x4dbb); |
133 Ebml_SerializeString(ebml_out, 0x53ab, seekInformation.SeekID); | 127 Ebml_SerializeString(ebml_out, 0x53ab, seekInformation.SeekID); |
134 Ebml_SerializeUnsigned(ebml_out, 0x53ac, seekInformation.SeekPosition); | 128 Ebml_SerializeUnsigned(ebml_out, 0x53ac, seekInformation.SeekPosition); |
135 Ebml_EndSubElement(ebml_out, ebmlLoc); | 129 Ebml_EndSubElement(ebml_out, ebmlLoc); |
136 } | 130 } |
137 | 131 |
138 void Mkv_WriteSegmentInformation(Ebml& ebml_out, SegmentInformationStruct& segme
ntInformation) | 132 void Mkv_WriteSegmentInformation(Ebml& ebml_out, SegmentInformationStruct& segme
ntInformation) |
139 { | 133 { |
140 Ebml_SerializeUnsigned(ebml_out, 0x73a4, segmentInformation.segmentUID); | 134 Ebml_SerializeUnsigned(ebml_out, 0x73a4, segmentInformation.segmentUID); |
141 if (segmentInformation.filename != 0) | 135 if (segmentInformation.filename != 0) |
142 Ebml_SerializeString(ebml_out, 0x7384, segmentInformation.filename); | 136 Ebml_SerializeString(ebml_out, 0x7384, segmentInformation.filename); |
143 Ebml_SerializeUnsigned(ebml_out, 0x2AD7B1, segmentInformation.TimecodeScale)
; | 137 Ebml_SerializeUnsigned(ebml_out, 0x2AD7B1, segmentInformation.TimecodeScale)
; |
144 Ebml_SerializeUnsigned(ebml_out, 0x4489, segmentInformation.Duration); | 138 Ebml_SerializeUnsigned(ebml_out, 0x4489, segmentInformation.Duration); |
145 //TODO date | 139 // TODO date |
146 Ebml_SerializeWString(ebml_out, 0x4D80, L"MKVMUX"); | 140 Ebml_SerializeWString(ebml_out, 0x4D80, L"MKVMUX"); |
147 Ebml_SerializeWString(ebml_out, 0x5741, segmentInformation.WritingApp); | 141 Ebml_SerializeWString(ebml_out, 0x5741, segmentInformation.WritingApp); |
148 } | 142 } |
149 | 143 |
150 void Mkv_InitializeTrack(Ebml& ebml_out, EbmlLoc& ebmlLoc) | 144 void Mkv_InitializeTrack(Ebml& ebml_out, EbmlLoc& ebmlLoc) |
151 { | 145 { |
152 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1654AE6B); | 146 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1654AE6B); |
153 } | 147 } |
154 | 148 |
155 static void Mkv_WriteGenericTrackData(Ebml& ebml_out, TrackStruct& track) | 149 static void Mkv_WriteGenericTrackData(Ebml& ebml_out, TrackStruct& track) |
(...skipping 10 matching lines...) Expand all Loading... |
166 Ebml_SerializeString(ebml_out, 0x86, track.CodecID); | 160 Ebml_SerializeString(ebml_out, 0x86, track.CodecID); |
167 if (track.CodecPrivate != 0) | 161 if (track.CodecPrivate != 0) |
168 Ebml_SerializeData(ebml_out, 0x63A2, track.CodecPrivate, track.CodecPriv
ateLength); | 162 Ebml_SerializeData(ebml_out, 0x63A2, track.CodecPrivate, track.CodecPriv
ateLength); |
169 if (track.CodecName != 0) | 163 if (track.CodecName != 0) |
170 Ebml_SerializeWString(ebml_out, 0x258688, track.CodecName); | 164 Ebml_SerializeWString(ebml_out, 0x258688, track.CodecName); |
171 } | 165 } |
172 | 166 |
173 void Mkv_WriteVideoTrack(Ebml& ebml_out, TrackStruct & track, VideoTrackStruct&
video) | 167 void Mkv_WriteVideoTrack(Ebml& ebml_out, TrackStruct & track, VideoTrackStruct&
video) |
174 { | 168 { |
175 EbmlLoc trackHeadLoc, videoHeadLoc; | 169 EbmlLoc trackHeadLoc, videoHeadLoc; |
176 Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); //start Track | 170 Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); // start Track |
177 Mkv_WriteGenericTrackData(ebml_out, track); | 171 Mkv_WriteGenericTrackData(ebml_out, track); |
178 Ebml_StartSubElement(ebml_out, videoHeadLoc, 0xE0); //start Video | 172 Ebml_StartSubElement(ebml_out, videoHeadLoc, 0xE0); // start Video |
179 Ebml_SerializeUnsigned(ebml_out, 0x9A, video.FlagInterlaced ? 1 :0); | 173 Ebml_SerializeUnsigned(ebml_out, 0x9A, video.FlagInterlaced ? 1 :0); |
180 Ebml_SerializeUnsigned(ebml_out, 0xB0, video.PixelWidth); | 174 Ebml_SerializeUnsigned(ebml_out, 0xB0, video.PixelWidth); |
181 Ebml_SerializeUnsigned(ebml_out, 0xBA, video.PixelHeight); | 175 Ebml_SerializeUnsigned(ebml_out, 0xBA, video.PixelHeight); |
182 Ebml_SerializeUnsigned(ebml_out, 0x54B0, video.PixelDisplayWidth); | 176 Ebml_SerializeUnsigned(ebml_out, 0x54B0, video.PixelDisplayWidth); |
183 Ebml_SerializeUnsigned(ebml_out, 0x54BA, video.PixelDisplayHeight); | 177 Ebml_SerializeUnsigned(ebml_out, 0x54BA, video.PixelDisplayHeight); |
184 Ebml_SerializeUnsigned(ebml_out, 0x54B2, video.displayUnit); | 178 Ebml_SerializeUnsigned(ebml_out, 0x54B2, video.displayUnit); |
185 Ebml_SerializeFloat(ebml_out, 0x2383E3, video.FrameRate); | 179 Ebml_SerializeFloat(ebml_out, 0x2383E3, video.FrameRate); |
186 Ebml_EndSubElement(ebml_out, videoHeadLoc); | 180 Ebml_EndSubElement(ebml_out, videoHeadLoc); |
187 Ebml_EndSubElement(ebml_out, trackHeadLoc); | 181 Ebml_EndSubElement(ebml_out, trackHeadLoc); |
188 | 182 |
189 } | 183 } |
190 | 184 |
191 void Mkv_WriteAudioTrack(Ebml& ebml_out, TrackStruct & track, AudioTrackStruct&
video) | 185 void Mkv_WriteAudioTrack(Ebml& ebml_out, TrackStruct & track, AudioTrackStruct&
video) |
192 { | 186 { |
193 EbmlLoc trackHeadLoc, audioHeadLoc; | 187 EbmlLoc trackHeadLoc, audioHeadLoc; |
194 Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); | 188 Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); |
195 Mkv_WriteGenericTrackData(ebml_out, track); | 189 Mkv_WriteGenericTrackData(ebml_out, track); |
196 Ebml_StartSubElement(ebml_out, audioHeadLoc, 0xE0); //start Audio | 190 Ebml_StartSubElement(ebml_out, audioHeadLoc, 0xE0); // start Audio |
197 Ebml_SerializeFloat(ebml_out, 0xB5, video.SamplingFrequency); | 191 Ebml_SerializeFloat(ebml_out, 0xB5, video.SamplingFrequency); |
198 Ebml_SerializeUnsigned(ebml_out, 0x9F, video.Channels); | 192 Ebml_SerializeUnsigned(ebml_out, 0x9F, video.Channels); |
199 Ebml_SerializeUnsigned(ebml_out, 0x6264, video.BitDepth); | 193 Ebml_SerializeUnsigned(ebml_out, 0x6264, video.BitDepth); |
200 Ebml_EndSubElement(ebml_out, audioHeadLoc); // end audio | 194 Ebml_EndSubElement(ebml_out, audioHeadLoc); // end audio |
201 Ebml_EndSubElement(ebml_out, trackHeadLoc); | 195 Ebml_EndSubElement(ebml_out, trackHeadLoc); |
202 } | 196 } |
203 | 197 |
204 void Mkv_WriteEbmlClusterHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, ClusterHeadStru
ct & clusterHead) | 198 void Mkv_WriteEbmlClusterHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, ClusterHeadStru
ct & clusterHead) |
205 { | 199 { |
206 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1F43B675); | 200 Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1F43B675); |
207 Ebml_SerializeUnsigned(ebml_out, 0x6264, clusterHead.TimeCode); | 201 Ebml_SerializeUnsigned(ebml_out, 0x6264, clusterHead.TimeCode); |
208 } | 202 } |
209 | 203 |
210 void Mkv_WriteSimpleBlockHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, SimpleBlockStru
ct& block) | 204 void Mkv_WriteSimpleBlockHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, SimpleBlockStru
ct& block) |
211 { | 205 { |
212 Ebml_StartSubElement(ebml_out, ebmlLoc, 0xA3); | 206 Ebml_StartSubElement(ebml_out, ebmlLoc, 0xA3); |
213 Ebml_Write1UInt(ebml_out, block.TrackNumber); | 207 Ebml_Write1UInt(ebml_out, block.TrackNumber); |
214 Ebml_WriteSigned16(ebml_out,block.TimeCode); | 208 Ebml_WriteSigned16(ebml_out,block.TimeCode); |
215 unsigned char flags = 0x00 | (block.iskey ? 0x80:0x00) | (block.lacing << 1)
| block.discardable; | 209 unsigned char flags = 0x00 | (block.iskey ? 0x80:0x00) | (block.lacing << 1)
| block.discardable; |
216 Ebml_Write1UInt(ebml_out, flags); //TODO this may be the wrong function | 210 Ebml_Write1UInt(ebml_out, flags); // TODO this may be the wrong function |
217 Ebml_Serialize(ebml_out, block.data, block.dataLength); | 211 Ebml_Serialize(ebml_out, block.data, block.dataLength); |
218 Ebml_EndSubElement(ebml_out,ebmlLoc); | 212 Ebml_EndSubElement(ebml_out,ebmlLoc); |
219 } | 213 } |
220 */ | 214 */ |
OLD | NEW |