xine-lib  1.2.9
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 */
51 
52  /* EBML Parser Stack Management */
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;
64 
66 
67 
69 
71 
72 /* check EBML header */
74 
75 
76 /* Element Header */
78 
79 uint32_t ebml_get_next_level(ebml_parser_t *ebml, ebml_elem_t *elem);
80 
81 int ebml_skip(ebml_parser_t *ebml, ebml_elem_t *elem);
82 
83 /* EBML types */
84 int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *val);
85 
86 #if 0
87 int ebml_read_sint(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *val);
88 #endif
89 
90 int ebml_read_float(ebml_parser_t *ebml, ebml_elem_t *elem, double *val);
91 
92 int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str);
93 
94 #if 0
95 int ebml_read_utf8(ebml_parser_t *ebml, ebml_elem_t *elem, char *str);
96 #endif
97 
99 
100 #if 0
101 int ebml_read_date(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *date);
102 #endif
103 
104 int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem);
105 
106 int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary);
107 
108 #endif /* EBML_H */
uint64_t doctype_read_version
Definition: ebml.h:63
Definition: ebml.h:46
#define XINE_MALLOC
Definition: attributes.h:119
int ebml_read_elem_head(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:208
ebml_parser_t * new_ebml_parser(xine_t *xine, input_plugin_t *input)
Definition: ebml.c:41
int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str)
Definition: ebml.c:309
uint32_t ebml_get_next_level(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:61
int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary)
Definition: ebml.c:370
input_plugin_t * input
Definition: ebml.h:50
Definition: ebml.h:40
off_t start
Definition: ebml.h:42
#define EBML_STACK_SIZE
Definition: ebml.h:26
char * ebml_alloc_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:324
int ebml_check_header(ebml_parser_t *read)
Definition: ebml.c:374
ebml_elem_t elem_stack[10]
Definition: ebml.h:53
int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *val)
Definition: ebml.c:220
struct ebml_parser_s ebml_parser_t
uint64_t read_version
Definition: ebml.h:58
int ebml_read_float(ebml_parser_t *ebml, ebml_elem_t *elem, double *val)
Definition: ebml.c:272
static int input(void)
Definition: goomsl_lex.c:1495
Definition: input_plugin.h:92
uint64_t len
Definition: ebml.h:43
uint32_t id
Definition: ebml.h:41
struct ebml_elem_s ebml_elem_t
uint64_t doctype_version
Definition: ebml.h:62
uint64_t max_id_len
Definition: ebml.h:59
int level
Definition: ebml.h:54
Definition: xine_internal.h:81
uint64_t max_size_len
Definition: ebml.h:60
xine_t * xine
Definition: ebml.h:49
char * doctype
Definition: ebml.h:61
void dispose_ebml_parser(ebml_parser_t *ebml)
Definition: ebml.c:53
int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:346
uint64_t version
Definition: ebml.h:57
int ebml_skip(ebml_parser_t *ebml, ebml_elem_t *elem)
Definition: ebml.c:197