summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/ffmpeg/gstffmpegcodecmap.c4
-rw-r--r--ext/ffmpeg/gstffmpegdec.c6
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);