2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_EBML_H
20 #define MPLAYER_EBML_H
26 #include "stream/stream.h"
30 /* EBML version supported */
31 #define EBML_VERSION 1
34 EBML_TYPE_SUBELEMENTS
,
43 struct ebml_field_desc
{
48 const struct ebml_elem_desc
*desc
;
51 struct ebml_elem_desc
{
53 enum ebml_elemtype type
;
56 const struct ebml_field_desc
*fields
;
59 struct ebml_parse_ctx
{
63 bool no_error_messages
;
66 #include "ebml_types.h"
68 #define EBML_ID_INVALID 0xffffffff
71 /* matroska track types */
72 #define MATROSKA_TRACK_VIDEO 0x01 /* rectangle-shaped pictures aka video */
73 #define MATROSKA_TRACK_AUDIO 0x02 /* anything you can hear */
74 #define MATROSKA_TRACK_COMPLEX 0x03 /* audio+video in same track used by DV */
75 #define MATROSKA_TRACK_LOGO 0x10 /* overlay-pictures displayed over video*/
76 #define MATROSKA_TRACK_SUBTITLE 0x11 /* text-subtitles */
77 #define MATROSKA_TRACK_CONTROL 0x20 /* control-codes for menu or other stuff*/
80 #define UINT64_MAX 18446744073709551615ULL
84 #define INT64_MAX 9223372036854775807LL
87 #define EBML_UINT_INVALID UINT64_MAX
88 #define EBML_INT_INVALID INT64_MAX
89 #define EBML_FLOAT_INVALID -1000000000.0
92 uint32_t ebml_read_id (stream_t
*s
, int *length
);
93 uint64_t ebml_read_vlen_uint (uint8_t *buffer
, int *length
);
94 int64_t ebml_read_vlen_int (uint8_t *buffer
, int *length
);
95 uint64_t ebml_read_length (stream_t
*s
, int *length
);
96 uint64_t ebml_read_uint (stream_t
*s
, uint64_t *length
);
97 int64_t ebml_read_int (stream_t
*s
, uint64_t *length
);
98 double ebml_read_float (stream_t
*s
, uint64_t *length
);
99 char *ebml_read_ascii (stream_t
*s
, uint64_t *length
);
100 char *ebml_read_utf8 (stream_t
*s
, uint64_t *length
);
101 int ebml_read_skip (stream_t
*s
, uint64_t *length
);
102 uint32_t ebml_read_master (stream_t
*s
, uint64_t *length
);
104 int ebml_read_element(struct stream
*s
, struct ebml_parse_ctx
*ctx
,
105 void *target
, const struct ebml_elem_desc
*desc
);
107 #endif /* MPLAYER_EBML_H */