From b8afa0cc3c0af42ee663e12d06fa5a40edea2cbd Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 22 Sep 2010 23:39:07 -0300 Subject: [PATCH] camerabin: Adds new video-colorspace-flag to flags Adds a new flag to allow a colorspace convertion before the video encoder element. Fixes #603063 --- gst/camerabin/camerabinvideo.c | 10 +++++++++- gst/camerabin/gstcamerabin-enum.c | 3 +++ gst/camerabin/gstcamerabin-enum.h | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c index cd6d920862..4ab91f5837 100644 --- a/gst/camerabin/camerabinvideo.c +++ b/gst/camerabin/camerabinvideo.c @@ -32,7 +32,7 @@ *----------------------------------------------------------------------------- * audiosrc -> audio_queue -> audioconvert -> volume -> audioenc * > videomux -> filesink - * video_queue -> [timeoverlay] -> videoenc + * video_queue -> [timeoverlay] -> [csp] -> videoenc -> queue * -> [post proc] -> tee < * queue -> *----------------------------------------------------------------------------- @@ -581,6 +581,14 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) vid->vid_tee_probe_id = gst_pad_add_buffer_probe (vid->tee_video_srcpad, G_CALLBACK (camerabin_video_pad_tee_src0_have_buffer), vid); + if (vid->flags & GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION) { + /* Add colorspace converter */ + if (gst_camerabin_create_and_add_element (vidbin, + "ffmpegcolorspace") == NULL) { + goto error; + } + } + /* Add user set or default video encoder element */ if (vid->app_vid_enc) { vid->vid_enc = vid->app_vid_enc; diff --git a/gst/camerabin/gstcamerabin-enum.c b/gst/camerabin/gstcamerabin-enum.c index a116a0083c..73679497dc 100644 --- a/gst/camerabin/gstcamerabin-enum.c +++ b/gst/camerabin/gstcamerabin-enum.c @@ -43,6 +43,9 @@ register_gst_camerabin_flags (GType * id) {C_FLAGS (GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION), "Enable colorspace conversion for still image", "image-colorspace-conversion"}, + {C_FLAGS (GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION), + "Enable colorspace conversion for video capture", + "video-colorspace-conversion"}, {0, NULL, NULL} }; *id = g_flags_register_static ("GstCameraBinFlags", values); diff --git a/gst/camerabin/gstcamerabin-enum.h b/gst/camerabin/gstcamerabin-enum.h index 4a7e7f370d..747828af1d 100644 --- a/gst/camerabin/gstcamerabin-enum.h +++ b/gst/camerabin/gstcamerabin-enum.h @@ -85,6 +85,8 @@ enum * @GST_CAMERABIN_FLAG_DISABLE_AUDIO: disable audio elements * @GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION: enable color * conversion for image output element + * @GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION: enable color + * conversion for video encoder element * * Extra flags to configure the behaviour of the sinks. */ @@ -95,7 +97,8 @@ typedef enum { GST_CAMERABIN_FLAG_VIEWFINDER_SCALE = (1 << 3), GST_CAMERABIN_FLAG_AUDIO_CONVERSION = (1 << 4), GST_CAMERABIN_FLAG_DISABLE_AUDIO = (1 << 5), - GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION = (1 << 6) + GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION = (1 << 6), + GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION = (1 << 7) } GstCameraBinFlags; #define GST_TYPE_CAMERABIN_FLAGS (gst_camerabin_flags_get_type())