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*/
79 /* matroska subtitle types */
80 #define MATROSKA_SUBTYPE_UNKNOWN 0
81 #define MATROSKA_SUBTYPE_TEXT 1
82 #define MATROSKA_SUBTYPE_SSA 2
83 #define MATROSKA_SUBTYPE_VOBSUB 3
86 #define UINT64_MAX 18446744073709551615ULL
90 #define INT64_MAX 9223372036854775807LL
93 #define EBML_UINT_INVALID UINT64_MAX
94 #define EBML_INT_INVALID INT64_MAX
95 #define EBML_FLOAT_INVALID -1000000000.0
98 uint32_t ebml_read_id (stream_t
*s
, int *length
);
99 uint64_t ebml_read_vlen_uint (uint8_t *buffer
, int *length
);
100 int64_t ebml_read_vlen_int (uint8_t *buffer
, int *length
);
101 uint64_t ebml_read_length (stream_t
*s
, int *length
);
102 uint64_t ebml_read_uint (stream_t
*s
, uint64_t *length
);
103 int64_t ebml_read_int (stream_t
*s
, uint64_t *length
);
104 double ebml_read_float (stream_t
*s
, uint64_t *length
);
105 char *ebml_read_ascii (stream_t
*s
, uint64_t *length
);
106 char *ebml_read_utf8 (stream_t
*s
, uint64_t *length
);
107 int ebml_read_skip (stream_t
*s
, uint64_t *length
);
108 uint32_t ebml_read_master (stream_t
*s
, uint64_t *length
);
110 int ebml_read_element(struct stream
*s
, struct ebml_parse_ctx
*ctx
,
111 void *target
, const struct ebml_elem_desc
*desc
);
113 #endif /* MPLAYER_EBML_H */