xine-lib  1.2.9
demux_matroska.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2017 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  * demultiplexer for matroska streams: shared header
21  */
22 
23 #ifndef _DEMUX_MATROSKA_H_
24 #define _DEMUX_MATROSKA_H_
25 
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29 
30 #include <ctype.h>
31 #include <stdio.h>
32 #include <fcntl.h>
33 #include <unistd.h>
34 #include <string.h>
35 #include <stdlib.h>
36 #include <zlib.h>
37 
38 #include <xine/xine_internal.h>
39 #include <xine/demux.h>
40 #include <xine/buffer.h>
41 #include "bswap.h"
42 
43 #include "ebml.h"
44 #include "matroska.h"
45 
46 #define NUM_PREVIEW_BUFFERS 10
47 
48 #define MAX_STREAMS 128
49 #define MAX_FRAMES 128
50 
51 #define WRAP_THRESHOLD 90000
52 
53 typedef struct {
54  int track_num;
55  off_t *pos;
56  uint64_t *timecode;
58 
60 
61 typedef struct {
62 
64 
65  /* class-wide, global variables here */
66 
68 
69 #define LITERAL_UTF_8_LEN 5
70  char literal_utf_8[8]; /* "utf-8" */
71 
73 
74 typedef struct {
75 
77 
79 
81 
83 
84  int status;
85 
87 
88  /* segment element */
90  uint64_t timecode_scale;
91  int duration; /* in millis */
94  char *title;
95 
96  /* meta seek info */
99 
100  /* seek info */
106 
107  /* tracks */
112 
115 
116  /* maintain editions, number and capacity */
117  int num_editions, cap_editions;
119 
120  /* block */
121  uint8_t *block_data;
123 
124  /* current tracks */
125  matroska_track_t *video_track; /* to remove */
126  matroska_track_t *audio_track; /* to remove */
127  matroska_track_t *sub_track; /* to remove */
128  uint64_t last_timecode;
129 
132 
133  /* seekhead parsing */
137 
138  /* event handling (chapter navigation) */
141 
142 /* "entry points" for chapter handling.
143  * The parser descends into "Chapters" elements at the _parse_ function,
144  * and editions care about cleanup internally. */
147 
148 /* Search an edition for the chapter matching a given timecode.
149  *
150  * Return: chapter index, or -1 if none is found.
151  *
152  * TODO: does not handle chapter end times yet.
153  */
155 
156 #endif /* _DEMUX_MATROSKA_H_ */
char * title
Definition: demux_matroska.h:94
ebml_elem_t segment
Definition: demux_matroska.h:89
demux_plugin_t demux_plugin
Definition: demux_matroska.h:76
input_plugin_t * input
Definition: demux_matroska.h:82
Definition: ebml.h:46
Definition: xine_internal.h:194
int matroska_parse_chapters(demux_matroska_t *)
Definition: demux_matroska-chapters.c:352
matroska_edition_t ** editions
Definition: demux_matroska.h:118
int num_entries
Definition: demux_matroska.h:57
int has_seekhead
Definition: demux_matroska.h:97
int preview_mode
Definition: demux_matroska.h:93
Definition: ebml.h:40
int top_level_list_size
Definition: demux_matroska.h:134
int num_indexes
Definition: demux_matroska.h:102
size_t compress_maxlen
Definition: demux_matroska.h:114
int num_video_tracks
Definition: demux_matroska.h:109
Definition: demux.h:97
xine_event_queue_t * event_queue
Definition: demux_matroska.h:139
matroska_track_t * video_track
Definition: demux_matroska.h:125
Definition: matroska.h:263
Definition: demux_matroska.h:61
matroska_track_t * audio_track
Definition: demux_matroska.h:126
xine_stream_t * stream
Definition: demux_matroska.h:80
off_t * top_level_list
Definition: demux_matroska.h:136
int skip_for_track
Definition: demux_matroska.h:105
int track_num
Definition: demux_matroska.h:54
int send_newpts
Definition: demux_matroska.h:130
Definition: matroska.h:224
ebml_parser_t * ebml
Definition: demux_matroska.h:86
Definition: xine_internal.h:210
size_t block_data_size
Definition: demux_matroska.h:122
uint64_t last_timecode
Definition: demux_matroska.h:128
Definition: demux.h:47
xine_t * xine
Definition: demux_matroska.h:67
matroska_track_t * sub_track
Definition: demux_matroska.h:127
off_t * pos
Definition: demux_matroska.h:55
Definition: input_plugin.h:92
int num_sub_tracks
Definition: demux_matroska.h:111
int buf_flag_seek
Definition: demux_matroska.h:131
int num_editions
Definition: demux_matroska.h:117
int seekhead_handled
Definition: demux_matroska.h:98
int duration
Definition: demux_matroska.h:91
int first_cluster_found
Definition: demux_matroska.h:103
Definition: xine_internal.h:81
int preview_sent
Definition: demux_matroska.h:92
Definition: demux_matroska.h:53
void matroska_free_editions(demux_matroska_t *)
Definition: demux_matroska-chapters.c:412
int top_level_list_max_size
Definition: demux_matroska.h:135
Definition: demux_matroska.h:74
demux_class_t demux_class
Definition: demux_matroska.h:63
int matroska_get_chapter(demux_matroska_t *, uint64_t, matroska_edition_t **)
Definition: demux_matroska-chapters.c:423
int status
Definition: demux_matroska.h:84
#define MAX_STREAMS
Definition: demux_matroska.h:48
int num_tracks
Definition: demux_matroska.h:108
uint64_t * timecode
Definition: demux_matroska.h:56
int skip_to_timecode
Definition: demux_matroska.h:104
int num_audio_tracks
Definition: demux_matroska.h:110
matroska_index_t * indexes
Definition: demux_matroska.h:101
uint64_t timecode_scale
Definition: demux_matroska.h:90
uint8_t * block_data
Definition: demux_matroska.h:121