Skip to content

Commit f2ad50c

Browse files
quariumChristophe Massiot
authored andcommitted
scte/35: add avail splice descriptor helpers
1 parent 62415e8 commit f2ad50c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

scte/35.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,38 @@ static inline void scte35_splice_desc_set_identifier(uint8_t *p_desc,
696696
p_desc[5] = identifier & 0xff;
697697
}
698698

699+
/*****************************************************************************
700+
* Splice Information Table - avail descriptor
701+
*****************************************************************************/
702+
#define SCTE35_AVAIL_DESC_HEADER_SIZE 4
703+
704+
static inline void scte35_avail_desc_init(uint8_t *p_desc)
705+
{
706+
scte35_splice_desc_set_tag(p_desc, SCTE35_SPLICE_DESC_TAG_AVAIL);
707+
scte35_splice_desc_set_length(p_desc,
708+
SCTE35_SPLICE_DESC_HEADER_SIZE -
709+
DESC_HEADER_SIZE +
710+
SCTE35_AVAIL_DESC_HEADER_SIZE);
711+
scte35_splice_desc_set_identifier(p_desc, SCTE35_SPLICE_DESC_IDENTIFIER);
712+
p_desc[10] = 0x7f;
713+
}
714+
715+
static inline uint32_t
716+
scte35_avail_desc_get_provider_avail_id(const uint8_t *p_desc)
717+
{
718+
return ((uint32_t)p_desc[6] << 24) | (p_desc[7] << 16) |
719+
(p_desc[8] << 8) | p_desc[9];
720+
}
721+
722+
static inline void scte35_avail_desc_set_provider_avail_id(uint8_t *p_desc,
723+
uint32_t id)
724+
{
725+
p_desc[6] = (id >> 24) & 0xff;
726+
p_desc[7] = (id >> 16) & 0xff;
727+
p_desc[8] = (id >> 8) & 0xff;
728+
p_desc[9] = id & 0xff;
729+
}
730+
699731
/*****************************************************************************
700732
* Splice Information Table - segmentation descriptor
701733
*****************************************************************************/

0 commit comments

Comments
 (0)