Coverage Report

Created: 2026-02-05 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/modules/codec/scte18.h
Line
Count
Source
1
/*****************************************************************************
2
 * scte18.h : SCTE-18 EAS decoder
3
 *****************************************************************************
4
 * Copyright (C) 2016 - VideoLAN Authors
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 General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 *****************************************************************************/
19
#ifndef VLC_SCTE18_H
20
#define VLC_SCTE18_H
21
22
#define SCTE18_SI_BASE_PID 0x1FFB
23
#define SCTE18_TABLE_ID    0xD8
24
#define SCTE18_DESCRIPTION N_("Emergency Alert Messaging for Cable")
25
26
enum
27
{
28
    EAS_PRIORITY_TEST = 0,
29
    EAS_PRIORITY_LOW = 3,
30
    EAS_PRIORITY_MEDIUM = 7,
31
    EAS_PRIORITY_HIGH = 11,
32
    EAS_PRIORITY_MAX = 15
33
};
34
35
/* Get priority without decoding
36
 */
37
static inline int scte18_get_EAS_priority( const uint8_t *p_buffer, size_t i_buffer )
38
0
{
39
0
    if( i_buffer < 17 || p_buffer[0] )
40
0
        return -1;
41
0
42
0
    size_t i_offset = 6;
43
0
    size_t i_len = p_buffer[i_offset]; /* EAS code Len */
44
0
    i_offset += i_len + 1; /* EAS code Text */
45
0
    if( i_offset >= i_buffer )
46
0
        return -1;
47
0
48
0
    i_len = p_buffer[i_offset]; /* NOA Len */
49
0
    i_offset += i_len + 1; /* NOA Text */
50
0
51
0
    i_offset += 1 + 4 + 2 + 1;
52
0
53
0
    if( i_offset >= i_buffer )
54
0
        return -1;
55
0
56
0
    return (p_buffer[i_offset] & 0x0f);
57
0
}
58
59
#endif