diff mbox series

[FFmpeg-devel,11/35] avformat: add control_message function to AVInputFormat

Message ID 20210607230414.612-12-dcnieho@gmail.com
State Superseded, archived
Headers show
Series avdevice (mostly dshow) enhancements | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Diederick C. Niehorster June 7, 2021, 11:03 p.m. UTC
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 ++++++
 libavformat/version.h  | 4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

Comments

Nicolas George June 8, 2021, noon UTC | #1
Diederick Niehorster (12021-06-08):
> 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 ++++++
>  libavformat/version.h  | 4 ++--
>  3 files changed, 13 insertions(+), 5 deletions(-)

Looks good to me thanks.

Maybe wrap the commit message at 60 columns.

Regards,
Diederick C. Niehorster June 8, 2021, 8:25 p.m. UTC | #2
On Tue, Jun 8, 2021 at 2:00 PM Nicolas George <george@nsup.org> wrote:
> Maybe wrap the commit message at 60 columns.

Will do
diff mbox series

Patch

diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index 4a40929007..e339cebf2d 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -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,
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index a28ac372da..adbdd712a7 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -737,6 +737,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 5de0814316..7f02e18f24 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@ 
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   2
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR   3
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \