GCC Code Coverage Report
Directory: ../../../ffmpeg/ Exec Total Coverage
File: src/libavcodec/parsers.c Lines: 6 20 30.0 %
Date: 2020-07-13 04:22:34 Branches: 2 8 25.0 %

Line Branch Exec Source
1
/*
2
 * This file is part of FFmpeg.
3
 *
4
 * FFmpeg is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * FFmpeg is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with FFmpeg; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
 */
18
19
#include <stdint.h>
20
21
#include "libavutil/thread.h"
22
23
#include "avcodec.h"
24
25
extern AVCodecParser ff_aac_parser;
26
extern AVCodecParser ff_aac_latm_parser;
27
extern AVCodecParser ff_ac3_parser;
28
extern AVCodecParser ff_adx_parser;
29
extern AVCodecParser ff_av1_parser;
30
extern AVCodecParser ff_avs2_parser;
31
extern AVCodecParser ff_bmp_parser;
32
extern AVCodecParser ff_cavsvideo_parser;
33
extern AVCodecParser ff_cook_parser;
34
extern AVCodecParser ff_dca_parser;
35
extern AVCodecParser ff_dirac_parser;
36
extern AVCodecParser ff_dnxhd_parser;
37
extern AVCodecParser ff_dpx_parser;
38
extern AVCodecParser ff_dvaudio_parser;
39
extern AVCodecParser ff_dvbsub_parser;
40
extern AVCodecParser ff_dvdsub_parser;
41
extern AVCodecParser ff_dvd_nav_parser;
42
extern AVCodecParser ff_flac_parser;
43
extern AVCodecParser ff_g723_1_parser;
44
extern AVCodecParser ff_g729_parser;
45
extern AVCodecParser ff_gif_parser;
46
extern AVCodecParser ff_gsm_parser;
47
extern AVCodecParser ff_h261_parser;
48
extern AVCodecParser ff_h263_parser;
49
extern AVCodecParser ff_h264_parser;
50
extern AVCodecParser ff_hevc_parser;
51
extern AVCodecParser ff_jpeg2000_parser;
52
extern AVCodecParser ff_mjpeg_parser;
53
extern AVCodecParser ff_mlp_parser;
54
extern AVCodecParser ff_mpeg4video_parser;
55
extern AVCodecParser ff_mpegaudio_parser;
56
extern AVCodecParser ff_mpegvideo_parser;
57
extern AVCodecParser ff_opus_parser;
58
extern AVCodecParser ff_png_parser;
59
extern AVCodecParser ff_pnm_parser;
60
extern AVCodecParser ff_rv30_parser;
61
extern AVCodecParser ff_rv40_parser;
62
extern AVCodecParser ff_sbc_parser;
63
extern AVCodecParser ff_sipr_parser;
64
extern AVCodecParser ff_tak_parser;
65
extern AVCodecParser ff_vc1_parser;
66
extern AVCodecParser ff_vorbis_parser;
67
extern AVCodecParser ff_vp3_parser;
68
extern AVCodecParser ff_vp8_parser;
69
extern AVCodecParser ff_vp9_parser;
70
extern AVCodecParser ff_webp_parser;
71
extern AVCodecParser ff_xma_parser;
72
73
#include "libavcodec/parser_list.c"
74
75
static AVOnce av_parser_next_init = AV_ONCE_INIT;
76
77
static void av_parser_init_next(void)
78
{
79
    AVCodecParser *prev = NULL, *p;
80
    int i = 0;
81
    while ((p = (AVCodecParser*)parser_list[i++])) {
82
        if (prev)
83
            prev->next = p;
84
        prev = p;
85
    }
86
}
87
88
AVCodecParser *av_parser_next(const AVCodecParser *p)
89
{
90
    ff_thread_once(&av_parser_next_init, av_parser_init_next);
91
92
    if (p)
93
        return p->next;
94
    else
95
        return (AVCodecParser*)parser_list[0];
96
}
97
98
315109
const AVCodecParser *av_parser_iterate(void **opaque)
99
{
100
315109
    uintptr_t i = (uintptr_t)*opaque;
101
315109
    const AVCodecParser *p = parser_list[i];
102
103
315109
    if (p)
104
312075
        *opaque = (void*)(i + 1);
105
106
315109
    return p;
107
}
108
109
void av_register_codec_parser(AVCodecParser *parser)
110
{
111
    ff_thread_once(&av_parser_next_init, av_parser_init_next);
112
}