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[]) {
17 // init the datatype we're using for ebml output
18 unsigned char data[8192];
27 Ebml_StartSubElement(&ebml, &startSegment, Segment); // segment
31 Ebml_StartSubElement(&ebml, &startInfo, Info);
32 Ebml_SerializeString(&ebml, 0x4D80, "muxingAppLibMkv");
33 Ebml_SerializeString(&ebml, 0x5741, "writingAppLibMkv");
34 Ebml_EndSubElement(&ebml, &startInfo);
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);
47 Ebml_StartSubElement(&ebml, &clusterStart, Cluster); // cluster
48 Ebml_SerializeUnsigned(&ebml, Timecode, 0);
50 unsigned char someData[4] = {1, 2, 3, 4};
51 writeSimpleBlock(&ebml, 1, 0, 1, 0, 0, someData, 4);
52 Ebml_EndSubElement(&ebml, &clusterStart);
54 Ebml_EndSubElement(&ebml, &startSegment);
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);