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 *****************************************************************************/
22 #define SCTE18_SI_BASE_PID 0x1FFB
23 #define SCTE18_TABLE_ID 0xD8
24 #define SCTE18_DESCRIPTION N_("Emergency Alert Messaging for Cable")
28 EAS_PRIORITY_TEST
= 0,
30 EAS_PRIORITY_MEDIUM
= 7,
31 EAS_PRIORITY_HIGH
= 11,
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] )
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
)
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
)
56 return (p_buffer
[i_offset
] & 0x0f);