Skip to content

Commit 9a6114a

Browse files
committed
upipe_avfilter: factorize main and sub pipe code
1 parent a121c07 commit 9a6114a

File tree

4 files changed

+608
-731
lines changed

4 files changed

+608
-731
lines changed

include/upipe-av/uref_avfilter_flow.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,31 @@ extern "C" {
3636

3737
#include "upipe/uref_attr.h"
3838

39+
/** @This define the void flow def prefix. */
40+
#define UREF_AVFILT_FLOW_DEF "avfilt."
41+
3942
UREF_ATTR_STRING(avfilt_flow, name, "avfilt.name", avfilter name)
4043

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

0 commit comments

Comments
 (0)