camerabin: add names for more elements

This commit is contained in:
Thiago Santos 2011-01-18 17:31:06 -03:00
parent 03fc02132f
commit 0b3ad60269
4 changed files with 34 additions and 18 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}
}