1 // Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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.
12 #include "EbmlBufferWriter.h"
13 #include "WebMElement.h"
16 int main(int argc, char *argv[])
18 //init the datatype we're using for ebml output
19 unsigned char data[8192];
28 Ebml_StartSubElement(&ebml, &startSegment, Segment); //segment
32 Ebml_StartSubElement(&ebml, &startInfo, Info);
33 Ebml_SerializeString(&ebml, 0x4D80, "muxingAppLibMkv");
34 Ebml_SerializeString(&ebml, 0x5741, "writingAppLibMkv");
35 Ebml_EndSubElement(&ebml, &startInfo);
40 Ebml_StartSubElement(&ebml, &trackStart, Tracks);
41 writeVideoTrack(&ebml, 1, 1, "V_MS/VFW/FOURCC", 320, 240, 29.97);
42 //writeAudioTrack(&ebml,2,1, "A_VORBIS", 32000, 1, NULL, 0);
43 Ebml_EndSubElement(&ebml, &trackStart);
48 Ebml_StartSubElement(&ebml, &clusterStart, Cluster); //cluster
49 Ebml_SerializeUnsigned(&ebml, Timecode, 0);
51 unsigned char someData[4] = {1, 2, 3, 4};
52 writeSimpleBlock(&ebml, 1, 0, 1, 0, 0, someData, 4);
53 Ebml_EndSubElement(&ebml, &clusterStart);
55 Ebml_EndSubElement(&ebml, &startSegment);
58 //dump ebml stuff to the file
59 FILE *file_out = fopen("test.mkv", "wb");
60 size_t bytesWritten = fwrite(data, 1, ebml.offset, file_out);