aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-04-07 09:57:07 +0200
committerStefano Sabatini <stefasab@gmail.com>2012-05-25 11:04:24 +0200
commitad12e9e8c054b904d564e1a183b73104bca2e3d5 (patch)
treef80393b2a65eaf383d2e474261d12f4e881c4010
parentb0b7a89b07f5566f0a94fe62dbe778a516eb0daa (diff)
downloadffmpeg-ad12e9e8c054b904d564e1a183b73104bca2e3d5.tar.gz
lavfi/hflip: copy palette data in start_frame()
Fix trac ticket #1116.
-rw-r--r--libavfilter/vf_hflip.c16
-rw-r--r--tests/ref/lavfi/pixfmts_hflip2
2 files changed, 17 insertions, 1 deletions
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index af0404c805..ba8e100019 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -80,6 +80,21 @@ static int config_props(AVFilterLink *inlink)
return 0;
}
+static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+{
+ AVFilterLink *outlink = inlink->dst->outputs[0];
+
+ outlink->out_buf =
+ avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
+
+ /* copy palette if required */
+ if (av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL)
+ memcpy(inlink->dst->outputs[0]->out_buf->data[1], picref->data[1], AVPALETTE_SIZE);
+
+ avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
+}
+
static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{
FlipContext *flip = inlink->dst->priv;
@@ -152,6 +167,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, },
diff --git a/tests/ref/lavfi/pixfmts_hflip b/tests/ref/lavfi/pixfmts_hflip
index cf73c2ce2a..7787ca49ec 100644
--- a/tests/ref/lavfi/pixfmts_hflip
+++ b/tests/ref/lavfi/pixfmts_hflip
@@ -15,7 +15,7 @@ bgra 01ca21e7e6a8d1281b4553bde8e8a404
gray 03efcb4ab52a24c0af0e03cfd26c9377
gray16be 632535b46edec78a6534ef18d37f2b71
gray16le 5c24e6f847bf9a41a40760c0d15df161
-pal8 6c1545bb295e9289add1760851a3d9c9
+pal8 0fda4178d2613bb90484770b31e1891d
rgb24 754f1722fc738590cc407ac65749bfe8
rgb444be d18c1c99abe11dd8347ce8cbc9676bb5
rgb444le 889fff491a853a114b1a8d07fca2c6f2