[FFmpeg-devel] [PATCH 2/3] lavd: utilize video device callbacks from AVFormatContext

Lukasz Marek lukasz.m.luki at gmail.com
Mon Jan 13 01:41:47 CET 2014


Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
---
 libavdevice/avdevice.c | 19 +++++++++++++++++++
 libavdevice/avdevice.h | 16 ++++++++++++++++
 libavdevice/version.h  |  2 +-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index b9b18f2..d73e052 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -36,3 +36,22 @@ const char * avdevice_license(void)
 #define LICENSE_PREFIX "libavdevice license: "
     return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
+
+int avdevice_external_window_size(struct AVFormatContext *s, int *width, int *height)
+{
+    int result = -1, r_width = 0, r_height = 0;
+    if (s && s->window_size_cb)
+        result = s->window_size_cb(s, &r_width, &r_height);
+    if (width)
+        *width = r_width;
+    if (height)
+        *height = r_height;
+    return result;
+}
+
+int avdevice_swap_external_window_buffers(struct AVFormatContext *s)
+{
+    if (s && s->window_swap_buffers_cb)
+        return s->window_swap_buffers_cb(s);
+    return -1;
+}
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 93a044f..23556b8 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -66,4 +66,20 @@ const char *avdevice_license(void);
  */
 void avdevice_register_all(void);
 
+/**
+ * Call callback to get provided window dimensions.
+ * @param s device context.
+ * @param width window width
+ * @param height window height
+ * @return 0 on success, negative otherwise.
+ */
+int avdevice_external_window_size(struct AVFormatContext *s, int *width, int *height);
+
+/**
+ * Call callback to swap buffers of provided window.
+ * @param s device context.
+ * @return 0 on success, negative otherwise.
+ */
+int avdevice_swap_external_window_buffers(struct AVFormatContext *s);
+
 #endif /* AVDEVICE_AVDEVICE_H */
diff --git a/libavdevice/version.h b/libavdevice/version.h
index d569fae..84f013d 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVDEVICE_VERSION_MAJOR  55
 #define LIBAVDEVICE_VERSION_MINOR   5
-#define LIBAVDEVICE_VERSION_MICRO 102
+#define LIBAVDEVICE_VERSION_MICRO 103
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
                                                LIBAVDEVICE_VERSION_MINOR, \
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list