diff options
author | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2011-01-11 09:12:24 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2011-01-24 14:50:29 -0300 |
commit | ccb1960a4208dcab514f1c9799642beb31951950 (patch) | |
tree | d5fbbdc7dba06582a36b8973fb4032f3157bab6f | |
parent | e5f267f682d28d18336ecdf9d0f68f945a8ee200 (diff) |
camerabin2: Add a property to select the encoding profile
Adds a video-profile to allow selecting which encoding profile
to use for video recordings
-rw-r--r-- | gst/camerabin2/gstcamerabin2.c | 27 | ||||
-rw-r--r-- | gst/camerabin2/gstcamerabin2.h | 3 |
2 files changed, 24 insertions, 6 deletions
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index a9810dadf..178f7cc2f 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -50,7 +50,6 @@ #endif #include <gst/basecamerabinsrc/gstbasecamerasrc.h> -#include <gst/pbutils/encoding-profile.h> #include "gstcamerabin2.h" GST_DEBUG_CATEGORY_STATIC (gst_camera_bin_debug); @@ -69,7 +68,8 @@ enum PROP_IMAGE_CAPTURE_CAPS, PROP_VIDEO_CAPTURE_CAPS, PROP_POST_PREVIEWS, - PROP_PREVIEW_CAPS + PROP_PREVIEW_CAPS, + PROP_VIDEO_ENCODING_PROFILE }; enum @@ -345,6 +345,12 @@ gst_camera_bin_class_init (GstCameraBinClass * klass) "The caps of the preview image to be posted", GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_VIDEO_ENCODING_PROFILE, + gst_param_spec_mini_object ("video-profile", "Video Profile", + "The GstEncodingProfile to use for video recording", + GST_TYPE_ENCODING_PROFILE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstCameraBin::capture-start: * @camera: the camera bin element @@ -421,7 +427,7 @@ gst_camera_bin_create_elements (GstCameraBin * camera) camera->imagebin = gst_element_factory_make ("imagecapturebin", "imagebin"); g_object_set (camera->videosink, "async", FALSE, NULL); - { + if (camera->video_profile == NULL) { GstEncodingContainerProfile *prof; GstCaps *caps; @@ -437,9 +443,10 @@ gst_camera_bin_create_elements (GstCameraBin * camera) GST_WARNING_OBJECT (camera, "Failed to create encoding profiles"); } gst_caps_unref (caps); - g_object_set (camera->encodebin, "profile", prof, NULL); - gst_encoding_profile_unref (prof); + + camera->video_profile = (GstEncodingProfile *) prof; } + g_object_set (camera->encodebin, "profile", camera->video_profile, NULL); camera->videobin_queue = gst_element_factory_make ("queue", "videobin-queue"); @@ -672,6 +679,10 @@ gst_camera_bin_set_property (GObject * object, guint prop_id, "preview-caps")) g_object_set (camera->src, "preview-caps", camera->preview_caps, NULL); break; + case PROP_VIDEO_ENCODING_PROFILE: + camera->video_profile = + (GstEncodingProfile *) gst_value_dup_mini_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -754,6 +765,12 @@ gst_camera_bin_get_property (GObject * object, guint prop_id, if (camera->preview_caps) gst_value_set_caps (value, camera->preview_caps); break; + case PROP_VIDEO_ENCODING_PROFILE: + if (camera->video_profile) { + gst_value_set_mini_object (value, + (GstMiniObject *) camera->video_profile); + } + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h index 8802a5534..8534674aa 100644 --- a/gst/camerabin2/gstcamerabin2.h +++ b/gst/camerabin2/gstcamerabin2.h @@ -20,6 +20,7 @@ #define _GST_CAMERA_BIN_H_ #include <gst/gst.h> +#include <gst/pbutils/encoding-profile.h> G_BEGIN_DECLS @@ -41,7 +42,6 @@ struct _GstCameraBin GstElement *user_src; gulong src_capture_notify_id; - //GstElement *videobin; GstElement *encodebin; GstElement *videosink; GstElement *videobin_queue; @@ -64,6 +64,7 @@ struct _GstCameraBin gchar *image_location; gboolean post_previews; GstCaps *preview_caps; + GstEncodingProfile *video_profile; gboolean elements_created; }; |