]> git.sesse.net Git - ffmpeg/blobdiff - vhook/imlib2.c
dependency handling is consistant with libavcodec
[ffmpeg] / vhook / imlib2.c
index fcc09e17f36f8cc6006edc26e8bbef001420db4e..7da3586feebeb3883a109c700bf93fb397375814 100644 (file)
@@ -72,6 +72,19 @@ typedef struct _CachedImage {
     int height;
 } CachedImage;
 
+void Release(void *ctx)
+{
+    ContextInfo *ci;
+    ci = (ContextInfo *) ctx;
+
+    if (ci->cache) {
+        imlib_context_set_image(ci->cache->image);
+        imlib_free_image();
+        av_free(ci->cache);
+    }
+    if (ctx)
+        av_free(ctx);
+}
 
 int Configure(void **ctxp, int argc, char *argv[])
 {
@@ -197,9 +210,9 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
     imlib_context_set_image(image);
     data = imlib_image_get_data();
 
-    if (pix_fmt != PIX_FMT_BGRA32) {
-        avpicture_fill(&picture1, (UINT8 *) data, PIX_FMT_BGRA32, width, height);
-        if (img_convert(&picture1, PIX_FMT_BGRA32, 
+    if (pix_fmt != PIX_FMT_RGBA32) {
+        avpicture_fill(&picture1, (UINT8 *) data, PIX_FMT_RGBA32, width, height);
+        if (img_convert(&picture1, PIX_FMT_RGBA32, 
                         picture, pix_fmt, width, height) < 0) {
             goto done;
         }
@@ -251,9 +264,9 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
         }
     }
 
-    if (pix_fmt != PIX_FMT_BGRA32) {
+    if (pix_fmt != PIX_FMT_RGBA32) {
         if (img_convert(picture, pix_fmt, 
-                        &picture1, PIX_FMT_BGRA32, width, height) < 0) {
+                        &picture1, PIX_FMT_RGBA32, width, height) < 0) {
         }
     }
 
@@ -261,6 +274,3 @@ done:
     ;
 }
 
-/* To ensure correct typing */
-FrameHookConfigureFn ConfigureFn = Configure;
-FrameHookProcessFn ProcessFn = Process;