@@ -53,9 +53,11 @@ const char * avdevice_license(void)
int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type,
void *data, size_t data_size)
{
- if (!s->oformat || !s->oformat->control_message)
- return AVERROR(ENOSYS);
- return s->oformat->control_message(s, type, data, data_size);
+ if (s->oformat && s->oformat->control_message)
+ return s->oformat->control_message(s, type, data, data_size);
+ if (s->iformat && s->iformat->control_message)
+ return s->iformat->control_message(s, type, data, data_size);
+ return AVERROR(ENOSYS);
}
int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type,
@@ -742,6 +742,12 @@ typedef struct AVInputFormat {
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
+ /**
+ * Allows sending messages from application to device.
+ */
+ int (*control_message)(struct AVFormatContext *s, int type,
+ void *data, size_t data_size);
+
/**
* Returns device list with it properties.
* @see avdevice_list_devices() for more details.
Control messages are useful for programmatic control of not only outdevs but also indevs. Bumping avformat version. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> --- libavdevice/avdevice.c | 8 +++++--- libavformat/avformat.h | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-)