summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorLasse Laukkanen <ext-lasse.2.laukkanen@nokia.com>2009-03-09 18:25:48 +0200
committerDave Robillard <dave@drobilla.net>2009-05-03 12:03:15 -0400
commit679ed422ea3616b78731e89d7160cdff519f0411 (patch)
treefdb7f8f10b94048870a13a479ad0fd9bb57e7d29 /gst
parent9c333d003a5e1c922e5e87ae41e5ad11859e396f (diff)
downloadgst-plugins-bad-679ed422ea3616b78731e89d7160cdff519f0411.tar.gz
gst-plugins-bad-679ed422ea3616b78731e89d7160cdff519f0411.tar.bz2
gst-plugins-bad-679ed422ea3616b78731e89d7160cdff519f0411.zip
camerabin: don't lose pending state when changing resolution
Diffstat (limited to 'gst')
-rw-r--r--gst/camerabin/gstcamerabin.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index ddd08e3b..c58f4f7c 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -2839,17 +2839,26 @@ static void
gst_camerabin_user_res_fps (GstCameraBin * camera, gint width, gint height,
gint fps_n, gint fps_d)
{
- GstState state;
+ GstState state, pending;
GST_INFO_OBJECT (camera, "switching resolution to %dx%d and fps to %d/%d",
width, height, fps_n, fps_d);
- state = GST_STATE (camera);
- gst_element_set_state (GST_ELEMENT (camera), GST_STATE_READY);
+ gst_element_get_state (GST_ELEMENT (camera), &state, &pending, 0);
+ if (state == GST_STATE_PAUSED || state == GST_STATE_PLAYING) {
+ GST_INFO_OBJECT (camera,
+ "changing to READY to initialize videosrc with new format");
+ gst_element_set_state (GST_ELEMENT (camera), GST_STATE_READY);
+ }
camera->width = width;
camera->height = height;
camera->fps_n = fps_n;
camera->fps_d = fps_d;
+ if (pending != GST_STATE_VOID_PENDING) {
+ GST_LOG_OBJECT (camera, "restoring pending state: %s",
+ gst_element_state_get_name (pending));
+ state = pending;
+ }
gst_element_set_state (GST_ELEMENT (camera), state);
}