]> git.sesse.net Git - vlc/blob - modules/demux/mkv/util.hpp
8c6cc6acfbdf98e0b1807ac604836c1b0ae67d51
[vlc] / modules / demux / mkv / util.hpp
1
2 /*****************************************************************************
3  * mkv.cpp : matroska demuxer
4  *****************************************************************************
5  * Copyright (C) 2003-2004 VLC authors and VideoLAN
6  * $Id$
7  *
8  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9  *          Steve Lhomme <steve.lhomme@free.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #include "mkv.hpp"
27
28 #ifdef HAVE_ZLIB_H
29 int32_t zlib_decompress_extra( demux_t * p_demux, mkv_track_t * tk );
30 block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
31 #endif
32
33 block_t *MemToBlock( uint8_t *p_mem, size_t i_mem, size_t offset);
34 void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, mtime_t i_pts);
35 void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, mtime_t i_duration );
36
37
38 struct real_audio_private
39 {
40     uint32_t fourcc;
41     uint16_t version;
42     uint16_t unknown1;
43     uint8_t  unknown2[12];
44     uint16_t unknown3;
45     uint16_t flavor;
46     uint32_t coded_frame_size;
47     uint32_t unknown4[3];
48     uint16_t sub_packet_h;
49     uint16_t frame_size;
50     uint16_t sub_packet_size;
51     uint16_t unknown5;
52 };
53
54 struct real_audio_private_v4
55 {
56     real_audio_private header;
57     uint16_t sample_rate;
58     uint16_t unknown;
59     uint16_t sample_size;
60     uint16_t channels;
61 };
62
63
64 struct real_audio_private_v5
65 {
66     real_audio_private header;
67     uint32_t unknown1;
68     uint16_t unknown2;
69     uint16_t sample_rate;
70     uint16_t unknown3;
71     uint16_t sample_size;
72     uint16_t channels;
73 };
74
75 class Cook_PrivateTrackData : public PrivateTrackData
76 {
77 public:
78     Cook_PrivateTrackData(uint16_t sph, uint16_t fs, uint16_t sps):
79         i_sub_packet_h(sph), i_frame_size(fs), i_subpacket_size(sps),
80         p_subpackets(NULL), i_subpackets(0), i_subpacket(0){}
81     ~Cook_PrivateTrackData();
82     int32_t Init();
83
84     uint16_t i_sub_packet_h;
85     uint16_t i_frame_size;
86     uint16_t i_subpacket_size;
87     block_t  **p_subpackets;
88     size_t   i_subpackets;
89     size_t   i_subpacket;
90 };
91
92 block_t * packetize_wavpack( mkv_track_t *, uint8_t *, size_t);