[FFmpeg-devel] [PATCH v4 03/22] avformat: add control_message function to AVInputFormat
Diederick Niehorster
dcnieho at gmail.com
Fri Mar 25 16:10:22 EET 2022
Control messages are useful for programmatic control of not only outdevs
but also indevs.
Bumping avformat version.
Signed-off-by: Diederick Niehorster <dcnieho at gmail.com>
---
libavdevice/avdevice.c | 8 +++++---
libavformat/avformat.h | 6 ++++++
libavformat/version.h | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index 9b684251aa..617c28d725 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -66,9 +66,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,
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 350912e272..06db024559 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -785,6 +785,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.
diff --git a/libavformat/version.h b/libavformat/version.h
index ac14f8eb37..af5e2c496c 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 21
+#define LIBAVFORMAT_VERSION_MINOR 22
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
--
2.28.0.windows.1
More information about the ffmpeg-devel
mailing list