v4l2: handle unsupported formats

This commit is contained in:
Wim Taymans 2011-07-19 18:20:43 +01:00
parent 87d9a57aba
commit 44fa0b9cab
2 changed files with 21 additions and 1 deletions

View file

@ -1376,6 +1376,7 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
GstStructure *structure; GstStructure *structure;
guint32 fourcc; guint32 fourcc;
const gchar *mimetype; const gchar *mimetype;
struct v4l2_fmtdesc *fmt;
/* default unknown values */ /* default unknown values */
fourcc = 0; fourcc = 0;
@ -1503,7 +1504,11 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
if (fourcc == 0) if (fourcc == 0)
goto unhandled_format; goto unhandled_format;
*format = gst_v4l2_object_get_format_from_fourcc (v4l2object, fourcc); fmt = gst_v4l2_object_get_format_from_fourcc (v4l2object, fourcc);
if (fmt == NULL)
goto unsupported_format;
*format = fmt;
return TRUE; return TRUE;
@ -1533,6 +1538,11 @@ unhandled_format:
GST_DEBUG_OBJECT (v4l2object, "unhandled format"); GST_DEBUG_OBJECT (v4l2object, "unhandled format");
return FALSE; return FALSE;
} }
unsupported_format:
{
GST_DEBUG_OBJECT (v4l2object, "unsupported format");
return FALSE;
}
} }

View file

@ -747,9 +747,19 @@ gst_v4l2sink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
GST_DEBUG_OBJECT (v4l2sink, "render buffer: %p", buf); GST_DEBUG_OBJECT (v4l2sink, "render buffer: %p", buf);
if (G_UNLIKELY (obj->pool == NULL))
goto not_negotiated;
ret = gst_v4l2_buffer_pool_process (obj->pool, buf); ret = gst_v4l2_buffer_pool_process (obj->pool, buf);
return ret; return ret;
/* ERRORS */
not_negotiated:
{
GST_ERROR_OBJECT (bsink, "not negotiated");
return GST_FLOW_NOT_NEGOTIATED;
}
} }
#ifdef HAVE_XVIDEO #ifdef HAVE_XVIDEO