Bump version to 0.6.4.1
[libmkv.git] / src / ebml.h
blobcdcf4d047e9ff80cd941bab4fcfe5f8a1e2e6e17
1 /*****************************************************************************
2 * ebml.h:
3 *****************************************************************************
4 * Copyright (C) 2005 x264 project
6 * Authors: Mike Matsnev
7 * Nathan Caldwell
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
23 #ifndef _EBML_H
24 #define _EBML_H 1
26 /* Copied from ffmpeg */
27 /* EBML version supported */
28 #define EBML_VERSION 1
30 /* top-level master-IDs */
31 #define EBML_ID_HEADER 0x1A45DFA3 /* sub-elements */
33 /* IDs in the HEADER master */
34 #define EBML_ID_EBMLVERSION 0x4286 /* u-integer */
35 #define EBML_ID_EBMLREADVERSION 0x42F7 /* u-integer */
36 #define EBML_ID_EBMLMAXIDLENGTH 0x42F2 /* u-integer */
37 #define EBML_ID_EBMLMAXSIZELENGTH 0x42F3 /* u-integer */
38 #define EBML_ID_DOCTYPE 0x4282 /* string */
39 #define EBML_ID_DOCTYPEVERSION 0x4287 /* u-integer */
40 #define EBML_ID_DOCTYPEREADVERSION 0x4285 /* u-integer */
42 /* general EBML types */
43 #define EBML_ID_VOID 0xEC /* binary */
44 /* Above copied from ffmpeg */
46 typedef struct mk_Context_s mk_Context;
48 struct mk_Context_s {
49 mk_Context *next, **prev, *parent;
50 mk_Writer *owner;
51 unsigned id;
53 void *data;
54 unsigned d_cur, d_max;
57 /* Contexts */
58 mk_Context *mk_createContext(mk_Writer *w, mk_Context *parent,
59 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,
73 unsigned size);
74 int mk_writeUInt(mk_Context *c, unsigned id, uint64_t ui);
75 int mk_writeSInt(mk_Context *c, unsigned id, int64_t si);
76 int mk_writeFloatRaw(mk_Context *c, float f);
77 int mk_writeFloat(mk_Context *c, unsigned id, float f);
78 int mk_writeVoid(mk_Context *c, uint64_t length);
79 unsigned mk_ebmlSizeSize(uint64_t s);
80 unsigned mk_ebmlSIntSize(int64_t si);
81 unsigned mk_ebmlUIntSize(uint64_t ui);
82 int mk_writeEbmlHeader(mk_Writer *w, const char *doctype,
83 uint64_t doctype_version,
84 uint64_t doctype_readversion);
85 /* EBML */
87 #endif /* _EBML_H */