summaryrefslogtreecommitdiffstats
path: root/sys/qcam
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2005-02-03 12:16:00 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2005-02-03 12:16:00 +0000
commit2ccd6d43466b22514ec4c9655eee3f36a729ebd3 (patch)
treeac51554556a0d6aaa89f7857055561d8eed6bb3d /sys/qcam
parenta04dee4a8cbbc68f56b93bd0041c09fa4d0bae0d (diff)
downloadgst-plugins-bad-2ccd6d43466b22514ec4c9655eee3f36a729ebd3.tar.gz
gst-plugins-bad-2ccd6d43466b22514ec4c9655eee3f36a729ebd3.tar.bz2
gst-plugins-bad-2ccd6d43466b22514ec4c9655eee3f36a729ebd3.zip
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.
Diffstat (limited to 'sys/qcam')
-rw-r--r--sys/qcam/gstqcamsrc.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/sys/qcam/gstqcamsrc.c b/sys/qcam/gstqcamsrc.c
index 48480225..c08453ba 100644
--- a/sys/qcam/gstqcamsrc.c
+++ b/sys/qcam/gstqcamsrc.c
@@ -388,19 +388,22 @@ gst_qcamsrc_change_state (GstElement * element)
{
g_return_val_if_fail (GST_IS_QCAMSRC (element), FALSE);
- /* if going down into NULL state, close the file if it's open */
- if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
- if (GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN))
- gst_qcamsrc_close (GST_QCAMSRC (element));
- /* otherwise (READY or higher) we need to open the sound card */
- } else {
- if (!GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) {
- GST_DEBUG ("opening");
- if (!gst_qcamsrc_open (GST_QCAMSRC (element))) {
- GST_DEBUG ("open failed");
- return GST_STATE_FAILURE;
+ switch (GST_STATE_TRANSITION (element)) {
+ case GST_STATE_READY_TO_NULL:
+ if (GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN))
+ gst_qcamsrc_close (GST_QCAMSRC (element));
+ break;
+ case GST_STATE_NULL_TO_READY:
+ if (!GST_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) {
+ GST_DEBUG ("opening");
+ if (!gst_qcamsrc_open (GST_QCAMSRC (element))) {
+ GST_DEBUG ("open failed");
+ return GST_STATE_FAILURE;
+ }
}
- }
+ break;
+ default:
+ break;
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
@@ -413,7 +416,8 @@ static gboolean
gst_qcamsrc_open (GstQCamSrc * qcamsrc)
{
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;
}