xine-lib: xine-lib-1.2.12/src/demuxers/ebml.h Source File

xine-lib 1.2.12

ebml.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2009 the xine project
3 *
4 * This file is part of xine, a free video player.
5 *
6 * xine is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * xine is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * EBML parser
21 * a lot of ideas from the gstreamer parser
22 */
23#ifndef EBML_H
24#define EBML_H
25
26#define EBML_STACK_SIZE 10
27#define EBML_VERSION 1
28
29/* EBML IDs */
30#define EBML_ID_EBML 0x1A45DFA3
31#define EBML_ID_EBMLVERSION 0x4286
32#define EBML_ID_EBMLREADVERSION 0x42F7
33#define EBML_ID_EBMLMAXIDLENGTH 0x42F2
34#define EBML_ID_EBMLMAXSIZELENGTH 0x42F3
35#define EBML_ID_DOCTYPE 0x4282
36#define EBML_ID_DOCTYPEVERSION 0x4287
37#define EBML_ID_DOCTYPEREADVERSION 0x4285
38
39
40 typedef struct ebml_elem_s {
41 uint32_t id;
42 off_t start;
43 uint64_t len;
44} ebml_elem_t;
45
46 typedef struct ebml_parser_s {
47
48 /* xine stuff */
49 xine_t *xine;
50 input_plugin_t *input;
51
52 /* EBML Parser Stack Management */
53 ebml_elem_t elem_stack[EBML_STACK_SIZE];
54 int level;
55
56 /* EBML Header Infos */
57 uint64_t version;
58 uint64_t read_version;
59 uint64_t max_id_len;
60 uint64_t max_size_len;
61 char *doctype;
62 uint64_t doctype_version;
63 uint64_t doctype_read_version;
64
65} ebml_parser_t;
66
67
68 ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input) XINE_MALLOC;
69
70void dispose_ebml_parser (ebml_parser_t *ebml);
71
72/* check EBML header */
73int ebml_check_header(ebml_parser_t *read);
74
75
76/* Element Header */
77int ebml_read_elem_head(ebml_parser_t *ebml, ebml_elem_t *elem);
78
79uint32_t ebml_get_next_level(ebml_parser_t *ebml, ebml_elem_t *elem);
80
81int ebml_skip(ebml_parser_t *ebml, ebml_elem_t *elem);
82
83/* EBML types */
84int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *val);
85
86#if 0
87int ebml_read_sint(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *val);
88#endif
89
90int ebml_read_float(ebml_parser_t *ebml, ebml_elem_t *elem, double *val);
91
92int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str);
93
94#if 0
95int ebml_read_utf8(ebml_parser_t *ebml, ebml_elem_t *elem, char *str);
96#endif
97
98char *ebml_alloc_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem);
99
100#if 0
101int ebml_read_date(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *date);
102#endif
103
104int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem);
105
106int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary);
107
108#endif /* EBML_H */
ebml_read_master
int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:346
ebml_skip
int ebml_skip(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:197
ebml_get_next_level
uint32_t ebml_get_next_level(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:61
dispose_ebml_parser
void dispose_ebml_parser(ebml_parser_t *ebml)
Definition: ebml.c:53
ebml_read_elem_head
int ebml_read_elem_head(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:208
ebml_parser_t
struct ebml_parser_s ebml_parser_t
ebml_read_binary
int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary)
Definition: ebml.c:370
ebml_read_float
int ebml_read_float(ebml_parser_t *ebml, ebml_elem_t *elem, double *val)
Definition: ebml.c:272
ebml_check_header
int ebml_check_header(ebml_parser_t *read)
Definition: ebml.c:374
ebml_read_ascii
int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str)
Definition: ebml.c:309
ebml_elem_t
struct ebml_elem_s ebml_elem_t
ebml_read_uint
int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *val)
Definition: ebml.c:220
new_ebml_parser
ebml_parser_t * new_ebml_parser(xine_t *xine, input_plugin_t *input)
Definition: ebml.c:41
ebml_alloc_read_ascii
char * ebml_alloc_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:324
EBML_STACK_SIZE
#define EBML_STACK_SIZE
Definition: ebml.h:26
input
static int input(void)
Definition: goomsl_lex.c:1495
XINE_MALLOC
#define XINE_MALLOC
Definition: attributes.h:141
ebml_elem_s
Definition: ebml.h:40
ebml_elem_s::len
uint64_t len
Definition: ebml.h:43
ebml_elem_s::start
off_t start
Definition: ebml.h:42
ebml_elem_s::id
uint32_t id
Definition: ebml.h:41
ebml_parser_s
Definition: ebml.h:46
ebml_parser_s::max_id_len
uint64_t max_id_len
Definition: ebml.h:59
ebml_parser_s::level
int level
Definition: ebml.h:54
ebml_parser_s::xine
xine_t * xine
Definition: ebml.h:49
ebml_parser_s::read_version
uint64_t read_version
Definition: ebml.h:58
ebml_parser_s::doctype
char * doctype
Definition: ebml.h:61
ebml_parser_s::doctype_read_version
uint64_t doctype_read_version
Definition: ebml.h:63
ebml_parser_s::elem_stack
ebml_elem_t elem_stack[10]
Definition: ebml.h:53
ebml_parser_s::input
input_plugin_t * input
Definition: ebml.h:50
ebml_parser_s::version
uint64_t version
Definition: ebml.h:57
ebml_parser_s::doctype_version
uint64_t doctype_version
Definition: ebml.h:62
ebml_parser_s::max_size_len
uint64_t max_size_len
Definition: ebml.h:60
input_plugin_s
Definition: input_plugin.h:90
xine_s
Definition: xine_internal.h:80