diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2004-01-05 00:40:54 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2004-01-05 00:40:54 +0000 |
commit | 72d33f3919057d047ec781a0ad6012de221d6889 (patch) | |
tree | 03d0b200de68bbad4ec4997ae117bcafb60fb7f1 /src/demuxers/ebml.h | |
parent | 271a02404664cbc3a4b28b39c3c23812dac19b57 (diff) | |
download | xine-lib-72d33f3919057d047ec781a0ad6012de221d6889.tar.gz xine-lib-72d33f3919057d047ec781a0ad6012de221d6889.tar.bz2 |
Initial matroska demuxer.
It works with some test streams.
Unsupported stuff:
seeking
lots of codecs
subtitles
metadata
...
CVS patchset: 5998
CVS date: 2004/01/05 00:40:54
Diffstat (limited to 'src/demuxers/ebml.h')
-rw-r--r-- | src/demuxers/ebml.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/demuxers/ebml.h b/src/demuxers/ebml.h new file mode 100644 index 000000000..9b3af4efe --- /dev/null +++ b/src/demuxers/ebml.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2000-2003 the xine project + * + * This file is part of xine, a free video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * EBML parser + * a lot of ideas from the gstreamer parser + * + * $Id: ebml.h,v 1.1 2004/01/05 00:40:54 tmattern Exp $ + * + */ +#ifndef EBML_H +#define EBML_H + +#define EBML_STACK_SIZE 10 +#define EBML_VERSION 1 + +/* EBML IDs */ +#define EBML_ID_EBML 0x1A45DFA3 +#define EBML_ID_EBMLVERSION 0x4286 +#define EBML_ID_EBMLREADVERSION 0x42F7 +#define EBML_ID_EBMLMAXIDLENGTH 0x42F2 +#define EBML_ID_EBMLMAXSIZELENGTH 0x42F3 +#define EBML_ID_DOCTYPE 0x4282 +#define EBML_ID_DOCTYPEVERSION 0x4287 +#define EBML_ID_DOCTYPEREADVERSION 0x4285 + + +typedef struct ebml_elem_s { + uint32_t id; + off_t start; + uint64_t len; +} ebml_elem_t; + +typedef struct ebml_parser_s { + + /* xine stuff */ + xine_t *xine; + input_plugin_t *input; + + /* EBML Parser Stack Management */ + ebml_elem_t elem_stack[EBML_STACK_SIZE]; + int level; + + /* EBML Header Infos */ + uint64_t version; + uint64_t read_version; + uint64_t max_id_len; + uint64_t max_size_len; + char *doctype; + uint64_t doctype_version; + uint64_t doctype_read_version; + +} ebml_parser_t; + + +ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input); + +void dispose_ebml_parser (ebml_parser_t *ebml); + +/* check EBML header */ +int ebml_check_header(ebml_parser_t *read); + + +/* Element Header */ +int ebml_read_elem_head(ebml_parser_t *ebml, ebml_elem_t *elem); + +uint32_t ebml_get_next_level(ebml_parser_t *ebml, ebml_elem_t *elem); + +int ebml_skip(ebml_parser_t *ebml, ebml_elem_t *elem); + +/* EBML types */ +int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *val); + +int ebml_read_sint(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *val); + +int ebml_read_float(ebml_parser_t *ebml, ebml_elem_t *elem, double *val); + +int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str); + +int ebml_read_utf8(ebml_parser_t *ebml, ebml_elem_t *elem, char *str); + +int ebml_read_date(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *date); + +int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem); + +int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, uint8_t *binary); + +#endif /* EBML_H */ |