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"
29 /* EBML version supported */
30 #define EBML_VERSION 1
33 EBML_TYPE_SUBELEMENTS
,
42 struct ebml_field_desc
{
47 const struct ebml_elem_desc
*desc
;
50 struct ebml_elem_desc
{
52 enum ebml_elemtype type
;
55 const struct ebml_field_desc
*fields
;
58 struct ebml_parse_ctx
{
62 bool no_error_messages
;
70 #include "ebml_types.h"
72 #define EBML_ID_INVALID 0xffffffff
75 /* matroska track types */
76 #define MATROSKA_TRACK_VIDEO 0x01 /* rectangle-shaped pictures aka video */
77 #define MATROSKA_TRACK_AUDIO 0x02 /* anything you can hear */
78 #define MATROSKA_TRACK_COMPLEX 0x03 /* audio+video in same track used by DV */
79 #define MATROSKA_TRACK_LOGO 0x10 /* overlay-pictures displayed over video*/
80 #define MATROSKA_TRACK_SUBTITLE 0x11 /* text-subtitles */
81 #define MATROSKA_TRACK_CONTROL 0x20 /* control-codes for menu or other stuff*/
83 /* matroska subtitle types */
84 #define MATROSKA_SUBTYPE_UNKNOWN 0
85 #define MATROSKA_SUBTYPE_TEXT 1
86 #define MATROSKA_SUBTYPE_SSA 2
87 #define MATROSKA_SUBTYPE_VOBSUB 3
90 #define UINT64_MAX 18446744073709551615ULL
94 #define INT64_MAX 9223372036854775807LL
97 #define EBML_UINT_INVALID UINT64_MAX
98 #define EBML_INT_INVALID INT64_MAX
99 #define EBML_FLOAT_INVALID -1000000000.0
102 uint32_t ebml_read_id (stream_t
*s
, int *length
);
103 uint64_t ebml_read_vlen_uint (uint8_t *buffer
, int *length
);
104 int64_t ebml_read_vlen_int (uint8_t *buffer
, int *length
);
105 uint64_t ebml_read_length (stream_t
*s
, int *length
);
106 uint64_t ebml_read_uint (stream_t
*s
, uint64_t *length
);
107 int64_t ebml_read_int (stream_t
*s
, uint64_t *length
);
108 double ebml_read_float (stream_t
*s
, uint64_t *length
);
109 char *ebml_read_ascii (stream_t
*s
, uint64_t *length
);
110 char *ebml_read_utf8 (stream_t
*s
, uint64_t *length
);
111 int ebml_read_skip (stream_t
*s
, uint64_t *length
);
112 uint32_t ebml_read_master (stream_t
*s
, uint64_t *length
);
114 int ebml_read_element(struct stream
*s
, struct ebml_parse_ctx
*ctx
,
115 void *target
, const struct ebml_elem_desc
*desc
);
117 #endif /* MPLAYER_EBML_H */