[cheese/camerabin2: 6/24] camerabin2: minimal functionality based on camerabin2
- From: Oleksij Rempel <orempel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/camerabin2: 6/24] camerabin2: minimal functionality based on camerabin2
- Date: Sat, 24 Mar 2012 08:37:22 +0000 (UTC)
commit 6a42114bc3c227a05a3d8ced04b3f4a4856f75cf
Author: Raluca Elena Podiuc <ralucaelena1985 gmail com>
Date: Tue Jul 12 19:49:33 2011 +0300
camerabin2: 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 | 58 +++++++++++++++++++++-----------------------
1 files changed, 28 insertions(+), 30 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index aae8624..6d451f6 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,15 +453,20 @@ 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);
- g_object_set (G_OBJECT (video_enc), "speed", 2, NULL);
+ //raluca:TODO: camerabin2 does not have 'video-encoder'
+ //g_object_set (priv->camerabin, "video-encoder", video_enc, NULL);
+ g_object_set (G_OBJECT (video_enc), "speed-level", 2, NULL);
if ((mux = gst_element_factory_make ("webmmux", "webmmux")) == NULL)
{
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);
}
/*
@@ -1397,6 +1403,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;
}
/**
@@ -1512,13 +1520,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*/
@@ -1530,23 +1540,6 @@ cheese_camera_setup (CheeseCamera *camera, const gchar *uuid, GError **error)
g_object_set (G_OBJECT (video_sink), "async", FALSE, NULL);
g_object_set (G_OBJECT (priv->camerabin), "viewfinder-sink", video_sink, NULL);
- /* Set flags to enable conversions*/
-
- g_object_set (G_OBJECT (priv->camerabin), "flags",
- GST_CAMERABIN_FLAG_SOURCE_RESIZE |
- GST_CAMERABIN_FLAG_SOURCE_COLOR_CONVERSION |
- GST_CAMERABIN_FLAG_VIEWFINDER_SCALE |
- GST_CAMERABIN_FLAG_AUDIO_CONVERSION |
- GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION |
- GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION,
- NULL);
-
- /* Set caps to filter, so it doesn't defaults to I420 format*/
-
- caps = gst_caps_from_string ("video/x-raw-yuv; video/x-raw-rgb");
- g_object_set (G_OBJECT (priv->camerabin), "filter-caps", caps, NULL);
- gst_caps_unref (caps);
-
cheese_camera_set_camera_source (camera);
cheese_camera_set_video_recording (camera, &tmp_error);
cheese_camera_create_video_filter_bin (camera, &tmp_error);
@@ -1558,7 +1551,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]