Coverage Report

Created: 2025-07-11 07:16

/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
300k
{
33
300k
    p_it->p_buffer = p_data;
34
300k
    p_it->i_buffer = i_data;
35
300k
}
Unexecuted instantiation: webvtt.c:mp4_box_iterator_Init
subsvtt.c:mp4_box_iterator_Init
Line
Count
Source
32
300k
{
33
300k
    p_it->p_buffer = p_data;
34
300k
    p_it->i_buffer = i_data;
35
300k
}
substx3g.c:mp4_box_iterator_Init
Line
Count
Source
32
173
{
33
173
    p_it->p_buffer = p_data;
34
173
    p_it->i_buffer = i_data;
35
173
}
36
37
static bool mp4_box_iterator_Next( mp4_box_iterator_t *p_it )
38
1.19M
{
39
1.19M
    while( p_it->i_buffer > 8 )
40
896k
    {
41
896k
        const uint8_t *p = p_it->p_buffer;
42
896k
        const size_t i_size = GetDWBE( p );
43
896k
        p_it->i_type = VLC_FOURCC(p[4], p[5], p[6], p[7]);
44
896k
        if( i_size >= 8 && i_size <= p_it->i_buffer )
45
896k
        {
46
896k
            p_it->p_payload = &p_it->p_buffer[8];
47
896k
            p_it->i_payload = i_size - 8;
48
            /* update for next run */
49
896k
            p_it->p_buffer += i_size;
50
896k
            p_it->i_buffer -= i_size;
51
896k
            return true;
52
896k
        }
53
37
        else break;
54
896k
    }
55
300k
    return false;
56
1.19M
}
Unexecuted instantiation: webvtt.c:mp4_box_iterator_Next
subsvtt.c:mp4_box_iterator_Next
Line
Count
Source
38
1.19M
{
39
1.19M
    while( p_it->i_buffer > 8 )
40
896k
    {
41
896k
        const uint8_t *p = p_it->p_buffer;
42
896k
        const size_t i_size = GetDWBE( p );
43
896k
        p_it->i_type = VLC_FOURCC(p[4], p[5], p[6], p[7]);
44
896k
        if( i_size >= 8 && i_size <= p_it->i_buffer )
45
896k
        {
46
896k
            p_it->p_payload = &p_it->p_buffer[8];
47
896k
            p_it->i_payload = i_size - 8;
48
            /* update for next run */
49
896k
            p_it->p_buffer += i_size;
50
896k
            p_it->i_buffer -= i_size;
51
896k
            return true;
52
896k
        }
53
0
        else break;
54
896k
    }
55
300k
    return false;
56
1.19M
}
substx3g.c:mp4_box_iterator_Next
Line
Count
Source
38
149
{
39
149
    while( p_it->i_buffer > 8 )
40
44
    {
41
44
        const uint8_t *p = p_it->p_buffer;
42
44
        const size_t i_size = GetDWBE( p );
43
44
        p_it->i_type = VLC_FOURCC(p[4], p[5], p[6], p[7]);
44
44
        if( i_size >= 8 && i_size <= p_it->i_buffer )
45
7
        {
46
7
            p_it->p_payload = &p_it->p_buffer[8];
47
7
            p_it->i_payload = i_size - 8;
48
            /* update for next run */
49
7
            p_it->p_buffer += i_size;
50
7
            p_it->i_buffer -= i_size;
51
7
            return true;
52
7
        }
53
37
        else break;
54
44
    }
55
142
    return false;
56
149
}