Coverage Report

Created: 2025-08-25 07:17

/src/vlc/modules/codec/webvtt/webvtt.h
Line
Count
Source (jump to first uncovered line)
1
/*****************************************************************************
2
 * webvtt.h: WEBVTT shared code
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
#ifndef WEBVTT_H
21
#define WEBVTT_H
22
23
#include <vlc_tick.h>
24
25
int  webvtt_OpenDecoder   ( vlc_object_t * );
26
void webvtt_CloseDecoder  ( vlc_object_t * );
27
28
int  webvtt_OpenDemux     ( vlc_object_t * );
29
int  webvtt_OpenDemuxStream (vlc_object_t *);
30
void webvtt_CloseDemux    ( vlc_object_t * );
31
32
#ifdef ENABLE_SOUT
33
int  webvtt_OpenEncoder   ( vlc_object_t * );
34
35
int  webvtt_OpenMuxer   ( vlc_object_t * );
36
void webvtt_CloseMuxer  ( vlc_object_t * );
37
#endif
38
39
316k
#define ATOM_iden VLC_FOURCC('i', 'd', 'e', 'n')
40
443k
#define ATOM_payl VLC_FOURCC('p', 'a', 'y', 'l')
41
128k
#define ATOM_sttg VLC_FOURCC('s', 't', 't', 'g')
42
444k
#define ATOM_vttc VLC_FOURCC('v', 't', 't', 'c')
43
#define ATOM_vtte VLC_FOURCC('v', 't', 't', 'e')
44
444k
#define ATOM_vttx VLC_FOURCC('v', 't', 't', 'x')
45
46
typedef struct webvtt_text_parser_t webvtt_text_parser_t;
47
48
enum webvtt_header_line_e
49
{
50
    WEBVTT_HEADER_STYLE = 1,
51
    WEBVTT_HEADER_REGION,
52
};
53
54
typedef struct
55
{
56
    vlc_tick_t i_start;
57
    vlc_tick_t i_stop;
58
    char *psz_id;
59
    char *psz_text;
60
    char *psz_attrs;
61
} webvtt_cue_t;
62
63
static inline void webvtt_cue_Init( webvtt_cue_t *c )
64
0
{
65
0
    memset( c, 0, sizeof(*c) );
66
0
}
Unexecuted instantiation: webvtt.c:webvtt_cue_Init
Unexecuted instantiation: encvtt.c:webvtt_cue_Init
Unexecuted instantiation: subsvtt.c:webvtt_cue_Init
67
68
static inline void webvtt_cue_Clean( webvtt_cue_t *c )
69
122k
{
70
122k
    free( c->psz_attrs );
71
122k
    free( c->psz_text );
72
122k
    free( c->psz_id );
73
122k
}
webvtt.c:webvtt_cue_Clean
Line
Count
Source
69
122k
{
70
122k
    free( c->psz_attrs );
71
122k
    free( c->psz_text );
72
122k
    free( c->psz_id );
73
122k
}
Unexecuted instantiation: encvtt.c:webvtt_cue_Clean
Unexecuted instantiation: subsvtt.c:webvtt_cue_Clean
74
75
webvtt_text_parser_t * webvtt_text_parser_New(
76
            void *priv,
77
            /* parser callback requesting a new cue to fill
78
             * set to NULL if no cues data required */
79
            webvtt_cue_t *(*pf_get_cue)( void * ),
80
            /* callback when cue is complete set to NULL for no callback */
81
            void (*pf_cue_done)( void *, webvtt_cue_t * ),
82
            /* parser callback returning headers
83
             * set to NULL for no callbacks */
84
            void (*pf_header)( void *, enum webvtt_header_line_e, bool, const char * )
85
        );
86
void webvtt_text_parser_Delete( webvtt_text_parser_t *p );
87
void webvtt_text_parser_Feed( webvtt_text_parser_t *p, char *psz_line );
88
89
bool webvtt_scan_time( const char *psz, vlc_tick_t *p_time );
90
91
#endif