[FFmpeg-devel] [PATCH] lavfi/hflip: copy palette data in start_frame()

Stefano Sabatini stefasab at gmail.com
Sat Apr 7 10:03:50 CEST 2012


Fix trac ticket #1116.
---
 libavfilter/vf_hflip.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index af0404c..1741805 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -80,6 +80,15 @@ static int config_props(AVFilterLink *inlink)
     return 0;
 }
 
+static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+{
+    avfilter_default_start_frame(inlink, picref);
+
+    /* copy palette if required */
+    if (inlink->format == PIX_FMT_PAL8)
+        memcpy(inlink->dst->outputs[0]->out_buf->data[1], picref->data[1], 256*4);
+}
+
 static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
 {
     FlipContext *flip = inlink->dst->priv;
@@ -152,6 +161,7 @@ AVFilter avfilter_vf_hflip = {
 
     .inputs    = (const AVFilterPad[]) {{ .name      = "default",
                                     .type            = AVMEDIA_TYPE_VIDEO,
+                                    .start_frame     = start_frame,
                                     .draw_slice      = draw_slice,
                                     .config_props    = config_props,
                                     .min_perms       = AV_PERM_READ, },
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list