OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The WebM project authors. All Rights Reserved. | |
2 // | |
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 | |
5 // tree. An additional intellectual property rights grant can be found | |
6 // in the file PATENTS. All contributing project authors may | |
7 // be found in the AUTHORS file in the root of the source tree. | |
8 | |
9 | |
10 | |
11 #include "EbmlIDs.h" | |
12 #include "EbmlBufferWriter.h" | |
13 #include "WebMElement.h" | |
14 | |
15 #include <stdio.h> | |
16 int main(int argc, char *argv[]) { | |
17 // init the datatype we're using for ebml output | |
18 unsigned char data[8192]; | |
19 EbmlGlobal ebml; | |
20 ebml.buf = data; | |
21 ebml.offset = 0; | |
22 ebml.length = 8192; | |
23 | |
24 writeHeader(&ebml); | |
25 { | |
26 EbmlLoc startSegment; | |
27 Ebml_StartSubElement(&ebml, &startSegment, Segment); // segment | |
28 { | |
29 // segment info | |
30 EbmlLoc startInfo; | |
31 Ebml_StartSubElement(&ebml, &startInfo, Info); | |
32 Ebml_SerializeString(&ebml, 0x4D80, "muxingAppLibMkv"); | |
33 Ebml_SerializeString(&ebml, 0x5741, "writingAppLibMkv"); | |
34 Ebml_EndSubElement(&ebml, &startInfo); | |
35 } | |
36 | |
37 { | |
38 EbmlLoc trackStart; | |
39 Ebml_StartSubElement(&ebml, &trackStart, Tracks); | |
40 writeVideoTrack(&ebml, 1, 1, "V_MS/VFW/FOURCC", 320, 240, 29.97); | |
41 // writeAudioTrack(&ebml,2,1, "A_VORBIS", 32000, 1, NULL, 0); | |
42 Ebml_EndSubElement(&ebml, &trackStart); | |
43 } | |
44 | |
45 { | |
46 EbmlLoc clusterStart; | |
47 Ebml_StartSubElement(&ebml, &clusterStart, Cluster); // cluster | |
48 Ebml_SerializeUnsigned(&ebml, Timecode, 0); | |
49 | |
50 unsigned char someData[4] = {1, 2, 3, 4}; | |
51 writeSimpleBlock(&ebml, 1, 0, 1, 0, 0, someData, 4); | |
52 Ebml_EndSubElement(&ebml, &clusterStart); | |
53 } // end cluster | |
54 Ebml_EndSubElement(&ebml, &startSegment); | |
55 } | |
56 | |
57 // dump ebml stuff to the file | |
58 FILE *file_out = fopen("test.mkv", "wb"); | |
59 size_t bytesWritten = fwrite(data, 1, ebml.offset, file_out); | |
60 fclose(file_out); | |
61 return 0; | |
62 } | |
OLD | NEW |