From c729cbdbee633db5407c421baf6409d6ee0ef0d2 Mon Sep 17 00:00:00 2001 From: Edgard Lima Date: Fri, 17 Nov 2006 14:54:01 +0000 Subject: [PATCH] Fix capture_deinit. Original commit message from CVS: Fix capture_deinit. --- ChangeLog | 5 +++++ sys/v4l2/v4l2src_calls.c | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index cae327c..77b03f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-17 Edgard Lima + + * sys/v4l2/v4l2src_calls.c: + Fix capture_deinit. + 2006-11-16 Tim-Philipp Müller * gst/matroska/matroska-mux.c: (gst_matroska_mux_class_init), diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 28aabef..f1ee195 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -537,8 +537,6 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src) gint type = V4L2_BUF_TYPE_VIDEO_CAPTURE; GST_DEBUG_OBJECT (v4l2src, "starting the capturing"); - - GST_V4L2_CHECK_OPEN (v4l2src->v4l2object); GST_V4L2_CHECK_ACTIVE (v4l2src->v4l2object); v4l2src->quit = FALSE; @@ -574,8 +572,12 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src) GST_DEBUG_OBJECT (v4l2src, "stopping capturing"); - GST_V4L2_CHECK_OPEN (v4l2src->v4l2object); - GST_V4L2_CHECK_ACTIVE (v4l2src->v4l2object); + if (!GST_V4L2_IS_OPEN (v4l2src->v4l2object)) { + goto done; + } + if (!GST_V4L2_IS_ACTIVE (v4l2src->v4l2object)) { + goto done; + } if (v4l2src->breq.memory != 0) { /* we actually need to sync on all queued buffers but not @@ -584,6 +586,8 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src) goto streamoff_failed; } +done: + /* make an optional pending wait stop */ v4l2src->quit = TRUE; v4l2src->is_capturing = FALSE; @@ -629,8 +633,12 @@ gst_v4l2src_capture_deinit (GstV4l2Src * v4l2src) GST_DEBUG_OBJECT (v4l2src, "deinitting capture system"); - GST_V4L2_CHECK_OPEN (v4l2src->v4l2object); - GST_V4L2_CHECK_ACTIVE (v4l2src->v4l2object); + if (!GST_V4L2_IS_OPEN (v4l2src->v4l2object)) { + return TRUE; + } + if (!GST_V4L2_IS_ACTIVE (v4l2src->v4l2object)) { + return TRUE; + } if (v4l2src->pool) { /* free the buffers */ @@ -657,8 +665,8 @@ gst_v4l2src_capture_deinit (GstV4l2Src * v4l2src) * they get auto-dequeued. */ if (try_reinit) { - if (!gst_v4l2src_capture_start (v4l2src) || - !gst_v4l2src_capture_stop (v4l2src)) { + gst_v4l2src_capture_start (v4l2src); + if (!gst_v4l2src_capture_stop (v4l2src)) { GST_DEBUG_OBJECT (v4l2src, "failed reinit device"); return FALSE; } -- 2.7.4