mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
camerabin2: port to 0.11
This commit is contained in:
parent
050099ce2d
commit
44eb631841
5 changed files with 113 additions and 109 deletions
|
@ -306,7 +306,7 @@ GST_PLUGINS_NONPORTED=" adpcmdec adpcmenc aiff asfmux \
|
|||
sdi segmentclip siren speed subenc stereo tta videofilters \
|
||||
videomaxrate videomeasure videosignal vmnc \
|
||||
decklink fbdev linsys shm vcd \
|
||||
voaacenc apexsink bz2 camerabin2 cdaudio celt cog curl dc1394 dirac directfb dts resindvd \
|
||||
voaacenc apexsink bz2 cdaudio celt cog curl dc1394 dirac directfb dts resindvd \
|
||||
gsettings gsm jp2k ladspa modplug mpeg2enc mplex mimic \
|
||||
musepack musicbrainz nas neon ofa openal rsvg schro sdl smooth sndfile soundtouch spandsp timidity \
|
||||
wildmidi xvid apple_media "
|
||||
|
|
|
@ -229,19 +229,19 @@ void
|
|||
gst_camerabin_remove_elements_from_bin (GstBin * bin)
|
||||
{
|
||||
GstIterator *iter = NULL;
|
||||
gpointer data = NULL;
|
||||
GValue value = { 0 };
|
||||
GstElement *elem = NULL;
|
||||
gboolean done = FALSE;
|
||||
|
||||
iter = gst_bin_iterate_elements (bin);
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (iter, &data)) {
|
||||
switch (gst_iterator_next (iter, &value)) {
|
||||
case GST_ITERATOR_OK:
|
||||
elem = GST_ELEMENT (data);
|
||||
elem = (GstElement *) g_value_get_object (&value);
|
||||
gst_bin_remove (bin, elem);
|
||||
gst_element_set_state (GST_ELEMENT (elem), GST_STATE_NULL);
|
||||
/* Iterator increased the element refcount, so unref */
|
||||
gst_object_unref (elem);
|
||||
g_value_unset (&value);
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
gst_iterator_resync (iter);
|
||||
|
|
|
@ -350,7 +350,7 @@ static GstEvent *
|
|||
gst_camera_bin_new_event_renegotiate (void)
|
||||
{
|
||||
return gst_event_new_custom (GST_EVENT_CUSTOM_BOTH,
|
||||
gst_structure_new ("renegotiate", NULL));
|
||||
gst_structure_new_empty ("renegotiate"));
|
||||
}
|
||||
|
||||
static GstEvent *
|
||||
|
@ -754,7 +754,7 @@ gst_camera_bin_class_init (GstCameraBin2Class * klass)
|
|||
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",
|
||||
g_param_spec_boxed ("video-profile", "Video Profile",
|
||||
"The GstEncodingProfile to use for video recording. Audio is enabled "
|
||||
"when this profile supports audio.", GST_TYPE_ENCODING_PROFILE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
@ -827,7 +827,7 @@ gst_camera_bin_class_init (GstCameraBin2Class * klass)
|
|||
* getting the 2nd buffer.
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_IMAGE_ENCODING_PROFILE,
|
||||
gst_param_spec_mini_object ("image-profile", "Image Profile",
|
||||
g_param_spec_boxed ("image-profile", "Image Profile",
|
||||
"The GstEncodingProfile to use for image captures.",
|
||||
GST_TYPE_ENCODING_PROFILE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
@ -947,7 +947,7 @@ gst_video_capture_bin_post_video_done (GstCameraBin2 * camera)
|
|||
GstMessage *msg;
|
||||
|
||||
msg = gst_message_new_element (GST_OBJECT_CAST (camera),
|
||||
gst_structure_new ("video-done", NULL));
|
||||
gst_structure_new_empty ("video-done"));
|
||||
|
||||
if (!gst_element_post_message (GST_ELEMENT_CAST (camera), msg))
|
||||
GST_WARNING_OBJECT (camera, "Failed to post video-done message");
|
||||
|
@ -1187,17 +1187,19 @@ encodebin_element_added (GstElement * encodebin, GstElement * new_element,
|
|||
GstElementFactory *factory = gst_element_get_factory (new_element);
|
||||
|
||||
if (factory != NULL) {
|
||||
if (strcmp (GST_PLUGIN_FEATURE_NAME (factory), "audiorate") == 0 ||
|
||||
strcmp (GST_PLUGIN_FEATURE_NAME (factory), "videorate") == 0) {
|
||||
if (strcmp (GST_OBJECT_NAME (factory), "audiorate") == 0 ||
|
||||
strcmp (GST_OBJECT_NAME (factory), "videorate") == 0) {
|
||||
g_object_set (new_element, "skip-to-first", TRUE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (gst_element_implements_interface (new_element, GST_TYPE_TAG_SETTER)) {
|
||||
GstTagSetter *tagsetter = GST_TAG_SETTER (new_element);
|
||||
/* TODO porting
|
||||
if (gst_element_implements_interface (new_element, GST_TYPE_TAG_SETTER)) {
|
||||
GstTagSetter *tagsetter = GST_TAG_SETTER (new_element);
|
||||
|
||||
gst_tag_setter_set_tag_merge_mode (tagsetter, GST_TAG_MERGE_REPLACE);
|
||||
}
|
||||
gst_tag_setter_set_tag_merge_mode (tagsetter, GST_TAG_MERGE_REPLACE);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#define VIDEO_PAD 1
|
||||
|
@ -1206,6 +1208,7 @@ static GstPad *
|
|||
encodebin_find_pad (GstCameraBin2 * camera, GstElement * encodebin,
|
||||
gint pad_type)
|
||||
{
|
||||
GValue value = { 0 };
|
||||
GstPad *pad = NULL;
|
||||
GstIterator *iter;
|
||||
gboolean done;
|
||||
|
@ -1216,8 +1219,10 @@ encodebin_find_pad (GstCameraBin2 * camera, GstElement * encodebin,
|
|||
iter = gst_element_iterate_sink_pads (encodebin);
|
||||
done = FALSE;
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (iter, (gpointer *) & pad)) {
|
||||
switch (gst_iterator_next (iter, &value)) {
|
||||
case GST_ITERATOR_OK:
|
||||
pad = g_value_dup_object (&value);
|
||||
g_value_unset (&value);
|
||||
if (pad_type == VIDEO_PAD) {
|
||||
if (strstr (GST_PAD_NAME (pad), "video") != NULL) {
|
||||
GST_DEBUG_OBJECT (camera, "Found video pad %s", GST_PAD_NAME (pad));
|
||||
|
@ -1338,11 +1343,11 @@ gst_camera_bin_src_notify_zoom_cb (GObject * self, GParamSpec * pspec,
|
|||
g_object_notify (G_OBJECT (camera), "zoom");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camera_bin_image_src_buffer_probe (GstPad * pad, GstBuffer * buf,
|
||||
static GstPadProbeReturn
|
||||
gst_camera_bin_image_src_buffer_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
gpointer data)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
GstPadProbeReturn ret = GST_PAD_PROBE_OK;
|
||||
GstCameraBin2 *camerabin = data;
|
||||
GstEvent *evt;
|
||||
gchar *location = NULL;
|
||||
|
@ -1392,7 +1397,7 @@ gst_camera_bin_image_src_buffer_probe (GstPad * pad, GstBuffer * buf,
|
|||
} else {
|
||||
/* This means we don't have to encode the capture, it is used for
|
||||
* signaling the application just wants the preview */
|
||||
ret = FALSE;
|
||||
ret = GST_PAD_PROBE_DROP;
|
||||
GST_CAMERA_BIN2_PROCESSING_DEC (camerabin);
|
||||
}
|
||||
|
||||
|
@ -1400,11 +1405,12 @@ gst_camera_bin_image_src_buffer_probe (GstPad * pad, GstBuffer * buf,
|
|||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_camera_bin_image_sink_event_probe (GstPad * pad, GstEvent * event,
|
||||
static GstPadProbeReturn
|
||||
gst_camera_bin_image_sink_event_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
gpointer data)
|
||||
{
|
||||
GstCameraBin2 *camerabin = data;
|
||||
GstEvent *event = GST_EVENT (info->data);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_CUSTOM_DOWNSTREAM:{
|
||||
|
@ -1430,20 +1436,21 @@ gst_camera_bin_image_sink_event_probe (GstPad * pad, GstEvent * event,
|
|||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return GST_PAD_PROBE_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camera_bin_audio_src_event_probe (GstPad * pad, GstEvent * event,
|
||||
static GstPadProbeReturn
|
||||
gst_camera_bin_audio_src_event_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
gpointer data)
|
||||
{
|
||||
GstCameraBin2 *camera = data;
|
||||
gboolean ret = TRUE;
|
||||
gboolean ret = GST_PAD_PROBE_OK;
|
||||
GstEvent *event = GST_EVENT (info->data);
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||
/* we only let an EOS pass when the user is stopping a capture */
|
||||
if (camera->audio_drop_eos) {
|
||||
ret = FALSE;
|
||||
ret = GST_PAD_PROBE_DROP;
|
||||
} else {
|
||||
camera->audio_drop_eos = TRUE;
|
||||
}
|
||||
|
@ -1510,12 +1517,12 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
|||
GstEncodingContainerProfile *prof;
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_caps_new_simple ("application/ogg", NULL);
|
||||
caps = gst_caps_new_simple ("application/ogg", NULL, NULL);
|
||||
prof = gst_encoding_container_profile_new ("ogg", "theora+vorbis+ogg",
|
||||
caps, NULL);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("video/x-theora", NULL);
|
||||
caps = gst_caps_new_simple ("video/x-theora", NULL, NULL);
|
||||
if (!gst_encoding_container_profile_add_profile (prof,
|
||||
(GstEncodingProfile *) gst_encoding_video_profile_new (caps,
|
||||
NULL, NULL, 1))) {
|
||||
|
@ -1523,7 +1530,7 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
|||
}
|
||||
gst_caps_unref (caps);
|
||||
|
||||
caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
|
||||
caps = gst_caps_new_simple ("audio/x-vorbis", NULL, NULL);
|
||||
if (!gst_encoding_container_profile_add_profile (prof,
|
||||
(GstEncodingProfile *) gst_encoding_audio_profile_new (caps,
|
||||
NULL, NULL, 1))) {
|
||||
|
@ -1562,7 +1569,7 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
|||
GstEncodingVideoProfile *vprof;
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_caps_new_simple ("image/jpeg", NULL);
|
||||
caps = gst_caps_new_simple ("image/jpeg", NULL, NULL);
|
||||
vprof = gst_encoding_video_profile_new (caps, NULL, NULL, 1);
|
||||
gst_encoding_video_profile_set_variableframerate (vprof, TRUE);
|
||||
|
||||
|
@ -1609,8 +1616,9 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
|||
|
||||
srcpad = gst_element_get_static_pad (camera->image_encodebin, "src");
|
||||
|
||||
gst_pad_add_event_probe (srcpad,
|
||||
(GCallback) gst_camera_bin_image_sink_event_probe, camera);
|
||||
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
||||
gst_camera_bin_image_sink_event_probe, gst_object_ref (camera),
|
||||
gst_object_unref);
|
||||
|
||||
gst_object_unref (srcpad);
|
||||
}
|
||||
|
@ -1738,8 +1746,9 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
gst_pad_add_buffer_probe (imgsrc,
|
||||
(GCallback) gst_camera_bin_image_src_buffer_probe, camera);
|
||||
gst_pad_add_probe (imgsrc, GST_PAD_PROBE_TYPE_BUFFER,
|
||||
gst_camera_bin_image_src_buffer_probe, gst_object_ref (camera),
|
||||
gst_object_unref);
|
||||
gst_object_unref (imgsrc);
|
||||
}
|
||||
|
||||
|
@ -1801,8 +1810,9 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
|
|||
|
||||
/* drop EOS for audiosrc elements that push them on state_changes
|
||||
* (basesrc does this) */
|
||||
gst_pad_add_event_probe (srcpad,
|
||||
(GCallback) gst_camera_bin_audio_src_event_probe, camera);
|
||||
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
||||
gst_camera_bin_audio_src_event_probe, gst_object_ref (camera),
|
||||
gst_object_unref);
|
||||
|
||||
gst_object_unref (srcpad);
|
||||
}
|
||||
|
@ -2133,8 +2143,7 @@ gst_camera_bin_set_property (GObject * object, guint prop_id,
|
|||
case PROP_VIDEO_ENCODING_PROFILE:
|
||||
if (camera->video_profile)
|
||||
gst_encoding_profile_unref (camera->video_profile);
|
||||
camera->video_profile =
|
||||
(GstEncodingProfile *) gst_value_dup_mini_object (value);
|
||||
camera->video_profile = (GstEncodingProfile *) g_value_dup_boxed (value);
|
||||
camera->video_profile_switch = TRUE;
|
||||
break;
|
||||
case PROP_IMAGE_FILTER:
|
||||
|
@ -2190,8 +2199,7 @@ gst_camera_bin_set_property (GObject * object, guint prop_id,
|
|||
case PROP_IMAGE_ENCODING_PROFILE:
|
||||
if (camera->image_profile)
|
||||
gst_encoding_profile_unref (camera->image_profile);
|
||||
camera->image_profile =
|
||||
(GstEncodingProfile *) gst_value_dup_mini_object (value);
|
||||
camera->image_profile = (GstEncodingProfile *) g_value_dup_boxed (value);
|
||||
camera->image_profile_switch = TRUE;
|
||||
break;
|
||||
case PROP_FLAGS:
|
||||
|
@ -2262,7 +2270,7 @@ gst_camera_bin_get_property (GObject * object, guint prop_id,
|
|||
* won't negotiate. Need to take care on the special case of the
|
||||
* pad being unlinked.
|
||||
*/
|
||||
caps = gst_pad_get_caps_reffed (pad);
|
||||
caps = gst_pad_query_caps (pad, NULL);
|
||||
if (caps) {
|
||||
gst_value_set_caps (value, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
@ -2328,8 +2336,7 @@ gst_camera_bin_get_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
case PROP_VIDEO_ENCODING_PROFILE:
|
||||
if (camera->video_profile) {
|
||||
gst_value_set_mini_object (value,
|
||||
(GstMiniObject *) camera->video_profile);
|
||||
g_value_set_boxed (value, camera->video_profile);
|
||||
}
|
||||
break;
|
||||
case PROP_VIDEO_FILTER:
|
||||
|
@ -2367,8 +2374,7 @@ gst_camera_bin_get_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
case PROP_IMAGE_ENCODING_PROFILE:
|
||||
if (camera->image_profile) {
|
||||
gst_value_set_mini_object (value,
|
||||
(GstMiniObject *) camera->image_profile);
|
||||
g_value_set_boxed (value, camera->image_profile);
|
||||
}
|
||||
break;
|
||||
case PROP_IDLE:
|
||||
|
|
|
@ -61,8 +61,8 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
);
|
||||
|
||||
/* class initialization */
|
||||
|
||||
GST_BOILERPLATE (GstViewfinderBin, gst_viewfinder_bin, GstBin, GST_TYPE_BIN);
|
||||
#define gst_viewfinder_bin_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstViewfinderBin, gst_viewfinder_bin, GST_TYPE_BIN);
|
||||
|
||||
static void gst_viewfinder_bin_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec);
|
||||
|
@ -95,19 +95,6 @@ gst_viewfinder_bin_dispose (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->dispose ((GObject *) viewfinderbin);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_viewfinder_bin_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&sink_template));
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "Viewfinder Bin",
|
||||
"Sink/Video", "Viewfinder Bin used in camerabin2",
|
||||
"Thiago Santos <thiago.sousa.santos@collabora.co.uk>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_viewfinder_bin_class_init (GstViewfinderBinClass * klass)
|
||||
{
|
||||
|
@ -134,11 +121,17 @@ gst_viewfinder_bin_class_init (GstViewfinderBinClass * klass)
|
|||
"If video converters should be disabled (must be set on NULL)",
|
||||
DEFAULT_DISABLE_CONVERTERS,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&sink_template));
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "Viewfinder Bin",
|
||||
"Sink/Video", "Viewfinder Bin used in camerabin2",
|
||||
"Thiago Santos <thiago.sousa.santos@collabora.com>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_viewfinder_bin_init (GstViewfinderBin * viewfinderbin,
|
||||
GstViewfinderBinClass * viewfinderbin_class)
|
||||
gst_viewfinder_bin_init (GstViewfinderBin * viewfinderbin)
|
||||
{
|
||||
GstPadTemplate *templ = gst_static_pad_template_get (&sink_template);
|
||||
viewfinderbin->ghostpad = gst_ghost_pad_new_no_target_from_template ("sink",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* GStreamer
|
||||
* Copyright (C) 2010 Texas Instruments, Inc
|
||||
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
|
||||
* Copyright (C) 2011 Thiago Santos <thiago.sousa.santos@collabora.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -44,8 +44,9 @@ enum
|
|||
GST_DEBUG_CATEGORY (wrapper_camera_bin_src_debug);
|
||||
#define GST_CAT_DEFAULT wrapper_camera_bin_src_debug
|
||||
|
||||
GST_BOILERPLATE (GstWrapperCameraBinSrc, gst_wrapper_camera_bin_src,
|
||||
GstBaseCameraSrc, GST_TYPE_BASE_CAMERA_SRC);
|
||||
#define gst_wrapper_camera_bin_src_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstWrapperCameraBinSrc, gst_wrapper_camera_bin_src,
|
||||
GST_TYPE_BIN);
|
||||
|
||||
static void set_capsfilter_caps (GstWrapperCameraBinSrc * self,
|
||||
GstCaps * new_caps);
|
||||
|
@ -165,13 +166,14 @@ gst_wrapper_camera_bin_reset_video_src_caps (GstWrapperCameraBinSrc * self,
|
|||
if (GST_IS_BIN (self->src_vid_src)) {
|
||||
GstIterator *it =
|
||||
gst_bin_iterate_elements (GST_BIN (self->src_vid_src));
|
||||
gpointer item = NULL;
|
||||
GValue item = { 0 };
|
||||
gboolean done = FALSE;
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (it, &item)) {
|
||||
case GST_ITERATOR_OK:
|
||||
gst_element_set_base_time (GST_ELEMENT (item), base_time);
|
||||
gst_object_unref (item);
|
||||
gst_element_set_base_time (GST_ELEMENT (g_value_get_object
|
||||
(&item)), base_time);
|
||||
g_value_unset (&item);
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
gst_iterator_resync (it);
|
||||
|
@ -197,20 +199,21 @@ gst_wrapper_camera_bin_reset_video_src_caps (GstWrapperCameraBinSrc * self,
|
|||
*
|
||||
* Buffer probe called before sending each buffer to image queue.
|
||||
*/
|
||||
static gboolean
|
||||
gst_wrapper_camera_bin_src_imgsrc_probe (GstPad * pad, GstBuffer * buffer,
|
||||
static GstPadProbeReturn
|
||||
gst_wrapper_camera_bin_src_imgsrc_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
gpointer data)
|
||||
{
|
||||
GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (data);
|
||||
GstBaseCameraSrc *camerasrc = GST_BASE_CAMERA_SRC (data);
|
||||
gboolean ret = FALSE;
|
||||
GstBuffer *buffer = GST_BUFFER (info->data);
|
||||
GstPadProbeReturn ret = GST_PAD_PROBE_DROP;
|
||||
|
||||
GST_LOG_OBJECT (self, "Image probe, mode %d, capture count %d",
|
||||
camerasrc->mode, self->image_capture_count);
|
||||
|
||||
g_mutex_lock (camerasrc->capturing_mutex);
|
||||
if (self->image_capture_count > 0) {
|
||||
ret = TRUE;
|
||||
ret = GST_PAD_PROBE_OK;
|
||||
self->image_capture_count--;
|
||||
|
||||
/* post preview */
|
||||
|
@ -232,13 +235,14 @@ gst_wrapper_camera_bin_src_imgsrc_probe (GstPad * pad, GstBuffer * buffer,
|
|||
*
|
||||
* Buffer probe called before sending each buffer to image queue.
|
||||
*/
|
||||
static gboolean
|
||||
gst_wrapper_camera_bin_src_vidsrc_probe (GstPad * pad, GstBuffer * buffer,
|
||||
static GstPadProbeReturn
|
||||
gst_wrapper_camera_bin_src_vidsrc_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
gpointer data)
|
||||
{
|
||||
GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (data);
|
||||
GstBaseCameraSrc *camerasrc = GST_BASE_CAMERA_SRC_CAST (self);
|
||||
gboolean ret = FALSE;
|
||||
GstPadProbeReturn ret = GST_PAD_PROBE_DROP;
|
||||
GstBuffer *buffer = GST_BUFFER (info->data);
|
||||
|
||||
GST_LOG_OBJECT (self, "Video probe, mode %d, capture status %d",
|
||||
camerasrc->mode, self->video_rec_status);
|
||||
|
@ -260,7 +264,7 @@ gst_wrapper_camera_bin_src_vidsrc_probe (GstPad * pad, GstBuffer * buffer,
|
|||
GST_DEBUG_OBJECT (self, "Posting preview for video");
|
||||
gst_base_camera_src_post_preview (camerasrc, buffer);
|
||||
|
||||
ret = TRUE;
|
||||
ret = GST_PAD_PROBE_OK;
|
||||
} else if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_FINISHING) {
|
||||
/* send eos */
|
||||
GST_DEBUG_OBJECT (self, "Finishing video recording, pushing eos");
|
||||
|
@ -268,14 +272,15 @@ gst_wrapper_camera_bin_src_vidsrc_probe (GstPad * pad, GstBuffer * buffer,
|
|||
self->video_rec_status = GST_VIDEO_RECORDING_STATUS_DONE;
|
||||
gst_base_camera_src_finish_capture (camerasrc);
|
||||
} else {
|
||||
ret = TRUE;
|
||||
ret = GST_PAD_PROBE_OK;
|
||||
}
|
||||
g_mutex_unlock (camerasrc->capturing_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_wrapper_camera_bin_src_event (GstPad * pad, GstEvent * event)
|
||||
gst_wrapper_camera_bin_src_event (GstPad * pad, GstObject * parent,
|
||||
GstEvent * event)
|
||||
{
|
||||
GstWrapperCameraBinSrc *src =
|
||||
GST_WRAPPER_CAMERA_BIN_SRC (GST_PAD_PARENT (pad));
|
||||
|
@ -292,25 +297,27 @@ gst_wrapper_camera_bin_src_event (GstPad * pad, GstEvent * event)
|
|||
src->video_renegotiate = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return src->srcpad_event_func (pad, event);
|
||||
//TODO porting
|
||||
//return src->srcpad_event_func (pad, event);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_wrapper_camera_src_src_event_probe (GstPad * pad, GstEvent * evt,
|
||||
static GstPadProbeReturn
|
||||
gst_wrapper_camera_src_src_event_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
gpointer udata)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
GstPadProbeReturn ret = GST_PAD_PROBE_OK;
|
||||
GstWrapperCameraBinSrc *self = udata;
|
||||
GstEvent *evt = GST_EVENT (info->data);
|
||||
|
||||
switch (GST_EVENT_TYPE (evt)) {
|
||||
case GST_EVENT_EOS:
|
||||
/* drop */
|
||||
ret = FALSE;
|
||||
ret = GST_PAD_PROBE_DROP;
|
||||
break;
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
case GST_EVENT_SEGMENT:
|
||||
if (self->drop_newseg) {
|
||||
ret = FALSE;
|
||||
ret = GST_PAD_PROBE_DROP;
|
||||
self->drop_newseg = FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -333,7 +340,7 @@ gst_wrapper_camera_bin_src_caps_cb (GObject * gobject, GParamSpec * pspec,
|
|||
/* get the new caps that were set on the capsfilter that configures the
|
||||
* source */
|
||||
src_caps_src_pad = gst_element_get_static_pad (self->src_filter, "src");
|
||||
caps = gst_pad_get_caps_reffed (src_caps_src_pad);
|
||||
caps = gst_pad_query_caps (src_caps_src_pad, NULL);
|
||||
gst_object_unref (src_caps_src_pad);
|
||||
GST_DEBUG_OBJECT (self, "src-filter caps changed to %s",
|
||||
gst_caps_to_string (caps));
|
||||
|
@ -429,8 +436,10 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
|
|||
GstPad *pad;
|
||||
pad = gst_element_get_static_pad (self->src_vid_src, "src");
|
||||
|
||||
self->src_event_probe_id = gst_pad_add_event_probe (pad,
|
||||
(GCallback) gst_wrapper_camera_src_src_event_probe, self);
|
||||
self->src_event_probe_id =
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
||||
gst_wrapper_camera_src_src_event_probe, gst_object_ref (self),
|
||||
gst_object_unref);
|
||||
gst_object_unref (pad);
|
||||
}
|
||||
|
||||
|
@ -500,10 +509,12 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
|
|||
g_assert (self->outsel_vidpad != NULL);
|
||||
g_assert (self->outsel_imgpad != NULL);
|
||||
|
||||
gst_pad_add_buffer_probe (self->outsel_imgpad,
|
||||
G_CALLBACK (gst_wrapper_camera_bin_src_imgsrc_probe), self);
|
||||
gst_pad_add_buffer_probe (self->outsel_vidpad,
|
||||
G_CALLBACK (gst_wrapper_camera_bin_src_vidsrc_probe), self);
|
||||
gst_pad_add_probe (self->outsel_imgpad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||
gst_wrapper_camera_bin_src_imgsrc_probe, gst_object_ref (self),
|
||||
gst_object_unref);
|
||||
gst_pad_add_probe (self->outsel_vidpad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||
gst_wrapper_camera_bin_src_vidsrc_probe, gst_object_ref (self),
|
||||
gst_object_unref);
|
||||
gst_ghost_pad_set_target (GST_GHOST_PAD (self->imgsrc),
|
||||
self->outsel_imgpad);
|
||||
gst_ghost_pad_set_target (GST_GHOST_PAD (self->vidsrc),
|
||||
|
@ -1047,19 +1058,6 @@ end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_wrapper_camera_bin_src_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (wrapper_camera_bin_src_debug, "wrappercamerabinsrc",
|
||||
0, "V4l2 camera src");
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class,
|
||||
"V4l2 camera src element for camerabin", "Source/Video",
|
||||
"V4l2 camera src element for camerabin", "Rob Clark <rob@ti.com>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_wrapper_camera_bin_src_class_init (GstWrapperCameraBinSrcClass * klass)
|
||||
{
|
||||
|
@ -1097,11 +1095,18 @@ gst_wrapper_camera_bin_src_class_init (GstWrapperCameraBinSrcClass * klass)
|
|||
gst_wrapper_camera_bin_src_start_capture;
|
||||
gstbasecamerasrc_class->stop_capture =
|
||||
gst_wrapper_camera_bin_src_stop_capture;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (wrapper_camera_bin_src_debug, "wrappercamerabinsrc",
|
||||
0, "wrapper camera src");
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class,
|
||||
"Wrapper camera src element for camerabin2", "Source/Video",
|
||||
"Wrapper camera src element for camerabin2",
|
||||
"Thiago Santos <thiago.sousa.santos@collabora.com>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_wrapper_camera_bin_src_init (GstWrapperCameraBinSrc * self,
|
||||
GstWrapperCameraBinSrcClass * klass)
|
||||
gst_wrapper_camera_bin_src_init (GstWrapperCameraBinSrc * self)
|
||||
{
|
||||
self->vfsrc =
|
||||
gst_ghost_pad_new_no_target (GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME,
|
||||
|
|
Loading…
Reference in a new issue