Commit 28cc187f authored by Wim Taymans's avatar Wim Taymans

ext/ffmpeg/gstffmpegcodecmap.c: Initialize some more variables.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
Initialize some more variables.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_setcaps),
(alloc_output_buffer):
Disable direct rendering for h264, some functions just seem to read from
invalid memory.
parent 4ad12e48
2008-11-07 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
Initialize some more variables.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_setcaps),
(alloc_output_buffer):
Disable direct rendering for h264, some functions just seem to read from
invalid memory.
2008-11-06 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/ffmpeg/gstffmpegcfg.c: (gst_ffmpeg_cfg_init):
......
......@@ -3012,9 +3012,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = picture->data[0] + size;
picture->data[2] = picture->data[1] + size2;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = stride2;
picture->linesize[2] = stride2;
picture->linesize[3] = 0;
GST_DEBUG ("planes %d %d %d", 0, size, size + size2);
GST_DEBUG ("strides %d %d %d", stride, stride2, stride2);
return size + 2 * size2;
......@@ -3025,7 +3027,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = NULL;
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = 0;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size;
/*case PIX_FMT_AYUV4444:
case PIX_FMT_BGR32:
......@@ -3037,7 +3043,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = NULL;
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = 0;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size;
case PIX_FMT_RGB555:
case PIX_FMT_RGB565:
......@@ -3048,7 +3058,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = NULL;
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = 0;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size;
case PIX_FMT_UYVY411:
/* FIXME, probably not the right stride */
......@@ -3057,7 +3071,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = NULL;
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = width + width / 2;
picture->linesize[1] = 0;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size + size / 2;
case PIX_FMT_GRAY8:
stride = ROUND_UP_4 (width);
......@@ -3065,7 +3083,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = NULL;
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = 0;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size;
case PIX_FMT_MONOWHITE:
case PIX_FMT_MONOBLACK:
......@@ -3074,7 +3096,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = NULL;
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = 0;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size;
case PIX_FMT_PAL8:
/* already forced to be with stride, so same result as other function */
......@@ -3083,8 +3109,11 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->data[0] = ptr;
picture->data[1] = ptr + size; /* palette is stored here as 256 32 bit words */
picture->data[2] = NULL;
picture->data[3] = NULL;
picture->linesize[0] = stride;
picture->linesize[1] = 4;
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size + 256 * 4;
default:
picture->data[0] = NULL;
......
......@@ -694,21 +694,24 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
ffmpegdec->extra_ref = FALSE;
if (ffmpegdec->direct_rendering) {
GST_DEBUG_OBJECT (ffmpegdec, "trying to enable direct rendering");
if (!oclass->in_plugin->capabilities & CODEC_CAP_DR1) {
GST_DEBUG_OBJECT (ffmpegdec, "direct rendering not supported");
if (oclass->in_plugin->capabilities & CODEC_CAP_DR1) {
if (oclass->in_plugin->id == CODEC_ID_H264) {
GST_DEBUG_OBJECT (ffmpegdec, "disable direct rendering setup for H264");
/* does not work, many stuff reads outside of the planes */
ffmpegdec->current_dr = FALSE;
ffmpegdec->extra_ref = TRUE;
} else {
GST_DEBUG_OBJECT (ffmpegdec, "enabled direct rendering");
ffmpegdec->current_dr = TRUE;
}
}
if (oclass->in_plugin->id == CODEC_ID_H264) {
GST_DEBUG_OBJECT (ffmpegdec, "direct rendering setup for H264");
ffmpegdec->current_dr = TRUE;
ffmpegdec->extra_ref = TRUE;
} else {
GST_DEBUG_OBJECT (ffmpegdec, "enabled direct rendering");
/* do *not* draw edges when in direct rendering, for some reason it draws
* outside of the memory. */
ffmpegdec->current_dr = TRUE;
else {
GST_DEBUG_OBJECT (ffmpegdec, "direct rendering not supported");
}
}
if (ffmpegdec->current_dr) {
/* do *not* draw edges when in direct rendering, for some reason it draws
* outside of the memory. */
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
}
......@@ -784,6 +787,7 @@ alloc_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf,
width, height);
if (!ffmpegdec->context->palctrl) {
GST_LOG_OBJECT (ffmpegdec, "calling pad_alloc");
/* no pallete, we can use the buffer size to alloc */
ret = gst_pad_alloc_buffer_and_set_caps (ffmpegdec->srcpad,
GST_BUFFER_OFFSET_NONE, fsize,
......@@ -791,6 +795,7 @@ alloc_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf,
if (G_UNLIKELY (ret != GST_FLOW_OK))
goto alloc_failed;
} else {
GST_LOG_OBJECT (ffmpegdec, "not calling pad_alloc, we have a pallete");
/* for paletted data we can't use pad_alloc_buffer(), because
* fsize contains the size of the palette, so the overall size
* is bigger than ffmpegcolorspace's unit size, which will
......
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