camerabin2: remove abreviations from imagecapturebin

This commit is contained in:
Teemu Katajisto 2010-12-10 17:45:40 +02:00 committed by Thiago Santos
parent 7c47fc497f
commit e5d388698a

View file

@ -68,14 +68,14 @@ static void
gst_image_capture_bin_set_property (GObject * object, guint prop_id, gst_image_capture_bin_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstImageCaptureBin *imgbin = GST_IMAGE_CAPTURE_BIN_CAST (object); GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (object);
switch (prop_id) { switch (prop_id) {
case PROP_LOCATION: case PROP_LOCATION:
g_free (imgbin->location); g_free (imagebin->location);
imgbin->location = g_value_dup_string (value); imagebin->location = g_value_dup_string (value);
if (imgbin->sink) { if (imagebin->sink) {
g_object_set (imgbin, "location", imgbin->location, NULL); g_object_set (imagebin, "location", imagebin->location, NULL);
} }
break; break;
default: default:
@ -88,11 +88,11 @@ static void
gst_image_capture_bin_get_property (GObject * object, guint prop_id, gst_image_capture_bin_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstImageCaptureBin *imgbin = GST_IMAGE_CAPTURE_BIN_CAST (object); GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (object);
switch (prop_id) { switch (prop_id) {
case PROP_LOCATION: case PROP_LOCATION:
g_value_set_string (value, imgbin->location); g_value_set_string (value, imagebin->location);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -147,66 +147,66 @@ gst_image_capture_bin_class_init (GstImageCaptureBinClass * klass)
} }
static void static void
gst_image_capture_bin_init (GstImageCaptureBin * image_capturebin, gst_image_capture_bin_init (GstImageCaptureBin * imagebin,
GstImageCaptureBinClass * image_capturebin_class) GstImageCaptureBinClass * imagebin_class)
{ {
GstPadTemplate *tmpl; GstPadTemplate *tmpl;
tmpl = gst_static_pad_template_get (&sink_template); tmpl = gst_static_pad_template_get (&sink_template);
image_capturebin->ghostpad = imagebin->ghostpad =
gst_ghost_pad_new_no_target_from_template ("sink", tmpl); gst_ghost_pad_new_no_target_from_template ("sink", tmpl);
gst_object_unref (tmpl); gst_object_unref (tmpl);
gst_element_add_pad (GST_ELEMENT_CAST (imagebin), imagebin->ghostpad);
gst_element_add_pad (GST_ELEMENT_CAST (image_capturebin), imagebin->location = g_strdup (DEFAULT_LOCATION);
image_capturebin->ghostpad);
image_capturebin->location = g_strdup (DEFAULT_LOCATION);
} }
static gboolean static gboolean
gst_image_capture_bin_create_elements (GstImageCaptureBin * icbin) gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
{ {
GstElement *csp; GstElement *colorspace;
GstElement *enc; GstElement *encoder;
GstElement *mux; GstElement *muxer;
GstElement *sink; GstElement *sink;
GstPad *pad = NULL; GstPad *pad = NULL;
if (icbin->elements_created) if (imagebin->elements_created)
return TRUE; return TRUE;
/* create elements */ /* create elements */
csp = gst_element_factory_make ("ffmpegcolorspace", "icbin-csp"); colorspace =
if (!csp) gst_element_factory_make ("ffmpegcolorspace", "imagebin-colorspace");
if (!colorspace)
goto error; goto error;
enc = gst_element_factory_make ("jpegenc", "icbin-enc"); encoder = gst_element_factory_make ("jpegenc", "imagebin-encoder");
if (!enc) if (!encoder)
goto error; goto error;
mux = gst_element_factory_make ("jifmux", "icbin-mux"); muxer = gst_element_factory_make ("jifmux", "imagebin-muxer");
if (!mux) if (!muxer)
goto error; goto error;
sink = gst_element_factory_make ("multifilesink", "icbin-sink"); sink = gst_element_factory_make ("multifilesink", "imagebin-sink");
if (!sink) if (!sink)
goto error; goto error;
icbin->sink = sink; imagebin->sink = sink;
g_object_set (sink, "location", icbin->location, "async", FALSE, NULL); g_object_set (sink, "location", imagebin->location, "async", FALSE, NULL);
/* add and link */ /* add and link */
gst_bin_add_many (GST_BIN_CAST (icbin), csp, enc, mux, sink, NULL); gst_bin_add_many (GST_BIN_CAST (imagebin), colorspace, encoder, muxer, sink,
if (!gst_element_link_many (csp, enc, mux, sink, NULL)) NULL);
if (!gst_element_link_many (colorspace, encoder, muxer, sink, NULL))
goto error; goto error;
/* add ghostpad */ /* add ghostpad */
pad = gst_element_get_static_pad (csp, "sink"); pad = gst_element_get_static_pad (colorspace, "sink");
if (!gst_ghost_pad_set_target (GST_GHOST_PAD (icbin->ghostpad), pad)) if (!gst_ghost_pad_set_target (GST_GHOST_PAD (imagebin->ghostpad), pad))
goto error; goto error;
gst_object_unref (pad); gst_object_unref (pad);
icbin->elements_created = TRUE; imagebin->elements_created = TRUE;
return TRUE; return TRUE;
error: error:
@ -219,11 +219,11 @@ static GstStateChangeReturn
gst_image_capture_bin_change_state (GstElement * element, GstStateChange trans) gst_image_capture_bin_change_state (GstElement * element, GstStateChange trans)
{ {
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstImageCaptureBin *icbin = GST_IMAGE_CAPTURE_BIN_CAST (element); GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (element);
switch (trans) { switch (trans) {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
if (!gst_image_capture_bin_create_elements (icbin)) { if (!gst_image_capture_bin_create_elements (imagebin)) {
return GST_STATE_CHANGE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
break; break;