diff options
author | Fabrizio <fabrizio.ge@tiscali.it> | 2006-02-24 16:31:49 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-02-24 16:31:49 +0000 |
commit | a3a4d8ef12245059f99cc3eec27ddee9058e22f3 (patch) | |
tree | 672c7f2fc105b57526e43bf706ef0568a127a64b /ext | |
parent | d12d4480096a31847bf7fbe4e5aa342f8e0df9b1 (diff) |
ext/ffmpeg/gstffmpegcodecmap.c: Use AVPALETTE_SIZE macro instead of magic value for clarity.
Original commit message from CVS:
* 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).
Diffstat (limited to 'ext')
-rw-r--r-- | ext/ffmpeg/gstffmpegcodecmap.c | 4 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegdec.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index c17a958..f772000 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 01c0552..5c05c6d 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); |