1 /*****************************************************************************
2 * mkv.cpp : matroska demuxer
3 *****************************************************************************
4 * Copyright (C) 2003-2004 the VideoLAN team
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Steve Lhomme <steve.lhomme@free.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
28 /*****************************************************************************
30 *****************************************************************************/
33 /* config.h may include inttypes.h, so make sure we define that option
35 #define __STDC_FORMAT_MACROS 1
36 #define __STDC_CONSTANT_MACROS 1
45 #include <vlc_common.h>
46 #include <vlc_plugin.h>
49 # include <time.h> /* time() */
53 #include <vlc_codecs.h> /* BITMAPINFOHEADER, WAVEFORMATEX */
54 #include <vlc_iso_lang.h>
56 #include <vlc_charset.h>
57 #include <vlc_input.h>
58 #include <vlc_demux.h>
71 /* libebml and matroska */
72 #include "ebml/EbmlHead.h"
73 #include "ebml/EbmlSubHead.h"
74 #include "ebml/EbmlStream.h"
75 #include "ebml/EbmlContexts.h"
76 #include "ebml/EbmlVoid.h"
77 #include "ebml/EbmlVersion.h"
78 #include "ebml/StdIOCallback.h"
80 #include "matroska/KaxAttachments.h"
81 #include "matroska/KaxAttached.h"
82 #include "matroska/KaxBlock.h"
83 #include "matroska/KaxBlockData.h"
84 #include "matroska/KaxChapters.h"
85 #include "matroska/KaxCluster.h"
86 #include "matroska/KaxClusterData.h"
87 #include "matroska/KaxContexts.h"
88 #include "matroska/KaxCues.h"
89 #include "matroska/KaxCuesData.h"
90 #include "matroska/KaxInfo.h"
91 #include "matroska/KaxInfoData.h"
92 #include "matroska/KaxSeekHead.h"
93 #include "matroska/KaxSegment.h"
94 #include "matroska/KaxTag.h"
95 #include "matroska/KaxTags.h"
96 #include "matroska/KaxTagMulti.h"
97 #include "matroska/KaxTracks.h"
98 #include "matroska/KaxTrackAudio.h"
99 #include "matroska/KaxTrackVideo.h"
100 #include "matroska/KaxTrackEntryData.h"
101 #include "matroska/KaxContentEncoding.h"
102 #include "matroska/KaxVersion.h"
104 #include "ebml/StdIOCallback.h"
106 #include "vlc_keys.h"
109 #include "../mp4/libmp4.h"
115 #define MATROSKA_COMPRESSION_NONE -1
116 #define MATROSKA_COMPRESSION_ZLIB 0
117 #define MATROSKA_COMPRESSION_BLIB 1
118 #define MATROSKA_COMPRESSION_LZOX 2
119 #define MATROSKA_COMPRESSION_HEADER 3
121 #define MKVD_TIMECODESCALE 1000000
124 * What's between a directory and a filename?
127 #define DIRECTORY_SEPARATOR '\\'
129 #define DIRECTORY_SEPARATOR '/'
133 #define MKV_IS_ID( el, C ) ( EbmlId( (*el) ) == C::ClassInfos.GlobalId )
136 using namespace LIBMATROSKA_NAMESPACE;
146 virtual ~attachment_c()
151 std::string psz_file_name;
152 std::string psz_mime_type;
157 class matroska_segment_c;
159 class matroska_stream_c
162 matroska_stream_c( demux_sys_t & demuxer )
168 virtual ~matroska_stream_c()
177 std::vector<matroska_segment_c*> segments;
183 /*****************************************************************************
184 * definitions of structures and functions used by this plugins
185 *****************************************************************************/
192 unsigned int i_number;
195 uint8_t *p_extra_data;
200 uint64_t i_default_duration;
201 float f_timecodescale;
210 unsigned int i_original_rate;
213 /* data to be send first */
215 uint8_t *p_data_init;
217 /* hack : it's for seek */
218 bool b_search_keyframe;
222 const char *psz_codec_name;
223 const char *psz_codec_settings;
224 const char *psz_codec_info_url;
225 const char *psz_codec_download_url;
227 /* encryption/compression */
228 int i_compression_type;
229 KaxContentCompSettings *p_compression_data;
245 #endif /* _MKV_HPP_ */