Handle AspectRatioType video element.
[libmkv.git] / src / ebml.h
blob624384cf9a20fc61beb419b8f88c7c2ef64ce1c7
1 /*****************************************************************************
2 * ebml.h:
3 *****************************************************************************
4 * Copyright (C) 2005 x264 project
5 * $Id: $
7 * Authors: Mike Matsnev
8 * Nathan Caldwell
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
24 #ifndef _EBML_H
25 #define _EBML_H 1
27 /* Copied from ffmpeg */
28 /* EBML version supported */
29 #define EBML_VERSION 1
31 /* top-level master-IDs */
32 #define EBML_ID_HEADER 0x1A45DFA3 /* sub-elements */
34 /* IDs in the HEADER master */
35 #define EBML_ID_EBMLVERSION 0x4286 /* u-integer */
36 #define EBML_ID_EBMLREADVERSION 0x42F7 /* u-integer */
37 #define EBML_ID_EBMLMAXIDLENGTH 0x42F2 /* u-integer */
38 #define EBML_ID_EBMLMAXSIZELENGTH 0x42F3 /* u-integer */
39 #define EBML_ID_DOCTYPE 0x4282 /* string */
40 #define EBML_ID_DOCTYPEVERSION 0x4287 /* u-integer */
41 #define EBML_ID_DOCTYPEREADVERSION 0x4285 /* u-integer */
43 /* general EBML types */
44 #define EBML_ID_VOID 0xEC /* binary */
45 /* Above copied from ffmpeg */
47 typedef struct mk_Context_s mk_Context;
49 struct mk_Context_s {
50 mk_Context *next, **prev, *parent;
51 mk_Writer *owner;
52 unsigned id;
54 void *data;
55 unsigned d_cur, d_max;
58 /* Contexts */
59 mk_Context *mk_createContext(mk_Writer *w, mk_Context *parent, unsigned id);
60 int mk_appendContextData(mk_Context *c, const void *data, uint64_t size);
61 int mk_flushContextID(mk_Context *c);
62 int mk_flushContextData(mk_Context *c);
63 int mk_closeContext(mk_Context *c, int64_t *off);
64 void mk_destroyContexts(mk_Writer *w);
65 /* Contexts */
67 /* EBML */
68 int mk_writeID(mk_Context *c, unsigned id);
69 int mk_writeSize(mk_Context *c, uint64_t size);
70 int mk_writeSSize(mk_Context *c, int64_t size);
71 int mk_writeStr(mk_Context *c, unsigned id, const char *str);
72 int mk_writeBin(mk_Context *c, unsigned id, const void *data, unsigned size);
73 int mk_writeUInt(mk_Context *c, unsigned id, uint64_t ui);
74 int mk_writeSInt(mk_Context *c, unsigned id, int64_t si);
75 int mk_writeFloatRaw(mk_Context *c, float f);
76 int mk_writeFloat(mk_Context *c, unsigned id, float f);
77 int mk_writeVoid(mk_Context *c, uint64_t length);
78 unsigned mk_ebmlSizeSize(uint64_t s);
79 unsigned mk_ebmlSIntSize(int64_t si);
80 int mk_writeEbmlHeader(mk_Writer *w, const char * doctype, uint64_t doctype_version, uint64_t doctype_readversion );
81 /* EBML */
83 #endif /* _EBML_H */