[FFmpeg-soc] [soc]: r5924 - in libavfilter: vf_overlay.c vsrc_movie.c

stefano subversion at mplayerhq.hu
Thu Aug 19 11:43:18 CEST 2010


Author: stefano
Date: Thu Aug 19 11:43:18 2010
New Revision: 5924

Log:
Fix overlay filter and movie source, broken after the recent API
changes.

AVFilterBuffer cannot be casted anymore to an AVFrame or an AVPicture,
as the size of the data and linesize arrays changed from 4 to 8.

Modified:
   libavfilter/vf_overlay.c
   libavfilter/vsrc_movie.c

Modified: libavfilter/vf_overlay.c
==============================================================================
--- libavfilter/vf_overlay.c	Wed Aug 18 18:43:09 2010	(r5923)
+++ libavfilter/vf_overlay.c	Thu Aug 19 11:43:18 2010	(r5924)
@@ -204,15 +204,12 @@ static int lower_timestamp(OverlayContex
 static void copy_image_rgb(AVFilterBufferRef *dst, int x, int y,
                            AVFilterBufferRef *src, int w, int h, int bpp)
 {
-    AVPicture pic;
-
-    memcpy(&pic, &dst->data, sizeof(AVPicture));
-    pic.data[0] += x * bpp;
-    pic.data[0] += y * pic.linesize[0];
+    dst->data[0] += x * bpp;
+    dst->data[0] += y * dst->linesize[0];
 
     if (src->format == PIX_FMT_BGRA) {
         for (y = 0; y < h; y++) {
-                  uint8_t *optr = pic.data[0]  + y * pic.linesize[0];
+                  uint8_t *optr = dst->data[0] + y * dst->linesize[0];
             const uint8_t *iptr = src->data[0] + y * src->linesize[0];
             for (x = 0; x < w; x++) {
                 uint8_t a = iptr[3];
@@ -224,7 +221,9 @@ static void copy_image_rgb(AVFilterBuffe
             }
         }
     } else {
-        av_picture_copy(&pic, (AVPicture *)src->data, dst->format, w, h);
+        av_picture_data_copy(dst->data, dst->linesize,
+                             src->data, src->linesize,
+                             dst->format, w, h);
     }
 }
 
@@ -253,20 +252,18 @@ static void copy_image_yuv(AVFilterBuffe
                            AVFilterBufferRef *src, int w, int h,
                            int bpp, int hsub, int vsub)
 {
-    AVPicture pic;
     int i;
 
-    memcpy(&pic, &dst->data, sizeof(AVPicture));
     for(i = 0; i < 4; i ++) {
-        if(pic.data[i]) {
+        if (dst->data[i]) {
             int x_off = x;
             int y_off = y;
             if (i == 1 || i == 2) {
                 x_off >>= hsub;
                 y_off >>= vsub;
             }
-            pic.data[i] += x_off * bpp;
-            pic.data[i] += y_off * pic.linesize[i];
+            dst->data[i] += x_off * bpp;
+            dst->data[i] += y_off * dst->linesize[i];
         }
     }
 
@@ -274,11 +271,11 @@ static void copy_image_yuv(AVFilterBuffe
         int chroma_w = w>>hsub;
         int chroma_h = h>>vsub;
         assert(dst->pic->format == PIX_FMT_YUV420P);
-        copy_blended(pic.data[0], pic.linesize[0], src->data[0], src->linesize[0], src->data[3], src->linesize[3], w, h, 0, 0);
-        copy_blended(pic.data[1], pic.linesize[1], src->data[1], src->linesize[1], src->data[3], src->linesize[3], chroma_w, chroma_h, hsub, vsub);
-        copy_blended(pic.data[2], pic.linesize[2], src->data[2], src->linesize[2], src->data[3], src->linesize[3], chroma_w, chroma_h, hsub, vsub);
+        copy_blended(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], src->data[3], src->linesize[3], w, h, 0, 0);
+        copy_blended(dst->data[1], dst->linesize[1], src->data[1], src->linesize[1], src->data[3], src->linesize[3], chroma_w, chroma_h, hsub, vsub);
+        copy_blended(dst->data[2], dst->linesize[2], src->data[2], src->linesize[2], src->data[3], src->linesize[3], chroma_w, chroma_h, hsub, vsub);
     } else {
-        av_picture_copy(&pic, (AVPicture *)src->data, dst->format, w, h);
+        av_picture_data_copy(dst->data, dst->linesize, src->data, src->linesize, dst->format, w, h);
     }
 }
 

Modified: libavfilter/vsrc_movie.c
==============================================================================
--- libavfilter/vsrc_movie.c	Wed Aug 18 18:43:09 2010	(r5923)
+++ libavfilter/vsrc_movie.c	Thu Aug 19 11:43:18 2010	(r5924)
@@ -189,8 +189,9 @@ static int movie_get_frame(AVFilterLink 
 
             // Did we get a video frame?
             if(frame_finished) {
-                av_picture_copy((AVPicture *)&mv->pic->data, (AVPicture *)mv->frame,
-                                mv->pic->format, link->w, link->h);
+                av_picture_data_copy(mv->pic->data, mv->pic->linesize,
+                                     mv->frame->data, mv->frame->linesize,
+                                     mv->pic->format, link->w, link->h);
 
                 // Advance in the time line
                 mv->pic->pts = av_rescale_q(packet.pts,


More information about the FFmpeg-soc mailing list