Try to keep track of interlaced and top field first.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 7 May 2010 10:02:59 +0000 (10:02 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 7 May 2010 10:02:59 +0000 (10:02 +0000)
Originally committed as revision 23044 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/defaults.c
libavfilter/vf_scale.c
libavfilter/vsrc_buffer.c

index 3ed59d7..38ca3b1 100644 (file)
@@ -266,6 +266,8 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
         link->cur_pic->pts = link->srcpic->pts;
         link->cur_pic->pos = link->srcpic->pos;
         link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;
         link->cur_pic->pts = link->srcpic->pts;
         link->cur_pic->pos = link->srcpic->pos;
         link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;
+        link->cur_pic->interlaced      = link->srcpic->interlaced;
+        link->cur_pic->top_field_first = link->srcpic->top_field_first;
     }
     else
         link->cur_pic = picref;
     }
     else
         link->cur_pic = picref;
index 214b8d4..3566ed6 100644 (file)
@@ -115,6 +115,9 @@ typedef struct AVFilterPicRef
 #define AV_PERM_PRESERVE 0x04   ///< nobody else can overwrite the buffer
 #define AV_PERM_REUSE    0x08   ///< can output the buffer multiple times, with the same contents each time
 #define AV_PERM_REUSE2   0x10   ///< can output the buffer multiple times, modified each time
 #define AV_PERM_PRESERVE 0x04   ///< nobody else can overwrite the buffer
 #define AV_PERM_REUSE    0x08   ///< can output the buffer multiple times, with the same contents each time
 #define AV_PERM_REUSE2   0x10   ///< can output the buffer multiple times, modified each time
+
+    int interlaced;             ///< is frame interlaced
+    int top_field_first;
 } AVFilterPicRef;
 
 /**
 } AVFilterPicRef;
 
 /**
index afa0f66..f348d4f 100644 (file)
@@ -76,6 +76,8 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
         out->outpic->pts = picref->pts;
         out->outpic->pos = picref->pos;
         out->outpic->pixel_aspect = picref->pixel_aspect;
         out->outpic->pts = picref->pts;
         out->outpic->pos = picref->pos;
         out->outpic->pixel_aspect = picref->pixel_aspect;
+        out->outpic->interlaced      = picref->interlaced;
+        out->outpic->top_field_first = picref->top_field_first;
         avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
     }
 }
         avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
     }
 }
index 7a0994f..e65057c 100644 (file)
@@ -150,6 +150,9 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
     outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
     outpicref->pts = picref->pts;
     outpicref->pos = picref->pos;
     outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
     outpicref->pts = picref->pts;
     outpicref->pos = picref->pos;
+    outpicref->interlaced           = picref->interlaced;
+    outpicref->top_field_first      = picref->top_field_first;
+
     outlink->outpic = outpicref;
 
     av_reduce(&outpicref->pixel_aspect.num, &outpicref->pixel_aspect.den,
     outlink->outpic = outpicref;
 
     av_reduce(&outpicref->pixel_aspect.num, &outpicref->pixel_aspect.den,
index 74da712..17e56ee 100644 (file)
@@ -46,6 +46,8 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
 
     memcpy(c->frame.data    , frame->data    , sizeof(frame->data));
     memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));
 
     memcpy(c->frame.data    , frame->data    , sizeof(frame->data));
     memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize));
+    c->frame.interlaced_frame= frame->interlaced_frame;
+    c->frame.top_field_first = frame->top_field_first;
     c->pts = pts;
     c->pixel_aspect = pixel_aspect;
     c->has_frame = 1;
     c->pts = pts;
     c->pixel_aspect = pixel_aspect;
     c->has_frame = 1;
@@ -106,6 +108,8 @@ static int request_frame(AVFilterLink *link)
 
     picref->pts = c->pts;
     picref->pixel_aspect = c->pixel_aspect;
 
     picref->pts = c->pts;
     picref->pixel_aspect = c->pixel_aspect;
+    picref->interlaced      = c->frame.interlaced_frame;
+    picref->top_field_first = c->frame.top_field_first;
     avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
     avfilter_draw_slice(link, 0, link->h, 1);
     avfilter_end_frame(link);
     avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
     avfilter_draw_slice(link, 0, link->h, 1);
     avfilter_end_frame(link);