diff --git a/ChangeLog b/ChangeLog index fbc3a8b320..930b691ac5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-02-24 Tim-Philipp Müller + + * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette), + (gst_ffmpeg_set_palette): + Use AVPALETTE_SIZE macro instead of magic value for clarity. + + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): + In GStreamer, the size of the palette is not part of + GST_BUFFER_SIZE, so adjust buffer size of outgoing buffers + accordingly if there's a palette (fixes #327028, based on + patch by: Fabrizio Gennari). + 2006-02-21 Edward Hervey * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index c17a9583e1..f772000436 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -48,7 +48,7 @@ gst_ffmpeg_get_palette (const GstCaps *caps, AVCodecContext *context) if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) { palette = gst_value_get_buffer (palette_v); - if (GST_BUFFER_SIZE (palette) >= 256 * 4) { + if (GST_BUFFER_SIZE (palette) >= AVPALETTE_SIZE) { if (context->palctrl) av_free (context->palctrl); context->palctrl = av_malloc (sizeof (AVPaletteControl)); @@ -63,7 +63,7 @@ static void gst_ffmpeg_set_palette (GstCaps *caps, AVCodecContext *context) { if (context->palctrl) { - GstBuffer *palette = gst_buffer_new_and_alloc (256 * 4); + GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE); memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette, AVPALETTE_SIZE); diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 01c0552319..5c05c6d21d 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -984,8 +984,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, ffmpegdec->next_ts = GST_CLOCK_TIME_NONE; } } + /* palette is not part of raw video frame in gst and the size + * of the outgoing buffer needs to be adjusted accordingly */ + if (ffmpegdec->context->palctrl != NULL) + GST_BUFFER_SIZE (outbuf) -= AVPALETTE_SIZE; break; - } + } case CODEC_TYPE_AUDIO: if (!ffmpegdec->last_buffer) outbuf = gst_buffer_new_and_alloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);