imlib2 vhook rgba fix by ("Todd.Kirby" <doubleshot at pacbell dot net>)
[libav.git] / vhook / imlib2.c
index d569c80..4465cc3 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#include "framehook.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
+#undef time
 #include <sys/time.h>
+#include <time.h>
 #include <X11/Xlib.h>
 #include <Imlib2.h>                                                             
 
-#include "framehook.h"
-
 typedef struct {
     int dummy;
     Imlib_Font fn;
@@ -210,14 +213,14 @@ 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_RGBA32) {
         avpicture_fill(&picture1, (uint8_t *) data, PIX_FMT_RGBA32, width, height);
+    if (pix_fmt != PIX_FMT_RGBA32) {
         if (img_convert(&picture1, PIX_FMT_RGBA32, 
                         picture, pix_fmt, width, height) < 0) {
             goto done;
         }
     } else {
-        av_abort();
+        img_copy(&picture1, picture, PIX_FMT_RGBA32, width, height); 
     }
 
     imlib_image_set_has_alpha(0);
@@ -268,6 +271,8 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
         if (img_convert(picture, pix_fmt, 
                         &picture1, PIX_FMT_RGBA32, width, height) < 0) {
         }
+    } else {
+        img_copy(picture, &picture1, PIX_FMT_RGBA32, width, height); 
     }
 
 done: