]> git.sesse.net Git - ffmpeg/commitdiff
lavd: add avdevice_app_to_dev_control_message API
authorLukasz Marek <lukasz.m.luki@gmail.com>
Sun, 19 Jan 2014 15:11:09 +0000 (16:11 +0100)
committerLukasz Marek <lukasz.m.luki@gmail.com>
Mon, 27 Jan 2014 14:18:17 +0000 (15:18 +0100)
New API allows to send messages from application to devices.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
libavdevice/avdevice.c
libavdevice/avdevice.h
libavdevice/version.h
libavformat/avformat.h
libavformat/version.h

index b9b18f2576f713fee0df5e1d200ac07c40323c99..c232bbdc8f8d9bf644da868bde42f8621a4c58a7 100644 (file)
@@ -36,3 +36,11 @@ const char * avdevice_license(void)
 #define LICENSE_PREFIX "libavdevice license: "
     return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
+
+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);
+}
index 93a044f27078bd06c9a7dae7f8c380d96530a014..1bc91e4d0fe7f0f0cae70630a05018cf92035beb 100644 (file)
@@ -66,4 +66,56 @@ const char *avdevice_license(void);
  */
 void avdevice_register_all(void);
 
+typedef struct AVDeviceRect {
+    int x;      /**< x coordinate of top left corner */
+    int y;      /**< y coordinate of top left corner */
+    int width;  /**< width */
+    int height; /**< height */
+} AVDeviceRect;
+
+/**
+ * Message types used by avdevice_app_to_dev_control_message().
+ */
+enum AVAppToDevMessageType {
+    /**
+     * Dummy message.
+     */
+    AV_APP_TO_DEV_NONE = MKBETAG('N','O','N','E'),
+
+    /**
+     * Window size change message.
+     *
+     * Message is sent to the device every time the application changes the size
+     * of the window device renders to.
+     * Message should also be sent right after window is created.
+     *
+     * data: AVDeviceRect: new window size.
+     */
+    AV_APP_TO_DEV_WINDOW_SIZE = MKBETAG('G','E','O','M'),
+
+    /**
+     * Repaint request message.
+     *
+     * Message is sent to the device when window have to be rapainted.
+     *
+     * data: AVDeviceRect: area required to be repainted.
+     *       NULL: whole area is required to be repainted.
+     */
+    AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R','E','P','A')
+};
+
+/**
+ * Send control message from application to device.
+ *
+ * @param s         device context.
+ * @param type      message type.
+ * @param data      message data. Exact type depends on message type.
+ * @param data_size size of message data.
+ * @return >= 0 on success, negative on error.
+ *         AVERROR(ENOSYS) when device doesn't implement handler of the message.
+ */
+int avdevice_app_to_dev_control_message(struct AVFormatContext *s,
+                                        enum AVAppToDevMessageType type,
+                                        void *data, size_t data_size);
+
 #endif /* AVDEVICE_AVDEVICE_H */
index d569faefc58bb4fe41e2b9233da1f19db94e7c20..bfd4a7089d6335ca13193d967860d1031f4ad789 100644 (file)
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVDEVICE_VERSION_MAJOR  55
-#define LIBAVDEVICE_VERSION_MINOR   5
-#define LIBAVDEVICE_VERSION_MICRO 102
+#define LIBAVDEVICE_VERSION_MINOR   6
+#define LIBAVDEVICE_VERSION_MICRO 100
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
                                                LIBAVDEVICE_VERSION_MINOR, \
index a495ee0b794fadf2e58ff021065ba3539a3cf090..09eea74ad91be3fc90846ac0b95986e60e0c443f 100644 (file)
@@ -453,6 +453,11 @@ typedef struct AVOutputFormat {
 
     void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
                                  int64_t *dts, int64_t *wall);
+    /**
+     * Allows sending messages from application to device.
+     */
+    int (*control_message)(struct AVFormatContext *s, int type,
+                           void *data, size_t data_size);
 } AVOutputFormat;
 /**
  * @}
index a0e5a7cee938c0f56e55a1c59ef75deea7f28ac2..51f6d598d92af2b1161d3f907af40fce94a3464e 100644 (file)
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 55
-#define LIBAVFORMAT_VERSION_MINOR 26
+#define LIBAVFORMAT_VERSION_MINOR 27
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \