diff --git a/ChangeLog b/ChangeLog index 0a7eb8023a..5383e03c2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-08-30 Tim-Philipp Müller + + * gst/ffmpegcolorspace/gstffmpegcolorspace.c: + (gst_ffmpegcsp_get_unit_size): + Return FALSE instead of returning a random false unit + size when the format isn't known/supported (even if + this shouldn't happen under normal circumstances). + 2006-08-29 Wim Taymans Patch by: Tim-Philipp Müller diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index b3a0b72532..8ac9942375 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -382,6 +382,7 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, GstFFMpegCsp *space = NULL; GstStructure *structure = NULL; AVCodecContext *ctx = NULL; + gboolean ret = TRUE; gint width, height; g_assert (size); @@ -396,8 +397,15 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, g_assert (ctx != NULL); + ctx->pix_fmt = PIX_FMT_NB; + gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx); + if (G_UNLIKELY (ctx->pix_fmt == PIX_FMT_NB)) { + ret = FALSE; + goto beach; + } + *size = avpicture_get_size (ctx->pix_fmt, width, height); /* ffmpeg frames have the palette after the frame data, whereas @@ -408,11 +416,13 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, *size -= 4 * 256; /* = AVPALETTE_SIZE */ } +beach: + if (ctx->palctrl) av_free (ctx->palctrl); av_free (ctx); - return TRUE; + return ret; } #if 0