diff options
author | Tommi Myöhänen <ext-tommi.1.myohanen@nokia.com> | 2009-08-20 17:55:26 +0300 |
---|---|---|
committer | René Stadler <rene.stadler@nokia.com> | 2009-10-01 18:06:54 +0300 |
commit | dacdd5d6c98dee9ffaa4fbe456b4bfce78be0409 (patch) | |
tree | af290dbb81a062fe0ab6eb68b8190ccf79d08dcb | |
parent | 0f2be803b4081a6f4dcffc44456a55d2e2f6d1d4 (diff) |
camerabin: allow capture resolution to be set in NULL state
-rw-r--r-- | gst/camerabin/gstcamerabin.c | 30 | ||||
-rw-r--r-- | gst/camerabin/gstcamerabin.h | 4 |
2 files changed, 31 insertions, 3 deletions
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 301899f9c..9f77751a5 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -350,6 +350,10 @@ static void gst_camerabin_user_stop (GstCameraBin * camera); static void gst_camerabin_user_pause (GstCameraBin * camera); static void +gst_camerabin_set_image_capture_caps (GstCameraBin * camera, gint width, + gint height); + +static void gst_camerabin_user_res_fps (GstCameraBin * camera, gint width, gint height, gint fps_n, gint fps_d); @@ -1544,7 +1548,14 @@ gst_camerabin_start_image_capture (GstCameraBin * camera) } if (!camera->image_capture_caps) { - camera->image_capture_caps = gst_caps_copy (camera->view_finder_caps); + if (camera->image_width && camera->image_height) { + /* Resolution is set, but it isn't in use yet */ + gst_camerabin_set_image_capture_caps (camera, camera->image_width, + camera->image_height); + } else { + /* Capture resolution not set. Use viewfinder resolution */ + camera->image_capture_caps = gst_caps_copy (camera->view_finder_caps); + } } /* Start preparations for image capture */ @@ -2606,7 +2617,6 @@ gst_camerabin_class_init (GstCameraBinClass * klass) * * Changes the resolution used for still image capture. * Does not affect view finder mode and video recording. - * Use this action signal in PAUSED or PLAYING state. */ camerabin_signals[USER_IMAGE_RES_SIGNAL] = @@ -2676,6 +2686,8 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass) camera->height = DEFAULT_HEIGHT; camera->fps_n = DEFAULT_FPS_N; camera->fps_d = DEFAULT_FPS_D; + camera->image_width = 0; + camera->image_height = 0; camera->event_tags = gst_tag_list_new (); @@ -3254,7 +3266,8 @@ gst_camerabin_user_res_fps (GstCameraBin * camera, gint width, gint height, } static void -gst_camerabin_user_image_res (GstCameraBin * camera, gint width, gint height) +gst_camerabin_set_image_capture_caps (GstCameraBin * camera, gint width, + gint height) { GstStructure *structure; GstCaps *new_caps = NULL; @@ -3278,6 +3291,17 @@ gst_camerabin_user_image_res (GstCameraBin * camera, gint width, gint height) gst_caps_replace (&camera->image_capture_caps, new_caps); } +static void +gst_camerabin_user_image_res (GstCameraBin * camera, gint width, gint height) +{ + /* Set the caps now already, if possible */ + gst_camerabin_set_image_capture_caps (camera, width, height); + + /* These will be used in _start_image_capture() function */ + camera->image_width = width; + camera->image_height = height; +} + /* entry point to initialize the plug-in * initialize the plug-in itself * register the element factories and pad templates diff --git a/gst/camerabin/gstcamerabin.h b/gst/camerabin/gstcamerabin.h index cd88c7ca1..cfbb21bee 100644 --- a/gst/camerabin/gstcamerabin.h +++ b/gst/camerabin/gstcamerabin.h @@ -68,6 +68,10 @@ struct _GstCameraBin gint fps_n; gint fps_d; + /* Image capture resolution */ + gint image_width; + gint image_height; + /* Image tags are collected here first before sending to imgbin */ GstTagList *event_tags; |