[FFmpeg-soc] [soc]: r1867 - in libavfilter: avfilter.c diffs/04_ffmpeg_filters.diff

vitor subversion at mplayerhq.hu
Sat Feb 9 12:03:35 CET 2008


Author: vitor
Date: Sat Feb  9 12:03:35 2008
New Revision: 1867

Log:
The filter framework as is hangs with filters that 
modify the input buffer, even if it asks for the right 
permission. This is a fix for that.
See "Box blurring with libavfilter" thread in libav-user.


Modified:
   libavfilter/avfilter.c
   libavfilter/diffs/04_ffmpeg_filters.diff

Modified: libavfilter/avfilter.c
==============================================================================
--- libavfilter/avfilter.c	(original)
+++ libavfilter/avfilter.c	Sat Feb  9 12:03:35 2008
@@ -213,10 +213,12 @@ void avfilter_start_frame(AVFilterLink *
     /* prepare to copy the picture if it has insufficient permissions */
     if((link_dpad(link).min_perms & picref->perms) != link_dpad(link).min_perms ||
         link_dpad(link).rej_perms & picref->perms) {
+        /*
         av_log(link->dst, AV_LOG_INFO,
                 "frame copy needed (have perms %x, need %x, reject %x)\n",
                 picref->perms,
                 link_dpad(link).min_perms, link_dpad(link).rej_perms);
+        */
 
         link->cur_pic = avfilter_default_get_video_buffer(link, link_dpad(link).min_perms);
         link->srcpic = picref;
@@ -231,6 +233,11 @@ void avfilter_end_frame(AVFilterLink *li
 {
     void (*end_frame)(AVFilterLink *);
 
+    if(!(end_frame = link_dpad(link).end_frame))
+        end_frame = avfilter_default_end_frame;
+
+    end_frame(link);
+
     /* unreference the source picture if we're feeding the destination filter
      * a copied version dues to permission issues */
     if(link->srcpic) {
@@ -238,10 +245,6 @@ void avfilter_end_frame(AVFilterLink *li
         link->srcpic = NULL;
     }
 
-    if(!(end_frame = link_dpad(link).end_frame))
-        end_frame = avfilter_default_end_frame;
-
-    end_frame(link);
 }
 
 void avfilter_draw_slice(AVFilterLink *link, int y, int h)
@@ -253,6 +256,7 @@ void avfilter_draw_slice(AVFilterLink *l
     if(link->srcpic) {
         avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
 
+        link->cur_pic->pts = link->srcpic->pts;
         src[0] = link->srcpic-> data[0] + y * link->srcpic-> linesize[0];
         dst[0] = link->cur_pic->data[0] + y * link->cur_pic->linesize[0];
         for(i = 1; i < 4; i ++) {

Modified: libavfilter/diffs/04_ffmpeg_filters.diff
==============================================================================
--- libavfilter/diffs/04_ffmpeg_filters.diff	(original)
+++ libavfilter/diffs/04_ffmpeg_filters.diff	Sat Feb  9 12:03:35 2008
@@ -38,7 +38,7 @@ Index: ffmpeg.c
  } AVInputStream;
  
  typedef struct AVInputFile {
-@@ -290,6 +305,268 @@
+@@ -290,6 +305,271 @@
  static struct termios oldtty;
  #endif
  
@@ -76,7 +76,10 @@ Index: ffmpeg.c
 +    FilterInPriv *priv = link->src->priv;
 +    AVFilterPicRef *picref;
 +
-+    picref = avfilter_get_video_buffer(link, AV_PERM_WRITE);
++    /* This picture will be needed unmodified later for decoding the next
++     * frame */
++    picref = avfilter_get_video_buffer(link, AV_PERM_PRESERVE |
++                                             AV_PERM_REUSE2);
 +
 +    memcpy(picref->data,     priv->ist->filter_frame->data,
 +           sizeof(priv->ist->filter_frame->data));
@@ -307,7 +310,7 @@ Index: ffmpeg.c
  static void term_exit(void)
  {
  #ifdef HAVE_TERMIOS_H
-@@ -745,6 +1022,9 @@
+@@ -745,6 +1025,9 @@
      if (nb_frames <= 0)
          return;
  
@@ -317,7 +320,7 @@ Index: ffmpeg.c
      if (ost->video_crop) {
          if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) {
              av_log(NULL, AV_LOG_ERROR, "error cropping picture\n");
-@@ -754,6 +1034,7 @@
+@@ -754,6 +1037,7 @@
      } else {
          formatted_picture = in_picture;
      }
@@ -325,7 +328,7 @@ Index: ffmpeg.c
  
      final_picture = formatted_picture;
      padding_src = formatted_picture;
-@@ -769,12 +1050,14 @@
+@@ -769,12 +1053,14 @@
          }
      }
  
@@ -340,7 +343,7 @@ Index: ffmpeg.c
  
      if (ost->video_pad) {
          av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src,
-@@ -1154,6 +1437,17 @@
+@@ -1154,6 +1440,17 @@
                                      &buffer_to_free);
          }
  
@@ -358,7 +361,7 @@ Index: ffmpeg.c
          // preprocess audio (volume)
          if (ist->st->codec->codec_type == CODEC_TYPE_AUDIO) {
              if (audio_volume != 256) {
-@@ -1216,10 +1510,22 @@
+@@ -1216,10 +1513,22 @@
                              do_audio_out(os, ost, ist, data_buf, data_size);
                              break;
                          case CODEC_TYPE_VIDEO:
@@ -381,7 +384,7 @@ Index: ffmpeg.c
                              break;
                          case CODEC_TYPE_SUBTITLE:
                              do_subtitle_out(os, ost, ist, &subtitle,
-@@ -1680,10 +1986,21 @@
+@@ -1680,10 +1989,21 @@
                          fprintf(stderr, "Cannot get resampling context\n");
                          exit(1);
                      }
@@ -403,7 +406,7 @@ Index: ffmpeg.c
                  break;
              case CODEC_TYPE_SUBTITLE:
                  ost->encoding_needed = 1;
-@@ -3782,6 +4099,9 @@
+@@ -3782,6 +4102,9 @@
  #ifdef CONFIG_VHOOK
      { "vhook", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)add_frame_hooker}, "insert video processing module", "module" },
  #endif



More information about the FFmpeg-soc mailing list