Coverage Report

Created: 2025-08-29 07:30

/src/vlc/modules/demux/mp4/minibox.h
Line
Count
Source
1
/*****************************************************************************
2
 * minibox.h: minimal mp4 box iterator
3
 *****************************************************************************
4
 * Copyright (C) 2017 VideoLabs, VLC authors and VideoLAN
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation; either version 2.1 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program 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 Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this program; if not, write to the Free Software Foundation,
18
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19
 *****************************************************************************/
20
21
typedef struct
22
{
23
    const uint8_t *p_buffer;
24
    size_t i_buffer;
25
    const uint8_t *p_payload;
26
    size_t i_payload;
27
    vlc_fourcc_t i_type;
28
} mp4_box_iterator_t;
29
30
static void mp4_box_iterator_Init( mp4_box_iterator_t *p_it,
31
                                   const uint8_t *p_data, size_t i_data )
32
411k
{
33
411k
    p_it->p_buffer = p_data;
34
411k
    p_it->i_buffer = i_data;
35
411k
}
Unexecuted instantiation: webvtt.c:mp4_box_iterator_Init
subsvtt.c:mp4_box_iterator_Init
Line
Count
Source
32
409k
{
33
409k
    p_it->p_buffer = p_data;
34
409k
    p_it->i_buffer = i_data;
35
409k
}
substx3g.c:mp4_box_iterator_Init
Line
Count
Source
32
2.08k
{
33
2.08k
    p_it->p_buffer = p_data;
34
2.08k
    p_it->i_buffer = i_data;
35
2.08k
}
36
37
static bool mp4_box_iterator_Next( mp4_box_iterator_t *p_it )
38
1.59M
{
39
1.59M
    while( p_it->i_buffer > 8 )
40
1.18M
    {
41
1.18M
        const uint8_t *p = p_it->p_buffer;
42
1.18M
        const size_t i_size = GetDWBE( p );
43
1.18M
        p_it->i_type = VLC_FOURCC(p[4], p[5], p[6], p[7]);
44
1.18M
        if( i_size >= 8 && i_size <= p_it->i_buffer )
45
1.18M
        {
46
1.18M
            p_it->p_payload = &p_it->p_buffer[8];
47
1.18M
            p_it->i_payload = i_size - 8;
48
            /* update for next run */
49
1.18M
            p_it->p_buffer += i_size;
50
1.18M
            p_it->i_buffer -= i_size;
51
1.18M
            return true;
52
1.18M
        }
53
48
        else break;
54
1.18M
    }
55
411k
    return false;
56
1.59M
}
Unexecuted instantiation: webvtt.c:mp4_box_iterator_Next
subsvtt.c:mp4_box_iterator_Next
Line
Count
Source
38
1.59M
{
39
1.59M
    while( p_it->i_buffer > 8 )
40
1.18M
    {
41
1.18M
        const uint8_t *p = p_it->p_buffer;
42
1.18M
        const size_t i_size = GetDWBE( p );
43
1.18M
        p_it->i_type = VLC_FOURCC(p[4], p[5], p[6], p[7]);
44
1.18M
        if( i_size >= 8 && i_size <= p_it->i_buffer )
45
1.18M
        {
46
1.18M
            p_it->p_payload = &p_it->p_buffer[8];
47
1.18M
            p_it->i_payload = i_size - 8;
48
            /* update for next run */
49
1.18M
            p_it->p_buffer += i_size;
50
1.18M
            p_it->i_buffer -= i_size;
51
1.18M
            return true;
52
1.18M
        }
53
0
        else break;
54
1.18M
    }
55
409k
    return false;
56
1.59M
}
substx3g.c:mp4_box_iterator_Next
Line
Count
Source
38
2.06k
{
39
2.06k
    while( p_it->i_buffer > 8 )
40
58
    {
41
58
        const uint8_t *p = p_it->p_buffer;
42
58
        const size_t i_size = GetDWBE( p );
43
58
        p_it->i_type = VLC_FOURCC(p[4], p[5], p[6], p[7]);
44
58
        if( i_size >= 8 && i_size <= p_it->i_buffer )
45
10
        {
46
10
            p_it->p_payload = &p_it->p_buffer[8];
47
10
            p_it->i_payload = i_size - 8;
48
            /* update for next run */
49
10
            p_it->p_buffer += i_size;
50
10
            p_it->i_buffer -= i_size;
51
10
            return true;
52
10
        }
53
48
        else break;
54
58
    }
55
2.05k
    return false;
56
2.06k
}