Commit 4ba0f2ad authored by Jan Schmidt's avatar Jan Schmidt
Browse files

Fix up all the state change functions.

Original commit message from CVS:
Fix up all the state change functions.
parent 1c1c961a
......@@ -107,7 +107,8 @@ static GstPadLinkReturn
gst_video_crop_link (GstPad * pad, const GstCaps * caps);
static void gst_video_crop_chain (GstPad * pad, GstData * _data);
static GstElementStateReturn gst_video_crop_change_state (GstElement * element);
static GstStateChangeReturn gst_video_crop_change_state (GstElement * element,
GstStateChange transition);
static GstElementClass *parent_class = NULL;
......@@ -531,33 +532,33 @@ gst_video_crop_chain (GstPad * pad, GstData * _data)
gst_pad_push (video_crop->srcpad, GST_DATA (outbuf));
}
static GstElementStateReturn
gst_video_crop_change_state (GstElement * element)
static GstStateChangeReturn
gst_video_crop_change_state (GstElement * element, GstStateChange transition)
{
GstVideoCrop *video_crop;
video_crop = GST_VIDEO_CROP (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
video_crop->renegotiate_src_caps = TRUE;
break;
case GST_STATE_READY_TO_PAUSED:
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
break;
}
if (parent_class->change_state != NULL)
return parent_class->change_state (element);
return parent_class->change_state (element, transition);
return GST_STATE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
}
static gboolean
......
......@@ -72,8 +72,8 @@ static void gst_v4l2element_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_v4l2element_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstElementStateReturn
gst_v4l2element_change_state (GstElement * element);
static GstStateChangeReturn
gst_v4l2element_change_state (GstElement * element, GstStateChange transition);
static GstElementClass *parent_class = NULL;
......@@ -562,22 +562,22 @@ gst_v4l2element_get_property (GObject * object,
}
static GstElementStateReturn
gst_v4l2element_change_state (GstElement * element)
static GstStateChangeReturn
gst_v4l2element_change_state (GstElement * element, GstStateChange transition)
{
GstV4l2Element *v4l2element;
g_return_val_if_fail (GST_IS_V4L2ELEMENT (element), GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_V4L2ELEMENT (element), GST_STATE_CHANGE_FAILURE);
v4l2element = GST_V4L2ELEMENT (element);
/* if going down into NULL state, close the device if it's open
* if going to READY, open the device (and set some options)
*/
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!gst_v4l2_open (v4l2element))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
#ifdef HAVE_XVIDEO
gst_v4l2_xoverlay_open (v4l2element);
......@@ -587,13 +587,13 @@ gst_v4l2element_change_state (GstElement * element)
g_signal_emit (G_OBJECT (v4l2element),
gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device);
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
#ifdef HAVE_XVIDEO
gst_v4l2_xoverlay_close (v4l2element);
#endif
if (!gst_v4l2_close (v4l2element))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
/* emit yet another signal! wheehee! */
g_signal_emit (G_OBJECT (v4l2element),
......@@ -602,7 +602,7 @@ gst_v4l2element_change_state (GstElement * element)
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
}
......@@ -123,7 +123,8 @@ static void gst_v4l2src_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
/* state handling */
static GstElementStateReturn gst_v4l2src_change_state (GstElement * element);
static GstStateChangeReturn gst_v4l2src_change_state (GstElement * element,
GstStateChange transition);
/* set_clock function for A/V sync */
static void gst_v4l2src_set_clock (GstElement * element, GstClock * clock);
......@@ -1014,63 +1015,63 @@ gst_v4l2src_get_property (GObject * object,
}
static GstElementStateReturn
gst_v4l2src_change_state (GstElement * element)
static GstStateChangeReturn
gst_v4l2src_change_state (GstElement * element, GstStateChange transition)
{
GstV4l2Src *v4l2src;
gint transition = GST_STATE_TRANSITION (element);
GstElementStateReturn parent_return;
GstStateChangeReturn parent_return;
GTimeVal time;
g_return_val_if_fail (GST_IS_V4L2SRC (element), GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_V4L2SRC (element), GST_STATE_CHANGE_FAILURE);
v4l2src = GST_V4L2SRC (element);
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
parent_return = GST_ELEMENT_CLASS (parent_class)->change_state (element);
if (parent_return != GST_STATE_SUCCESS)
parent_return =
GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (parent_return != GST_STATE_CHANGE_SUCCESS)
return parent_return;
}
switch (transition) {
case GST_STATE_NULL_TO_READY:
case GST_STATE_CHANGE_NULL_TO_READY:
if (!gst_v4l2src_get_capture (v4l2src))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_READY_TO_PAUSED:
case GST_STATE_CHANGE_READY_TO_PAUSED:
v4l2src->handled = 0;
v4l2src->need_writes = 0;
v4l2src->substract_time = 0;
/* buffer setup moved to capsnego */
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
/* queue all buffer, start streaming capture */
if (GST_V4L2ELEMENT (v4l2src)->buffer &&
!gst_v4l2src_capture_start (v4l2src))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
g_get_current_time (&time);
v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) -
v4l2src->substract_time;
v4l2src->last_seq = 0;
break;
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
g_get_current_time (&time);
v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) -
v4l2src->substract_time;
/* de-queue all queued buffers */
if (v4l2src->is_capturing && !gst_v4l2src_capture_stop (v4l2src))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
/* stop capturing, unmap all buffers */
if (GST_V4L2ELEMENT (v4l2src)->buffer &&
!gst_v4l2src_capture_deinit (v4l2src))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
break;
}
return GST_STATE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment