demux: mp4: avoid audio cuts on seek
[vlc.git] / modules / codec / scte18.h
blobe0f46750d26ad60ee40f78c3f707dbd469dcb291
1 /*****************************************************************************
2 * scte18.h : SCTE-18 EAS decoder
3 *****************************************************************************
4 * Copyright (C) 2016 - VideoLAN Authors
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.
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.
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
22 #define SCTE18_SI_BASE_PID 0x1FFB
23 #define SCTE18_TABLE_ID 0xD8
24 #define SCTE18_DESCRIPTION N_("Emergency Alert Messaging for Cable")
26 enum
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
35 /* Get priority without decoding
37 static inline int scte18_get_EAS_priority( const uint8_t *p_buffer, size_t i_buffer )
39 if( i_buffer < 17 || p_buffer[0] )
40 return -1;
42 size_t i_offset = 6;
43 size_t i_len = p_buffer[i_offset]; /* EAS code Len */
44 i_offset += i_len + 1; /* EAS code Text */
45 if( i_offset >= i_buffer )
46 return -1;
48 i_len = p_buffer[i_offset]; /* NOA Len */
49 i_offset += i_len + 1; /* NOA Text */
51 i_offset += 1 + 4 + 2 + 1;
53 if( i_offset >= i_buffer )
54 return -1;
56 return (p_buffer[i_offset] & 0x0f);
59 #endif