Coverage Report

Created: 2025-07-18 07:04

/src/vlc/modules/demux/mkv/util.hpp
Line
Count
Source (jump to first uncovered line)
1
2
/*****************************************************************************
3
 * mkv.cpp : matroska demuxer
4
 *****************************************************************************
5
 * Copyright (C) 2003-2004 VLC authors and VideoLAN
6
 *
7
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8
 *          Steve Lhomme <steve.lhomme@free.fr>
9
 *
10
 * This program is free software; you can redistribute it and/or modify it
11
 * under the terms of the GNU Lesser General Public License as published by
12
 * the Free Software Foundation; either version 2.1 of the License, or
13
 * (at your option) any later version.
14
 *
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 Lesser General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Lesser General Public License
21
 * along with this program; if not, write to the Free Software Foundation,
22
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
 *****************************************************************************/
24
25
#include "mkv.hpp"
26
27
namespace mkv {
28
29
#ifdef HAVE_ZLIB_H
30
int32_t zlib_decompress_extra( demux_t * p_demux, mkv_track_t & tk );
31
block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
32
#endif
33
34
block_t *MemToBlock( uint8_t *p_mem, size_t i_mem, size_t offset);
35
void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, vlc_tick_t i_pts);
36
block_t *WEBVTT_Repack_Sample(block_t *p_block, bool b_webm = false,
37
                              const uint8_t * = NULL, size_t = 0);
38
void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, int64_t i_duration );
39
int UpdatePCR( demux_t * p_demux );
40
41
42
struct real_audio_private
43
{
44
    uint32_t fourcc;
45
    uint16_t version;
46
    uint16_t unknown1;
47
    uint8_t  unknown2[12];
48
    uint16_t unknown3;
49
    uint16_t flavor;
50
    uint32_t coded_frame_size;
51
    uint32_t unknown4[3];
52
    uint16_t sub_packet_h;
53
    uint16_t frame_size;
54
    uint16_t sub_packet_size;
55
    uint16_t unknown5;
56
};
57
58
struct real_audio_private_v4
59
{
60
    real_audio_private header;
61
    uint16_t sample_rate;
62
    uint16_t unknown;
63
    uint16_t sample_size;
64
    uint16_t channels;
65
};
66
67
68
struct real_audio_private_v5
69
{
70
    real_audio_private header;
71
    uint32_t unknown1;
72
    uint16_t unknown2;
73
    uint16_t sample_rate;
74
    uint16_t unknown3;
75
    uint16_t sample_size;
76
    uint16_t channels;
77
};
78
79
class Cook_PrivateTrackData : public PrivateTrackData
80
{
81
public:
82
    Cook_PrivateTrackData(uint16_t sph, uint16_t fs, uint16_t sps):
83
0
        i_sub_packet_h(sph), i_frame_size(fs), i_subpacket_size(sps),
84
0
        p_subpackets(NULL), i_subpackets(0), i_subpacket(0){}
85
    ~Cook_PrivateTrackData();
86
    int32_t Init();
87
88
    uint16_t i_sub_packet_h;
89
    uint16_t i_frame_size;
90
    uint16_t i_subpacket_size;
91
    block_t  **p_subpackets;
92
    size_t   i_subpackets;
93
    size_t   i_subpacket;
94
};
95
96
block_t * packetize_wavpack( const mkv_track_t &, uint8_t *, size_t);
97
98
/* helper functions to print the mkv parse tree */
99
void MkvTree_va( demux_t& demuxer, int i_level, const char* fmt, va_list args);
100
void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ... );
101
102
} // namespace