Skip to content

Commit 123850b

Browse files
committed
upipe_helper_flow_def: add check_flow_def_input
1 parent 4798c26 commit 123850b

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

include/upipe/upipe_helper_flow_def.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/*
22
* Copyright (C) 2013 OpenHeadend S.A.R.L.
3+
* Copyright (C) 2026 EasyTools
34
*
45
* Authors: Christophe Massiot
6+
* Arnaud de Turckheim
57
*
68
* SPDX-License-Identifier: MIT
79
*/
@@ -22,8 +24,8 @@ extern "C" {
2224
#include "upipe/uref_attr.h"
2325
#include "upipe/upipe.h"
2426

25-
/** @This declares six functions dealing with the management of flow definitions
26-
* in linear pipes.
27+
/** @This declares functions dealing with the management of flow definitions in
28+
* linear pipes.
2729
*
2830
* You must add two members to your private upipe structure, for instance:
2931
* @code
@@ -64,6 +66,12 @@ extern "C" {
6466
* a new global header). Returns the new flow definition of the pipe.
6567
*
6668
* @item @code
69+
* bool upipe_foo_check_flow_def_input(struct upipe *upipe,
70+
* struct uref *flow_def_input)
71+
* @end code
72+
* Checks a new input flow definitions atributes packet against the stored one.
73+
*
74+
* @item @code
6775
* struct uref *upipe_foo_store_flow_def_input(struct upipe *upipe,
6876
* struct uref *flow_def_input)
6977
* @end code
@@ -156,6 +164,21 @@ static UBASE_UNUSED inline struct uref * \
156164
s->FLOW_DEF_ATTR = flow_def_attr; \
157165
return STRUCTURE##_make_flow_def(upipe); \
158166
} \
167+
/** @internal @This checks a flow definition attributes packet against the \
168+
* stored input flow def attributes uref. \
169+
* \
170+
* @param upipe description structure of the pipe \
171+
* @param flow_def_attr new flow def attributes packet \
172+
* @return false if the flow def attributes packets are different \
173+
*/ \
174+
static UBASE_UNUSED bool \
175+
STRUCTURE##_check_flow_def_input(struct upipe *upipe, \
176+
struct uref *flow_def_attr) \
177+
{ \
178+
struct STRUCTURE *s = STRUCTURE##_from_upipe(upipe); \
179+
return s->FLOW_DEF_INPUT != NULL && \
180+
!udict_cmp(s->FLOW_DEF_INPUT->udict, flow_def_attr->udict); \
181+
} \
159182
/** @internal @This stores a flow def input uref, and returns the new flow \
160183
* definition. \
161184
* \

0 commit comments

Comments
 (0)