Skip to content

Commit d9e6af6

Browse files
committed
vancd: handle rfc8331 peculiarities
1 parent be1be40 commit d9e6af6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/upipe-modules/upipe_vanc_decoder.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ struct upipe_vanc_decoder {
5959
struct urequest ubuf_mgr_request;
6060
/** ubuf flow format */
6161
struct uref *flow_format;
62+
63+
/* rfc8331 format */
64+
bool rfc8331;
6265
};
6366

6467
UPIPE_HELPER_UPIPE(upipe_vanc_decoder, upipe, UPIPE_VANC_DECODER_SIGNATURE);
@@ -145,13 +148,15 @@ static void upipe_vanc_decoder_input(struct upipe *upipe,
145148
ubits_init(&s, (uint8_t*)r, end, UBITS_READ);
146149

147150
while (end >= 9) {
148-
if (ubits_get(&s, 6))
151+
if (!vancd->rfc8331 && ubits_get(&s, 6))
149152
goto ret;
150153

151154
bool c_not_y = ubits_get(&s, 1);
152155

153156
unsigned line = ubits_get(&s, 11);
154157
unsigned offset = ubits_get(&s, 12);
158+
if (vancd->rfc8331) /* skip Stream_Num */
159+
ubits_get(&s, 8);
155160
uint16_t did = ubits_get(&s, 10);
156161
uint16_t sdid = ubits_get(&s, 10);
157162
uint16_t dc = ubits_get(&s, 10);
@@ -241,7 +246,12 @@ static void upipe_vanc_decoder_input(struct upipe *upipe,
241246
static int upipe_vanc_decoder_set_flow_def(struct upipe *upipe,
242247
struct uref *flow_def)
243248
{
244-
UBASE_RETURN(uref_flow_match_def(flow_def, "block.vanc.pic."));
249+
250+
struct upipe_vanc_decoder *vancd = upipe_vanc_decoder_from_upipe(upipe);
251+
252+
vancd->rfc8331 = ubase_check(uref_flow_match_def(flow_def, "block.vanc.rfc8331.pic."));
253+
if (!ubase_check(uref_flow_match_def(flow_def, "block.vanc.pic.")) && !vancd->rfc8331)
254+
return UBASE_ERR_UNHANDLED;
245255

246256
flow_def = uref_sibling_alloc(flow_def);
247257
if (unlikely(flow_def == NULL)) {

0 commit comments

Comments
 (0)