[cheese] Minimal functionality based on camerabin2
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Minimal functionality based on camerabin2
- Date: Mon, 3 Sep 2012 19:57:26 +0000 (UTC)
commit 4b4ef05d5a9b1b4a9c79e1bfb1ee5335b5804273
Author: Raluca Elena Podiuc <ralucaelena1985 gmail com>
Date: Tue Jul 12 19:49:33 2011 +0300
Minimal functionality based on camerabin2
These are the minimal changes needed to integrate camerabin2.
Support for:
- viewfinder (Cheese's main window)
- effect previews
Porting details:
- obviously, the name has changed to camerabin2
- Camerabin2 requires something special from it's "camera-source".
We use the "wrappercamerabinsrc" module provided by camerabin2 which
creates a "camera-source" suitable for camerabin2 based on a regular
video source.
libcheese/cheese-camera.c | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index af073f3..14e05e3 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -81,6 +81,7 @@ struct _CheeseCameraPrivate
GstElement *effects_preview_bin;
GstElement *video_source;
+ GstElement *camera_source;
GstElement *video_file_sink;
GstElement *audio_source;
GstElement *audio_enc;
@@ -234,7 +235,7 @@ cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *ca
}
case GST_MESSAGE_STATE_CHANGED:
{
- if (strcmp (GST_MESSAGE_SRC_NAME (message), "camerabin") == 0)
+ if (strcmp (GST_MESSAGE_SRC_NAME (message), "camerabin2") == 0)
{
GstState old, new;
gst_message_parse_state_changed (message, &old, &new, NULL);
@@ -248,7 +249,7 @@ cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *ca
const GstStructure *structure;
GstBuffer *buffer;
const GValue *image;
- if (strcmp (GST_MESSAGE_SRC_NAME (message), "camerabin") == 0)
+ if (strcmp (GST_MESSAGE_SRC_NAME (message), "camerabin2") == 0)
{
structure = gst_message_get_structure (message);
if (strcmp (gst_structure_get_name (structure), "preview-image") == 0)
@@ -401,7 +402,7 @@ cheese_camera_set_camera_source (CheeseCamera *camera)
priv->video_source = gst_parse_bin_from_description (camera_input, TRUE, &err);
g_free (camera_input);
- if (priv->video_source == NULL)
+ if (priv->video_source == NULL || priv->camera_source == NULL)
{
if (err != NULL)
{
@@ -410,7 +411,7 @@ cheese_camera_set_camera_source (CheeseCamera *camera)
}
return FALSE;
}
- g_object_set (priv->camerabin, "video-source", priv->video_source, NULL);
+ g_object_set (priv->camera_source, "video-source", priv->video_source, NULL);
return TRUE;
}
@@ -452,7 +453,8 @@ cheese_camera_set_video_recording (CheeseCamera *camera, GError **error)
cheese_camera_set_error_element_not_found (error, "vp8enc");
return;
}
- g_object_set (priv->camerabin, "video-encoder", video_enc, NULL);
+ //raluca:TODO: camerabin2 does not have 'video-encoder'
+ //g_object_set (priv->camerabin, "video-encoder", video_enc, NULL);
/* Use a preset, or set some reasonable defaults. */
if (!gst_preset_load_preset (GST_PRESET (video_enc), "Profile Realtime"))
{
@@ -464,7 +466,11 @@ cheese_camera_set_video_recording (CheeseCamera *camera, GError **error)
cheese_camera_set_error_element_not_found (error, "webmmux");
return;
}
- g_object_set (priv->camerabin, "video-muxer", mux, NULL);
+ //raluca:TODO: camerabin2 does not have 'video-muxer'
+ //g_object_set (priv->camerabin, "video-muxer", mux, NULL);
+ g_object_set (G_OBJECT (mux),
+ "max-delay", (guint64) 10000000,
+ "max-page-delay", (guint64) 10000000, NULL);
}
/*
@@ -1401,6 +1407,8 @@ cheese_camera_init (CheeseCamera *camera)
priv->photo_handler_signal_id = 0;
priv->current_format = NULL;
priv->monitor = NULL;
+ priv->camera_source = NULL;
+ priv->video_source = NULL;
}
/**
@@ -1516,13 +1524,15 @@ cheese_camera_setup (CheeseCamera *camera, const gchar *uuid, GError **error)
}
- if ((priv->camerabin = gst_element_factory_make ("camerabin", "camerabin")) == NULL)
+ if ((priv->camerabin = gst_element_factory_make ("camerabin2", "camerabin2")) == NULL)
{
- cheese_camera_set_error_element_not_found (error, "camerabin");
- return;
+ cheese_camera_set_error_element_not_found (error, "camerabin2");
+ }
+ if ((priv->camera_source = gst_element_factory_make ("wrappercamerabinsrc", "camera_source")) == NULL)
+ {
+ cheese_camera_set_error_element_not_found (error, "wrappercamerabinsrc");
}
- g_object_set (priv->camerabin, "video-capture-height", 0,
- "video-capture-width", 0, NULL);
+ g_object_set (priv->camerabin, "camera-source", priv->camera_source, NULL);
/* Create a clutter-gst sink and set it as camerabin sink*/
@@ -1550,7 +1560,12 @@ cheese_camera_setup (CheeseCamera *camera, const gchar *uuid, GError **error)
GST_WARNING ("%s", (*error)->message);
return;
}
- g_object_set (G_OBJECT (priv->camerabin), "video-source-filter", priv->video_filter_bin, NULL);
+
+ //raluca: TODO: set video-filter, preview-filter, image-filter?
+ g_object_set (G_OBJECT (priv->camerabin), "viewfinder-filter", priv->video_filter_bin, NULL);
+ //g_object_set (G_OBJECT (priv->camerabin), "video-filter", priv->video_filter_bin, NULL);
+ //g_object_set (G_OBJECT (priv->camerabin), "preview-filter", priv->video_filter_bin, NULL);
+ //g_object_set (G_OBJECT (priv->camerabin), "image-filter", priv->video_filter_bin, NULL);
priv->bus = gst_element_get_bus (priv->camerabin);
gst_bus_add_signal_watch (priv->bus);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]