11/*
22 * Copyright (C) 2018 OpenHeadend S.A.R.L.
3- * Copyright (C) 2019-2020 EasyTools
3+ * Copyright (C) 2019-2025 EasyTools
44 *
55 * Authors: Clément Vasseur
66 * Arnaud de Turckheim
@@ -49,6 +49,9 @@ enum upipe_avfilt_command {
4949 UPIPE_AVFILT_SET_FILTERS_DESC ,
5050 /** set the hardware config (const char *, const char *) */
5151 UPIPE_AVFILT_SET_HW_CONFIG ,
52+ /** sends a command to one or more filter instances
53+ (const char *, const char *, const char *) */
54+ UPIPE_AVFILT_SEND_COMMAND ,
5255};
5356
5457/** @This converts @ref upipe_avfilt_command to a string.
@@ -61,6 +64,7 @@ static inline const char *upipe_avfilt_command_str(int command)
6164 switch ((enum upipe_avfilt_command )command ) {
6265 UBASE_CASE_TO_STR (UPIPE_AVFILT_SET_FILTERS_DESC );
6366 UBASE_CASE_TO_STR (UPIPE_AVFILT_SET_HW_CONFIG );
67+ UBASE_CASE_TO_STR (UPIPE_AVFILT_SEND_COMMAND );
6468 case UPIPE_AVFILT_SENTINEL : break ;
6569 }
6670 return NULL ;
@@ -95,6 +99,46 @@ static inline int upipe_avfilt_set_hw_config(struct upipe *upipe,
9599 hw_type , hw_device );
96100}
97101
102+ /** @This sends a command to one or more filter instances
103+ *
104+ * @param upipe description structure of the pipe
105+ * @param target the filter(s) to which the command should be sent "all" sends
106+ * to all filters otherwise it can be a filter or filter instance name which
107+ * will send the command to all matching filters.
108+ * @param command the command to send
109+ * @param arg the arguments of the command
110+ * @return an error code
111+ */
112+ static inline int upipe_avfilt_send_command (struct upipe * upipe ,
113+ const char * target ,
114+ const char * command ,
115+ const char * arg )
116+ {
117+ return upipe_control (upipe , UPIPE_AVFILT_SEND_COMMAND ,
118+ UPIPE_AVFILT_SIGNATURE ,
119+ target , command , arg );
120+ }
121+
122+ /** @This sends a command to one or more filter instances
123+ *
124+ * @param upipe description structure of the pipe
125+ * @param target the filter(s) to which the command should be sent "all" sends
126+ * to all filters otherwise it can be a filter or filter instance name which
127+ * will send the command to all matching filters.
128+ * @param command the command to send
129+ * @param format the arguments format string of the command
130+ * @return an error code
131+ */
132+ UBASE_FMT_PRINTF (4 , 5 )
133+ static inline int upipe_avfilt_send_command_va (struct upipe * upipe ,
134+ const char * target ,
135+ const char * command ,
136+ const char * format , ...)
137+ {
138+ UBASE_VARARG (upipe_avfilt_send_command (upipe , target , command , string ),
139+ UBASE_ERR_INVALID );
140+ }
141+
98142/** @This returns the management structure for all avfilter pipes.
99143 *
100144 * @return pointer to manager
0 commit comments