From 0b3ad60269ececdfac4e66effc3d4918cbc95414 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Tue, 18 Jan 2011 17:31:06 -0300 Subject: [PATCH] camerabin: add names for more elements --- gst/camerabin/camerabingeneral.c | 4 +++- gst/camerabin/camerabingeneral.h | 2 +- gst/camerabin/camerabinvideo.c | 17 +++++++++++------ gst/camerabin/gstcamerabin.c | 29 +++++++++++++++++++---------- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/gst/camerabin/camerabingeneral.c b/gst/camerabin/camerabingeneral.c index b82b22cfc9..f47b9d23bf 100644 --- a/gst/camerabin/camerabingeneral.c +++ b/gst/camerabin/camerabingeneral.c @@ -114,6 +114,7 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem) * 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 @@ -122,7 +123,8 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem) * 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; diff --git a/gst/camerabin/camerabingeneral.h b/gst/camerabin/camerabingeneral.h index 0e84e4ad28..12a4d46937 100644 --- a/gst/camerabin/camerabingeneral.h +++ b/gst/camerabin/camerabingeneral.h @@ -25,7 +25,7 @@ gboolean gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem); gboolean gst_camerabin_add_element (GstBin * bin, GstElement * new_elem); -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); diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c index 6b0ed107bf..9100518767 100644 --- a/gst/camerabin/camerabinvideo.c +++ b/gst/camerabin/camerabinvideo.c @@ -542,7 +542,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) } /* Add tee element */ - if (!(vid->tee = gst_camerabin_create_and_add_element (vidbin, "tee"))) { + if (!(vid->tee = + gst_camerabin_create_and_add_element (vidbin, "tee", "video-tee"))) { goto error; } @@ -569,7 +570,7 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) if (vid->flags & GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION) { /* Add colorspace converter */ if (gst_camerabin_create_and_add_element (vidbin, - "ffmpegcolorspace") == NULL) { + "ffmpegcolorspace", "video-ffmpegcolorspace") == NULL) { goto error; } } @@ -581,7 +582,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) goto error; } } else if (!(vid->vid_enc = - gst_camerabin_create_and_add_element (vidbin, DEFAULT_VID_ENC))) { + gst_camerabin_create_and_add_element (vidbin, DEFAULT_VID_ENC, + "video-encoder"))) { goto error; } @@ -592,13 +594,15 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) goto error; } } else if (!(vid->muxer = - gst_camerabin_create_and_add_element (vidbin, DEFAULT_MUX))) { + gst_camerabin_create_and_add_element (vidbin, DEFAULT_MUX, + "video-muxer"))) { goto error; } /* Add sink element for storing the video */ if (!(vid->sink = - gst_camerabin_create_and_add_element (vidbin, DEFAULT_SINK))) { + gst_camerabin_create_and_add_element (vidbin, DEFAULT_SINK, + "video-sink"))) { goto error; } g_object_set (G_OBJECT (vid->sink), "location", vid->filename->str, "buffer-mode", 2, /* non buffered io */ @@ -648,7 +652,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) goto error; } } else if (!(vid->aud_enc = - gst_camerabin_create_and_add_element (vidbin, DEFAULT_AUD_ENC))) { + gst_camerabin_create_and_add_element (vidbin, DEFAULT_AUD_ENC, + "audio-encoder"))) { goto error; } diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 2744e58744..0cc6444ae6 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -591,21 +591,26 @@ camerabin_create_src_elements (GstCameraBin * camera) goto done; } if (camera->flags & GST_CAMERABIN_FLAG_SOURCE_COLOR_CONVERSION) { - if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace")) + if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace", + "src-ffmpegcolorspace")) goto done; } if (!(camera->src_filter = - gst_camerabin_create_and_add_element (cbin, "capsfilter"))) + gst_camerabin_create_and_add_element (cbin, "capsfilter", + "src-capsfilter"))) goto done; if (camera->flags & GST_CAMERABIN_FLAG_SOURCE_RESIZE) { if (!(camera->src_zoom_crop = - gst_camerabin_create_and_add_element (cbin, "videocrop"))) + gst_camerabin_create_and_add_element (cbin, "videocrop", + "src-videocrop"))) goto done; if (!(camera->src_zoom_scale = - gst_camerabin_create_and_add_element (cbin, "videoscale"))) + gst_camerabin_create_and_add_element (cbin, "videoscale", + "src-videoscale"))) goto done; if (!(camera->src_zoom_filter = - gst_camerabin_create_and_add_element (cbin, "capsfilter"))) + gst_camerabin_create_and_add_element (cbin, "capsfilter", + "src-resize-capsfilter"))) goto done; } if (camera->app_video_filter) { @@ -614,7 +619,7 @@ camerabin_create_src_elements (GstCameraBin * camera) } } if (!(camera->src_out_sel = - gst_camerabin_create_and_add_element (cbin, "output-selector"))) + gst_camerabin_create_and_add_element (cbin, "output-selector", NULL))) goto done; /* Set pad-negotiation-mode to active */ @@ -681,7 +686,8 @@ camerabin_create_view_elements (GstCameraBin * camera) GstBin *cbin = GST_BIN (camera); if (!(camera->view_in_sel = - gst_camerabin_create_and_add_element (cbin, "input-selector"))) { + gst_camerabin_create_and_add_element (cbin, "input-selector", + NULL))) { goto error; } @@ -696,18 +702,21 @@ camerabin_create_view_elements (GstCameraBin * camera) /* Add videoscale in case we need to downscale frame for view finder */ if (camera->flags & GST_CAMERABIN_FLAG_VIEWFINDER_SCALE) { if (!(camera->view_scale = - gst_camerabin_create_and_add_element (cbin, "videoscale"))) { + gst_camerabin_create_and_add_element (cbin, "videoscale", + "vf-videoscale"))) { goto error; } /* Add capsfilter to maintain aspect ratio while scaling */ if (!(camera->aspect_filter = - gst_camerabin_create_and_add_element (cbin, "capsfilter"))) { + gst_camerabin_create_and_add_element (cbin, "capsfilter", + "vf-scale-capsfilter"))) { goto error; } } if (camera->flags & GST_CAMERABIN_FLAG_VIEWFINDER_COLOR_CONVERSION) { - if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace")) { + if (!gst_camerabin_create_and_add_element (cbin, "ffmpegcolorspace", + "vf-ffmpegcolorspace")) { goto error; } }