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

xine-lib 1.2.12

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