Commit ad12e9e8 authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi/hflip: copy palette data in start_frame()

Fix trac ticket #1116.
parent b0b7a89b
...@@ -80,6 +80,21 @@ static int config_props(AVFilterLink *inlink) ...@@ -80,6 +80,21 @@ static int config_props(AVFilterLink *inlink)
return 0; 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) static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{ {
FlipContext *flip = inlink->dst->priv; FlipContext *flip = inlink->dst->priv;
...@@ -152,6 +167,7 @@ AVFilter avfilter_vf_hflip = { ...@@ -152,6 +167,7 @@ AVFilter avfilter_vf_hflip = {
.inputs = (const AVFilterPad[]) {{ .name = "default", .inputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.start_frame = start_frame,
.draw_slice = draw_slice, .draw_slice = draw_slice,
.config_props = config_props, .config_props = config_props,
.min_perms = AV_PERM_READ, }, .min_perms = AV_PERM_READ, },
......
...@@ -15,7 +15,7 @@ bgra 01ca21e7e6a8d1281b4553bde8e8a404 ...@@ -15,7 +15,7 @@ bgra 01ca21e7e6a8d1281b4553bde8e8a404
gray 03efcb4ab52a24c0af0e03cfd26c9377 gray 03efcb4ab52a24c0af0e03cfd26c9377
gray16be 632535b46edec78a6534ef18d37f2b71 gray16be 632535b46edec78a6534ef18d37f2b71
gray16le 5c24e6f847bf9a41a40760c0d15df161 gray16le 5c24e6f847bf9a41a40760c0d15df161
pal8 6c1545bb295e9289add1760851a3d9c9 pal8 0fda4178d2613bb90484770b31e1891d
rgb24 754f1722fc738590cc407ac65749bfe8 rgb24 754f1722fc738590cc407ac65749bfe8
rgb444be d18c1c99abe11dd8347ce8cbc9676bb5 rgb444be d18c1c99abe11dd8347ce8cbc9676bb5
rgb444le 889fff491a853a114b1a8d07fca2c6f2 rgb444le 889fff491a853a114b1a8d07fca2c6f2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment