goto error;
}
}
+
+ if (camera->app_viewfinder_filter) {
+ if (!gst_camerabin_add_element (GST_BIN (camera),
+ camera->app_viewfinder_filter)) {
+ goto error;
+ }
+ }
+
/* Add application set or default video sink element */
if (!(camera->view_sink = gst_camerabin_setup_default_element (cbin,
camera->app_vf_sink, "autovideosink", DEFAULT_VIDEOSINK))) {
camera->app_video_filter = NULL;
}
+ if (camera->app_viewfinder_filter) {
+ gst_object_unref (camera->app_viewfinder_filter);
+ camera->app_viewfinder_filter = NULL;
+ }
+
/* Free caps */
gst_caps_replace (&camera->image_capture_caps, NULL);
gst_caps_replace (&camera->view_finder_caps, NULL);
"Caps defining the preview image format",
GST_TYPE_CAPS, G_PARAM_READWRITE));
+ /**
+ * GstCameraBin:viewfinder-filter:
+ * Set up viewfinder filter element, all frames going to viewfinder sink
+ * element will be processed by this element.
+ * Applications can use this to overlay text/images in the screen, or
+ * plug facetracking algorithms, for example.
+ * This property can only be set while #GstCameraBin is in NULL state.
+ * The ownership of the element will be taken by #GstCameraBin.
+ */
+
+ g_object_class_install_property (gobject_class, ARG_VIEWFINDER_FILTER,
+ g_param_spec_object ("viewfinder-filter", "viewfinder filter element",
+ "viewfinder filter GStreamer element",
+ GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+
/**
* GstCameraBin::capture-start:
* @camera: the camera bin element
camera->view_sink = NULL;
camera->app_vf_sink = NULL;
+ camera->app_viewfinder_filter = NULL;
/* source elements */
camera->src_vid_src = NULL;
}
break;
}
+ case ARG_VIEWFINDER_FILTER:
+ if (GST_STATE (camera) != GST_STATE_NULL) {
+ GST_ELEMENT_ERROR (camera, CORE, FAILED,
+ ("camerabin must be in NULL state when setting the viewfinder filter element"),
+ (NULL));
+ } else {
+ if (camera->app_viewfinder_filter)
+ gst_object_unref (camera->app_viewfinder_filter);
+ camera->app_viewfinder_filter = g_value_dup_object (value);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
else if (camera->mode == MODE_VIDEO)
gst_value_set_caps (value, camera->video_preview_caps);
break;
+ case ARG_VIEWFINDER_FILTER:
+ g_value_set_object (value, camera->app_viewfinder_filter);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
setup_camerabin_elements (GstElement * camera)
{
GstElement *vfsink, *audiosrc, *videosrc, *audioenc, *videoenc, *imageenc,
- *videomux;
+ *videomux, *viewfinder_filter;
GstCaps *audiocaps, *videocaps;
/* Use fakesink for view finder */
gst_caps_unref (videocaps);
videomux = gst_element_factory_make ("avimux", NULL);
imageenc = gst_element_factory_make ("jpegenc", NULL);
+ viewfinder_filter = gst_element_factory_make ("identity", NULL);
if (vfsink && audiosrc && videosrc && audioenc && videoenc && videomux
- && imageenc) {
+ && imageenc && viewfinder_filter) {
g_object_set (camera, "viewfinder-sink", vfsink, "audio-source", audiosrc,
"video-source", videosrc, "audio-encoder", audioenc, "video-encoder",
- videoenc, "image-encoder", imageenc, "video-muxer", videomux, NULL);
+ videoenc, "image-encoder", imageenc, "video-muxer", videomux,
+ "viewfinder-filter", viewfinder_filter, NULL);
} else {
GST_WARNING ("error setting up test plugins");
}