gst/ffmpegcolorspace/gstffmpegcolorspace.c: Return FALSE instead of returning a random false unit size when the forma...

Original commit message from CVS:
* 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).
This commit is contained in:
Tim-Philipp Müller 2006-08-30 17:22:27 +00:00
parent 5b55df7766
commit 573d041ca7
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2006-08-30 Tim-Philipp Müller <tim at centricular dot net>
* 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 <wim@fluendo.com>
Patch by: Tim-Philipp Müller <tim at centricular dot net>

View file

@ -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