From 219485946ac8502bda93eebf9cb074aa3efee2db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 24 Feb 2006 13:54:04 +0000 Subject: [PATCH] gst/ffmpegcolorspace/gstffmpegcolorspace.c: The 'palette_data' field from incoming RGB caps shouldn't be proxied on o... Original commit message from CVS: * gst/ffmpegcolorspace/gstffmpegcolorspace.c: (gst_ffmpegcsp_caps_remove_format_info), (gst_ffmpegcsp_get_unit_size): The 'palette_data' field from incoming RGB caps shouldn't be proxied on outgoing YUV caps; also, restrict unit size adjustment in case of paletted data only to the unit that actually has a palette. Fixes #330711. --- ChangeLog | 10 ++++++++++ gst/ffmpegcolorspace/gstffmpegcolorspace.c | 10 ++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 981b84a..8213e79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,16 @@ 2006-02-24 Tim-Philipp Müller * gst/ffmpegcolorspace/gstffmpegcolorspace.c: + (gst_ffmpegcsp_caps_remove_format_info), + (gst_ffmpegcsp_get_unit_size): + The 'palette_data' field from incoming RGB caps shouldn't be + proxied on outgoing YUV caps; also, restrict unit size + adjustment in case of paletted data only to the unit that + actually has a palette. Fixes #330711. + +2006-02-24 Tim-Philipp Müller + + * gst/ffmpegcolorspace/gstffmpegcolorspace.c: (gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps), (gst_ffmpegcsp_finalize), (gst_ffmpegcsp_class_init), (gst_ffmpegcsp_get_unit_size): diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 818a18f..c5911df 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -108,6 +108,7 @@ gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps) gst_structure_remove_field (structure, "green_mask"); gst_structure_remove_field (structure, "blue_mask"); gst_structure_remove_field (structure, "alpha_mask"); + gst_structure_remove_field (structure, "palette_data"); } gst_caps_do_simplify (caps); @@ -398,8 +399,13 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, *size = avpicture_get_size (ctx->pix_fmt, width, height); - if (space->palette) - *size -= 4 * 256; + /* ffmpeg frames have the palette after the frame data, whereas + * GStreamer currently puts it into the caps as 'palette_data' field, + * so for paletted data the frame size avpicture_get_size() returns is + * 1024 bytes larger than what GStreamer expects. */ + if (gst_structure_has_field (structure, "palette_data")) { + *size -= 4 * 256; /* = AVPALETTE_SIZE */ + } if (ctx->palctrl) av_free (ctx->palctrl); -- 2.7.4