mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 04:52:28 +00:00
camerabin2: Add names to some elements
Adds names to instances of some elements to make debugging easier
This commit is contained in:
parent
6395b45908
commit
b66dde5746
4 changed files with 35 additions and 20 deletions
|
@ -138,6 +138,7 @@ gst_camerabin_try_add_element (GstBin * bin, const gchar * srcpad,
|
|||
* gst_camerabin_create_and_add_element:
|
||||
* @bin: tries adding an element to this bin
|
||||
* @elem_name: name of the element to be created
|
||||
* @instance_name: name of the instance of the element to be created
|
||||
*
|
||||
* Creates an element according to given name and
|
||||
* adds it to given @bin. Looks for an unconnected src pad
|
||||
|
@ -146,14 +147,15 @@ gst_camerabin_try_add_element (GstBin * bin, const gchar * srcpad,
|
|||
* Returns: pointer to the new element if successful, NULL otherwise.
|
||||
*/
|
||||
GstElement *
|
||||
gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name)
|
||||
gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name,
|
||||
const gchar * instance_name)
|
||||
{
|
||||
GstElement *new_elem;
|
||||
|
||||
g_return_val_if_fail (bin, FALSE);
|
||||
g_return_val_if_fail (elem_name, FALSE);
|
||||
|
||||
new_elem = gst_element_factory_make (elem_name, NULL);
|
||||
new_elem = gst_element_factory_make (elem_name, instance_name);
|
||||
if (!new_elem) {
|
||||
GST_ELEMENT_ERROR (bin, CORE, MISSING_PLUGIN, (NULL),
|
||||
("could not create \"%s\" element.", elem_name));
|
||||
|
@ -187,7 +189,8 @@ try_element (GstElement * bin, GstElement * element, gboolean unref)
|
|||
|
||||
GstElement *
|
||||
gst_camerabin_setup_default_element (GstBin * bin, GstElement * user_elem,
|
||||
const gchar * auto_elem_name, const gchar * default_elem_name)
|
||||
const gchar * auto_elem_name, const gchar * default_elem_name,
|
||||
const gchar * instance_name)
|
||||
{
|
||||
GstElement *elem;
|
||||
|
||||
|
@ -197,13 +200,13 @@ gst_camerabin_setup_default_element (GstBin * bin, GstElement * user_elem,
|
|||
} else {
|
||||
/* only try fallback if no specific sink was chosen */
|
||||
GST_DEBUG_OBJECT (bin, "trying %s", auto_elem_name);
|
||||
elem = gst_element_factory_make (auto_elem_name, NULL);
|
||||
elem = gst_element_factory_make (auto_elem_name, instance_name);
|
||||
elem = try_element (GST_ELEMENT_CAST (bin), elem, TRUE);
|
||||
if (elem == NULL) {
|
||||
/* if default sink from config.h is different then try it too */
|
||||
if (strcmp (default_elem_name, auto_elem_name)) {
|
||||
GST_DEBUG_OBJECT (bin, "trying %s", default_elem_name);
|
||||
elem = gst_element_factory_make (default_elem_name, NULL);
|
||||
elem = gst_element_factory_make (default_elem_name, instance_name);
|
||||
elem = try_element (GST_ELEMENT_CAST (bin), elem, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,10 @@ gboolean gst_camerabin_try_add_element (GstBin * bin, const gchar * srcpad, GstE
|
|||
gboolean gst_camerabin_add_element (GstBin * bin, GstElement * new_elem);
|
||||
gboolean gst_camerabin_add_element_full (GstBin * bin, const gchar * srcpad, GstElement * new_elem, const gchar * dstpad);
|
||||
|
||||
GstElement *gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name);
|
||||
GstElement *gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name, const gchar * instance_name);
|
||||
|
||||
GstElement * gst_camerabin_setup_default_element (GstBin * bin, GstElement *user_elem, const gchar *auto_elem_name, const gchar *default_elem_name);
|
||||
GstElement * gst_camerabin_setup_default_element (GstBin * bin, GstElement *user_elem, const gchar *auto_elem_name, const gchar *default_elem_name,
|
||||
const gchar * instance_elem_name);
|
||||
|
||||
void gst_camerabin_remove_elements_from_bin (GstBin * bin);
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
/* create elements */
|
||||
colorspace =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin),
|
||||
DEFAULT_COLORSPACE);
|
||||
DEFAULT_COLORSPACE, "imagebin-colorspace");
|
||||
if (!colorspace)
|
||||
goto error;
|
||||
|
||||
|
@ -273,7 +273,7 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
} else {
|
||||
imagebin->encoder =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin),
|
||||
DEFAULT_ENCODER);
|
||||
DEFAULT_ENCODER, "imagebin-encoder");
|
||||
if (!imagebin->encoder)
|
||||
goto error;
|
||||
}
|
||||
|
@ -286,13 +286,14 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
} else {
|
||||
imagebin->muxer =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin),
|
||||
DEFAULT_MUXER);
|
||||
DEFAULT_MUXER, "imagebin-muxer");
|
||||
if (!imagebin->muxer)
|
||||
goto error;
|
||||
}
|
||||
|
||||
imagebin->sink =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin), DEFAULT_SINK);
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin), DEFAULT_SINK,
|
||||
"imagebin-sink");
|
||||
if (!imagebin->sink)
|
||||
goto error;
|
||||
|
||||
|
|
|
@ -298,7 +298,8 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
|
|||
|
||||
/* Add application set or default video src element */
|
||||
if (!(self->src_vid_src = gst_camerabin_setup_default_element (cbin,
|
||||
self->app_vid_src, "autovideosrc", DEFAULT_VIDEOSRC))) {
|
||||
self->app_vid_src, "autovideosrc", DEFAULT_VIDEOSRC,
|
||||
"camerasrc-real-src"))) {
|
||||
self->src_vid_src = NULL;
|
||||
goto done;
|
||||
} else {
|
||||
|
@ -319,24 +320,30 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
|
|||
gst_object_unref (pad);
|
||||
}
|
||||
|
||||
if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace"))
|
||||
if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace",
|
||||
"src-colorspace"))
|
||||
goto done;
|
||||
|
||||
if (!(self->src_filter =
|
||||
gst_camerabin_create_and_add_element (cbin, "capsfilter")))
|
||||
gst_camerabin_create_and_add_element (cbin, "capsfilter",
|
||||
"src-capsfilter")))
|
||||
goto done;
|
||||
|
||||
if (!(self->src_zoom_crop =
|
||||
gst_camerabin_create_and_add_element (cbin, "videocrop")))
|
||||
gst_camerabin_create_and_add_element (cbin, "videocrop",
|
||||
"zoom-crop")))
|
||||
goto done;
|
||||
if (!(self->src_zoom_scale =
|
||||
gst_camerabin_create_and_add_element (cbin, "videoscale")))
|
||||
gst_camerabin_create_and_add_element (cbin, "videoscale",
|
||||
"zoom-scale")))
|
||||
goto done;
|
||||
if (!(self->src_zoom_filter =
|
||||
gst_camerabin_create_and_add_element (cbin, "capsfilter")))
|
||||
gst_camerabin_create_and_add_element (cbin, "capsfilter",
|
||||
"zoom-capsfilter")))
|
||||
goto done;
|
||||
|
||||
if (!(tee = gst_camerabin_create_and_add_element (cbin, "tee")))
|
||||
if (!(tee =
|
||||
gst_camerabin_create_and_add_element (cbin, "tee", "camerasrc-tee")))
|
||||
goto done;
|
||||
|
||||
/* viewfinder pad */
|
||||
|
@ -345,9 +352,12 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
|
|||
gst_object_unref (vf_pad);
|
||||
|
||||
/* the viewfinder should always work, so we add some converters to it */
|
||||
if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace"))
|
||||
if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace",
|
||||
"viewfinder-colorspace"))
|
||||
goto done;
|
||||
if (!(videoscale = gst_camerabin_create_and_add_element (cbin, "videoscale")))
|
||||
if (!(videoscale =
|
||||
gst_camerabin_create_and_add_element (cbin, "videoscale",
|
||||
"viewfinder-scale")))
|
||||
goto done;
|
||||
|
||||
/* image/video pad from tee */
|
||||
|
|
Loading…
Reference in a new issue