1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2005 x264 project
7 * Authors: Mike Matsnev
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 *****************************************************************************/
27 #define _LARGEFILE_SOURCE
28 #define _FILE_OFFSET_BITS 64
30 #define CLSIZE 1048576
31 #define CHECK(x) do { if ((x) < 0) return -1; } while (0)
33 typedef struct mk_Context_s mk_Context
;
34 typedef struct mk_Seek_s mk_Seek
;
35 typedef struct mk_Chapter_s mk_Chapter
;
38 mk_Context
*next
, **prev
, *parent
;
43 unsigned d_cur
, d_max
;
57 mk_Context
*edition_entry
;
61 uint64_t def_duration
;
67 mk_Track
**tracks_arr
;
101 int64_t prev_frame_tc_scaled
;
102 int64_t max_frame_tc
;
105 uint64_t default_duration
;
113 uint8_t lacing_num_frames
;
114 int32_t *lacing_sizes
;
119 mk_Context
*mk_createContext(mk_Writer
*w
, mk_Context
*parent
, unsigned id
);
120 int mk_appendContextData(mk_Context
*c
, const void *data
, unsigned size
);
121 int mk_writeID(mk_Context
*c
, unsigned id
);
122 int mk_writeSize(mk_Context
*c
, uint64_t size
);
123 int mk_writeSSize(mk_Context
*c
, int64_t size
);
124 int mk_flushContextID(mk_Context
*c
);
125 int mk_flushContextData(mk_Context
*c
);
126 int mk_closeContext(mk_Context
*c
, int64_t *off
);
127 void mk_destroyContexts(mk_Writer
*w
);
128 int mk_writeStr(mk_Context
*c
, unsigned id
, const char *str
);
129 int mk_writeBin(mk_Context
*c
, unsigned id
, const void *data
, unsigned size
);
130 int mk_writeUInt(mk_Context
*c
, unsigned id
, uint64_t ui
);
131 int mk_writeSInt(mk_Context
*c
, unsigned id
, int64_t si
);
132 int mk_writeFloatRaw(mk_Context
*c
, float f
);
133 int mk_writeFloat(mk_Context
*c
, unsigned id
, float f
);
134 unsigned mk_ebmlSizeSize(uint64_t s
);
135 unsigned mk_ebmlSIntSize(int64_t si
);
138 int mk_writeVoid(mk_Context
*c
, unsigned length
);
139 mk_Context
*mk_createContext(mk_Writer
*w
, mk_Context
*parent
, unsigned id
);
140 int mk_writeUInt(mk_Context
*c
, unsigned id
, uint64_t ui
);
141 int mk_writeFloat(mk_Context
*c
, unsigned id
, float f
);
142 int mk_writeStr(mk_Context
*c
, unsigned id
, const char *str
);
143 int mk_writeBin(mk_Context
*c
, unsigned id
, const void *data
, unsigned size
);
144 int mk_flushContextData(mk_Context
*c
);
145 int mk_closeContext(mk_Context
*c
, int64_t *off
);
146 int mk_writeSeek(mk_Writer
*w
, int64_t *pointer
);
147 int mk_writeTracks(mk_Writer
*w
, mk_Context
*tracks
);
148 int mk_writeChapters(mk_Writer
*w
);