sys/qcam/gstqcamsrc.c: Use GST_ELEMENT_ERROR, not g_warning, if open failed.

Original commit message from CVS:
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open):
Use GST_ELEMENT_ERROR, not g_warning, if open failed.
This commit is contained in:
Ronald S. Bultje 2005-02-03 12:16:00 +00:00
parent a04dee4a8c
commit 2ccd6d4346
2 changed files with 23 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2005-02-03 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open):
Use GST_ELEMENT_ERROR, not g_warning, if open failed.
2005-02-02 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2005-02-02 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/qtdemux/qtdemux.c: (qtdemux_video_caps): * gst/qtdemux/qtdemux.c: (qtdemux_video_caps):

View file

@ -388,12 +388,12 @@ gst_qcamsrc_change_state (GstElement * element)
{ {
g_return_val_if_fail (GST_IS_QCAMSRC (element), FALSE); g_return_val_if_fail (GST_IS_QCAMSRC (element), FALSE);
/* if going down into NULL state, close the file if it's open */ switch (GST_STATE_TRANSITION (element)) {
if (GST_STATE_PENDING (element) == GST_STATE_NULL) { case GST_STATE_READY_TO_NULL:
if (GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) if (GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN))
gst_qcamsrc_close (GST_QCAMSRC (element)); gst_qcamsrc_close (GST_QCAMSRC (element));
/* otherwise (READY or higher) we need to open the sound card */ break;
} else { case GST_STATE_NULL_TO_READY:
if (!GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) { if (!GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) {
GST_DEBUG ("opening"); GST_DEBUG ("opening");
if (!gst_qcamsrc_open (GST_QCAMSRC (element))) { if (!gst_qcamsrc_open (GST_QCAMSRC (element))) {
@ -401,6 +401,9 @@ gst_qcamsrc_change_state (GstElement * element)
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
} }
break;
default:
break;
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) if (GST_ELEMENT_CLASS (parent_class)->change_state)
@ -413,7 +416,8 @@ static gboolean
gst_qcamsrc_open (GstQCamSrc * qcamsrc) gst_qcamsrc_open (GstQCamSrc * qcamsrc)
{ {
if (qc_open (qcamsrc->qcam)) { if (qc_open (qcamsrc->qcam)) {
g_warning ("qcamsrc: Cannot open QuickCam.\n"); GST_ELEMENT_ERROR (qcamsrc, RESOURCE, OPEN_READ, (NULL),
("Failed to open QuickCam"));
return FALSE; return FALSE;
} }