1313#include "upipe/upipe_helper_sync.h"
1414#include "upipe/upipe_helper_uref_stream.h"
1515#include "upipe/upipe_helper_flow_def.h"
16+ #include "upipe/upipe_helper_flow_format.h"
1617#include "upipe/upipe_helper_upump.h"
1718
1819struct upipe_helper_mgr {
@@ -24,10 +25,13 @@ struct upipe_helper_mgr {
2425 upipe_helper_uclock_check uclock_check ;
2526
2627 // uref_mgr
27- upipe_helper_uref_mgr_check uref_check ;
28+ upipe_helper_uref_mgr_check uref_mgr_check ;
2829
2930 // ubuf_mgr
30- upipe_helper_ubuf_mgr_check ubuf_check ;
31+ upipe_helper_ubuf_mgr_check ubuf_mgr_check ;
32+
33+ // flow_format
34+ upipe_helper_flow_format_check flow_format_check ;
3135
3236 // input
3337 bool (* output )(struct upipe * , struct uref * , struct upump * * );
@@ -95,6 +99,9 @@ struct upipe_helper {
9599 struct uref * flow_def_input ;
96100 struct uref * flow_def_attr ;
97101
102+ // flow_format
103+ struct urequest flow_format_request ;
104+
98105 // upump
99106 struct upump * upump ;
100107};
@@ -135,28 +142,39 @@ static int check_uclock(struct upipe *upipe, struct uref *uref)
135142 return UBASE_ERR_NONE ;
136143}
137144
138- static int check_uref (struct upipe * upipe , struct uref * uref )
145+ static int check_uref_mgr (struct upipe * upipe , struct uref * uref )
139146{
140147 struct upipe_helper_mgr * mgr = upipe_helper_mgr (upipe );
141148
142- if (mgr -> uref_check != NULL )
143- return mgr -> uref_check (upipe , uref );
149+ if (mgr -> uref_mgr_check != NULL )
150+ return mgr -> uref_mgr_check (upipe , uref );
144151
145152 uref_free (uref );
146153 return UBASE_ERR_NONE ;
147154}
148155
149- static int check_ubuf (struct upipe * upipe , struct uref * uref )
156+ static int check_ubuf_mgr (struct upipe * upipe , struct uref * uref )
150157{
151158 struct upipe_helper_mgr * mgr = upipe_helper_mgr (upipe );
152159
153- if (mgr -> ubuf_check != NULL )
154- return mgr -> ubuf_check (upipe , uref );
160+ if (mgr -> ubuf_mgr_check != NULL )
161+ return mgr -> ubuf_mgr_check (upipe , uref );
155162
156163 uref_free (uref );
157164 return UBASE_ERR_NONE ;
158165}
159166
167+ static int check_flow_format (struct upipe * upipe , struct uref * flow_format )
168+ {
169+ struct upipe_helper_mgr * mgr = upipe_helper_mgr (upipe );
170+
171+ if (mgr -> flow_format_check != NULL )
172+ return mgr -> flow_format_check (upipe , flow_format );
173+
174+ uref_free (flow_format );
175+ return UBASE_ERR_NONE ;
176+ }
177+
160178static void append_cb (struct upipe * upipe )
161179{
162180 struct upipe_helper_mgr * mgr = upipe_helper_mgr (upipe );
@@ -179,11 +197,11 @@ UPIPE_HELPER_UCLOCK(upipe_helper, uclock, uclock_request,
179197 upipe_helper_unregister_output_request );
180198UPIPE_HELPER_UPUMP_MGR (upipe_helper , upump_mgr );
181199UPIPE_HELPER_UREF_MGR (upipe_helper , uref_mgr , uref_mgr_request ,
182- check_uref ,
200+ check_uref_mgr ,
183201 upipe_helper_register_output_request ,
184202 upipe_helper_unregister_output_request );
185203UPIPE_HELPER_UBUF_MGR (upipe_helper , ubuf_mgr , flow_format , ubuf_mgr_request ,
186- check_ubuf ,
204+ check_ubuf_mgr ,
187205 upipe_helper_register_output_request ,
188206 upipe_helper_unregister_output_request );
189207UPIPE_HELPER_INNER (upipe_helper , first_inner );
@@ -194,4 +212,8 @@ UPIPE_HELPER_SYNC(upipe_helper, acquired);
194212UPIPE_HELPER_UREF_STREAM (upipe_helper , next_uref , next_uref_size , stream_urefs ,
195213 append_cb );
196214UPIPE_HELPER_FLOW_DEF (upipe_helper , flow_def_input , flow_def_attr );
215+ UPIPE_HELPER_FLOW_FORMAT (upipe_helper , flow_format_request ,
216+ check_flow_format ,
217+ upipe_helper_register_output_request ,
218+ upipe_helper_unregister_output_request );
197219UPIPE_HELPER_UPUMP (upipe_helper , upump , upump_mgr );
0 commit comments