diff options
Diffstat (limited to 'gst/camerabin')
-rw-r--r-- | gst/camerabin/TODO | 31 | ||||
-rw-r--r-- | gst/camerabin/camerabinimage.c | 8 | ||||
-rw-r--r-- | gst/camerabin/camerabinpreview.c | 5 | ||||
-rw-r--r-- | gst/camerabin/camerabinvideo.c | 9 | ||||
-rw-r--r-- | gst/camerabin/gstcamerabin.c | 20 |
5 files changed, 50 insertions, 23 deletions
diff --git a/gst/camerabin/TODO b/gst/camerabin/TODO new file mode 100644 index 00000000..423c0628 --- /dev/null +++ b/gst/camerabin/TODO @@ -0,0 +1,31 @@ += Cleanups = +* often two g_object_set for same object one after the other +* use GST_*_OBJECT () more often +* there are two gst_element_set_state() one after each other + += Renaming = +* internal use of img->image, vid->video + += Refactorisation = +* gstcamerabin:gst_camerabin_rewrite_tags + - sounds fishy, should use normal tagsetter method + - gst_camerabin_rewrite_tags_to_bin(9 why don't we just send a tag-event? + +* file-name property + - supplying an already opened filedeskriptor would be more safe + - need to check what filesink does if the file exists and cannot be overwritten + +* imagbin + - we want async operation here (especialy for burst mode capture) + - right now, its a bit fragile as we muck with locked_state + - main problem is that the location for filesink can only be set in NULL/READY + and we need to do that sync'ed with the dataflow. we can't use multifilesink + as it does a file per pad_push + - one problem of the current approach is that we can't have an image in e.g, + postprocessing while anotherone is beeing saved + - we could use a pool of imagebins: + - configure one (set filename) + - push_buffer + - on eos, put it back to the pool + - for this we need to check that we can have multiple instances of e.g. + dsp jpeg encoders diff --git a/gst/camerabin/camerabinimage.c b/gst/camerabin/camerabinimage.c index 8eea8d91..25730ccd 100644 --- a/gst/camerabin/camerabinimage.c +++ b/gst/camerabin/camerabinimage.c @@ -463,15 +463,13 @@ gst_camerabin_image_create_elements (GstCameraBinImage * img) g_object_set (G_OBJECT (img->meta_mux), "exif-byte-order", 1, NULL); } - /* Create file sink element */ + /* Add sink element for storing the image */ if (!(img->sink = gst_camerabin_create_and_add_element (imgbin, DEFAULT_SINK))) { goto done; } - - /* Set properties */ - g_object_set (G_OBJECT (img->sink), "location", img->filename->str, NULL); - g_object_set (G_OBJECT (img->sink), "async", FALSE, NULL); + g_object_set (G_OBJECT (img->sink), "location", img->filename->str, "async", FALSE, "buffer-mode", 2, /* non buffered io */ + NULL); ret = TRUE; diff --git a/gst/camerabin/camerabinpreview.c b/gst/camerabin/camerabinpreview.c index 9b12bbac..b8e53389 100644 --- a/gst/camerabin/camerabinpreview.c +++ b/gst/camerabin/camerabinpreview.c @@ -95,6 +95,8 @@ gst_camerabin_preview_create_pipeline (GstCameraBin * camera) gst_bin_add_many (GST_BIN (camera->preview_pipeline), src, csp, filter, vscale, sink, NULL); + GST_DEBUG ("preview format is: %" GST_PTR_FORMAT, camera->preview_caps); + g_object_set (filter, "caps", camera->preview_caps, NULL); g_object_set (sink, "preroll-queue-len", 1, "signal-handoffs", TRUE, NULL); g_object_set (vscale, "method", 0, NULL); @@ -195,7 +197,8 @@ gst_camerabin_preview_convert (GstCameraBin * camera, GstBuffer * buf) bflags = GST_BUFFER_FLAGS (buf); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY); - GST_DEBUG ("running conversion pipeline"); + GST_DEBUG ("running conversion pipeline, source is: %" GST_PTR_FORMAT, + GST_BUFFER_CAPS (buf)); gst_element_set_state (camera->preview_pipeline, GST_STATE_PLAYING); g_signal_emit_by_name (src, "push-buffer", buf, &fret); diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c index 4bbc5057..bc915243 100644 --- a/gst/camerabin/camerabinvideo.c +++ b/gst/camerabin/camerabinvideo.c @@ -553,7 +553,6 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) gst_ghost_pad_set_target (GST_GHOST_PAD (vid->sinkpad), vid_sinkpad); gst_object_unref (vid_sinkpad); - /* Add queue element for video */ vid->tee_video_srcpad = gst_element_get_request_pad (vid->tee, "src%d"); if (!(vid->video_queue = @@ -565,7 +564,6 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) gst_pad_add_buffer_probe (vid->tee_video_srcpad, G_CALLBACK (camerabin_video_pad_tee_src0_have_buffer), vid); - #ifdef USE_TIMEOVERLAY /* Add timeoverlay element to visualize elapsed time for debugging */ if (!(gst_camerabin_create_and_add_element (vidbin, "timeoverlay"))) { @@ -600,8 +598,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) gst_camerabin_create_and_add_element (vidbin, DEFAULT_SINK))) { goto error; } - g_object_set (G_OBJECT (vid->sink), "location", vid->filename->str, NULL); - + g_object_set (G_OBJECT (vid->sink), "location", vid->filename->str, "buffer-mode", 2, /* non buffered io */ + NULL); /* Add user set or default audio source element */ if (vid->user_aud_src) { @@ -615,10 +613,9 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) } /* Add queue element for audio */ - if (!(queue = gst_camerabin_create_and_add_element (vidbin, "queue"))) { + if (!(gst_camerabin_create_and_add_element (vidbin, "queue"))) { goto error; } - queue = NULL; /* Add optional audio conversion and volume elements and raise no errors if adding them fails */ diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 9d8a14cc..22a33477 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -954,7 +954,7 @@ gst_camerabin_change_mode (GstCameraBin * camera, gint mode) camera->mode = mode; if (camera->active_bin) { GST_DEBUG_OBJECT (camera, "stopping active bin"); - gst_element_set_state (camera->active_bin, GST_STATE_NULL); + gst_element_set_state (camera->active_bin, GST_STATE_READY); } if (camera->mode == MODE_IMAGE) { GstStateChangeReturn state_ret; @@ -1031,6 +1031,10 @@ gst_camerabin_set_element_zoom (GstCameraBin * camera, gint zoom) if (zoom != ZOOM_1X) { w2_crop = (camera->width - (camera->width * ZOOM_1X / zoom)) / 2; h2_crop = (camera->height - (camera->height * ZOOM_1X / zoom)) / 2; + + /* force number of pixels cropped from left to be even, to avoid slow code + * path on videoscale */ + w2_crop &= 0xFFFE; } pad_zoom_sink = gst_element_get_static_pad (camera->src_zoom_crop, "sink"); @@ -2862,12 +2866,8 @@ gst_camerabin_set_property (GObject * object, guint prop_id, break; case ARG_FILTER_CAPS: GST_OBJECT_LOCK (camera); - if (camera->view_finder_caps) { - gst_caps_unref (camera->view_finder_caps); - } - /* just ref, we don't modify it inplace */ - camera->view_finder_caps = - gst_caps_ref ((GstCaps *) gst_value_get_caps (value)); + gst_caps_replace (&camera->view_finder_caps, + (GstCaps *) gst_value_get_caps (value)); GST_OBJECT_UNLOCK (camera); if (GST_STATE (camera) != GST_STATE_NULL) { gst_camerabin_set_capsfilter_caps (camera, camera->view_finder_caps); @@ -2875,10 +2875,8 @@ gst_camerabin_set_property (GObject * object, guint prop_id, break; case ARG_PREVIEW_CAPS: GST_OBJECT_LOCK (camera); - if (camera->preview_caps) { - gst_caps_unref (camera->preview_caps); - } - camera->preview_caps = gst_caps_copy (gst_value_get_caps (value)); + gst_caps_replace (&camera->preview_caps, + (GstCaps *) gst_value_get_caps (value)); GST_OBJECT_UNLOCK (camera); gst_camerabin_preview_create_pipeline (camera); break; |