Skip to content

Commit 4b249ea

Browse files
committed
upipe_avfilter: factorize main and sub pipe code
1 parent a121c07 commit 4b249ea

File tree

4 files changed

+605
-731
lines changed

4 files changed

+605
-731
lines changed

include/upipe-av/uref_avfilter_flow.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,33 @@ extern "C" {
3535
#endif
3636

3737
#include "upipe/uref_attr.h"
38+
#include "upipe/uref_flow.h"
39+
40+
/** @This define the void flow def prefix. */
41+
#define UREF_AVFILT_FLOW_DEF "avfilt."
3842

3943
UREF_ATTR_STRING(avfilt_flow, name, "avfilt.name", avfilter name)
4044

45+
/** @This allocates a new avfilt flow.
46+
*
47+
* @param mgr uref management structure
48+
* @return pointer to uref void flow
49+
*/
50+
static inline struct uref *uref_avfilt_flow_alloc_def(struct uref_mgr *mgr,
51+
const char *name)
52+
{
53+
struct uref *uref = uref_alloc_control(mgr);
54+
if (unlikely(!uref))
55+
return NULL;
56+
57+
if (unlikely(!ubase_check(uref_flow_set_def(uref, UREF_AVFILT_FLOW_DEF)) ||
58+
!ubase_check(uref_avfilt_flow_set_name(uref, name)))) {
59+
uref_free(uref);
60+
return NULL;
61+
}
62+
return uref;
63+
}
64+
4165
#ifdef __cplusplus
4266
}
4367
#endif

0 commit comments

Comments
 (0)