summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-09-27 16:14:18 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-09-27 16:14:18 +0000
commit668add505e154984bcba8e7d4a0f7b7b0a3c3358 (patch)
tree297291334bc1ecfd766f0cea86fffcda10056cc9
parent0b0c7f16f849d76c033c2e37c4d40ab2be513357 (diff)
downloadgst-plugins-bad-668add505e154984bcba8e7d4a0f7b7b0a3c3358.tar.gz
gst-plugins-bad-668add505e154984bcba8e7d4a0f7b7b0a3c3358.tar.bz2
gst-plugins-bad-668add505e154984bcba8e7d4a0f7b7b0a3c3358.zip
Small cleanups.
Original commit message from CVS: * sys/v4l2/gstv4l2object.c: (gst_v4l2_object_set_property_helper), (gst_v4l2_set_defaults): * sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read), (gst_v4l2src_create): * sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open): * sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities), (gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_set_norm), (gst_v4l2_get_frequency), (gst_v4l2_set_frequency), (gst_v4l2_signal_strength), (gst_v4l2_get_attribute), (gst_v4l2_set_attribute), (gst_v4l2_get_input), (gst_v4l2_set_input): * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list), (gst_v4l2src_grab_frame), (gst_v4l2src_get_capture), (gst_v4l2src_set_capture), (gst_v4l2src_capture_init), (gst_v4l2src_capture_start), (gst_v4l2src_capture_stop), (gst_v4l2src_buffer_new): * tests/icles/v4l2src-test.c: (my_bus_callback), (main): Small cleanups. Fix error messages. Use locks when getting timestamps. Fix leaks in test. Add licensing header to tests.
-rw-r--r--ChangeLog25
-rw-r--r--sys/v4l2/gstv4l2object.c11
-rw-r--r--sys/v4l2/gstv4l2src.c8
-rw-r--r--sys/v4l2/gstv4l2xoverlay.c2
-rw-r--r--sys/v4l2/v4l2_calls.c34
-rw-r--r--sys/v4l2/v4l2src_calls.c67
-rw-r--r--tests/icles/v4l2src-test.c37
7 files changed, 124 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index b85428ba..c55912e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2006-09-27 Wim Taymans <wim@fluendo.com>
+
+ * sys/v4l2/gstv4l2object.c: (gst_v4l2_object_set_property_helper),
+ (gst_v4l2_set_defaults):
+ * sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
+ (gst_v4l2src_create):
+ * sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open):
+ * sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
+ (gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_set_norm),
+ (gst_v4l2_get_frequency), (gst_v4l2_set_frequency),
+ (gst_v4l2_signal_strength), (gst_v4l2_get_attribute),
+ (gst_v4l2_set_attribute), (gst_v4l2_get_input),
+ (gst_v4l2_set_input):
+ * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
+ (gst_v4l2src_grab_frame), (gst_v4l2src_get_capture),
+ (gst_v4l2src_set_capture), (gst_v4l2src_capture_init),
+ (gst_v4l2src_capture_start), (gst_v4l2src_capture_stop),
+ (gst_v4l2src_buffer_new):
+ * tests/icles/v4l2src-test.c: (my_bus_callback), (main):
+ Small cleanups.
+ Fix error messages.
+ Use locks when getting timestamps.
+ Fix leaks in test.
+ Add licensing header to tests.
+
2006-09-27 Edgard Lima <edgard.lima@indt.org.br>
* sys/v4l2/gstv4l2colorbalance.c:
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index 5d08a6ad..bb834de0 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -308,8 +308,7 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object,
{
switch (prop_id) {
case PROP_DEVICE:
- if (v4l2object->videodev)
- g_free (v4l2object->videodev);
+ g_free (v4l2object->videodev);
v4l2object->videodev = g_value_dup_string (value);
break;
case PROP_STD:
@@ -436,9 +435,7 @@ gst_v4l2_set_defaults (GstV4l2Object * v4l2object)
norm =
GST_TUNER_NORM (gst_tuner_get_norm (GST_TUNER (v4l2object->element)));
if (norm) {
- if (v4l2object->std) {
- g_free (v4l2object->std);
- }
+ g_free (v4l2object->std);
v4l2object->std = g_strdup (norm->label);
gst_tuner_norm_changed (tuner, norm);
g_object_notify (G_OBJECT (v4l2object->element), "std");
@@ -453,9 +450,7 @@ gst_v4l2_set_defaults (GstV4l2Object * v4l2object)
channel =
GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2object->
element)));
- if (v4l2object->input) {
- g_free (v4l2object->input);
- }
+ g_free (v4l2object->input);
v4l2object->input = g_strdup (channel->label);
gst_tuner_channel_changed (tuner, channel);
g_object_notify (G_OBJECT (v4l2object->element), "input");
diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
index 7b943f17..9e0c925d 100644
--- a/sys/v4l2/gstv4l2src.c
+++ b/sys/v4l2/gstv4l2src.c
@@ -934,7 +934,7 @@ gst_v4l2src_get_read (GstV4l2Src * v4l2src, GstBuffer ** buf)
read_error:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC,
- (_("error read()ing %d bytes on device %s"),
+ (_("Error read()ing %d bytes on device %s."),
buffersize, v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
gst_buffer_unref (*buf);
return GST_FLOW_ERROR;
@@ -942,7 +942,7 @@ read_error:
short_read:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, (NULL),
- ("error read()ing a buffer on device %s: got only %d bytes instead of expected %d",
+ ("Error read()ing a buffer on device %s: got only %d bytes instead of expected %d.",
v4l2src->v4l2object->videodev, amount, buffersize));
gst_buffer_unref (*buf);
return GST_FLOW_ERROR;
@@ -1018,8 +1018,8 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf)
no_framerate:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
- (_("could not get frame rate for %s, try to set use-undef-fps "
- "property to true"), v4l2src->v4l2object->videodev), (NULL));
+ (_("Could not get frame rate for %s, try to set use-undef-fps "
+ "property to true."), v4l2src->v4l2object->videodev), (NULL));
return GST_FLOW_ERROR;
}
}
diff --git a/sys/v4l2/gstv4l2xoverlay.c b/sys/v4l2/gstv4l2xoverlay.c
index 817733b6..5a07e510 100644
--- a/sys/v4l2/gstv4l2xoverlay.c
+++ b/sys/v4l2/gstv4l2xoverlay.c
@@ -99,7 +99,7 @@ gst_v4l2_xoverlay_open (GstV4l2Object * v4l2object)
}
if (fstat (v4l2object->video_fd, &s) < 0) {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
- (_("Cannot identify device '%s'"), v4l2object->videodev),
+ (_("Cannot identify device '%s'."), v4l2object->videodev),
GST_ERROR_SYSTEM);
XCloseDisplay (dpy);
return;
diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
index 318508cf..6570517a 100644
--- a/sys/v4l2/v4l2_calls.c
+++ b/sys/v4l2/v4l2_calls.c
@@ -65,8 +65,8 @@ gst_v4l2_get_capabilities (GstV4l2Object * v4l2object)
cap_failed:
{
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- (_("Error getting capabilities for device '%s':"
- " It isn't a v4l2 driver. Check if it is a v4l1 driver"),
+ (_("Error getting capabilities for device '%s': "
+ "It isn't a v4l2 driver. Check if it is a v4l1 driver."),
v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -99,7 +99,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
break; /* end of enumeration */
else {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- ("Failed to get %d in input enumeration for %s",
+ (_("Failed to get %d in input enumeration for %s."),
n, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -119,7 +119,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
vtun.index = input.tuner;
if (ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- ("Failed to get tuner %d settings on %s",
+ (_("Failed to get tuner %d settings on %s."),
input.tuner, v4l2object->videodev), GST_ERROR_SYSTEM);
g_object_unref (G_OBJECT (channel));
return FALSE;
@@ -155,7 +155,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
break; /* end of enumeration */
else {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- ("Failed to get %d in norm enumeration for %s",
+ (_("Failed to get %d in norm enumeration for %s."),
n, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -197,7 +197,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
break;
} else {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- ("Failed to get %d in control enumeration for %s",
+ (_("Failed to get %d in control enumeration for %s."),
n, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -266,7 +266,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
break; /* end of enumeration */
else {
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
- ("Failed to get %d in menu enumeration for %s",
+ (_("Failed to get %d in menu enumeration for %s"),
n, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -382,14 +382,14 @@ gst_v4l2_open (GstV4l2Object * v4l2object)
stat_failed:
{
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
- (_("Cannot identify device '%s'"), v4l2object->videodev),
+ (_("Cannot identify device '%s'."), v4l2object->videodev),
GST_ERROR_SYSTEM);
goto error;
}
no_device:
{
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
- (_("This isn't a device '%s'"), v4l2object->videodev),
+ (_("This isn't a device '%s'."), v4l2object->videodev),
GST_ERROR_SYSTEM);
goto error;
}
@@ -498,7 +498,7 @@ gst_v4l2_set_norm (GstV4l2Object * v4l2object, v4l2_std_id norm)
std_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to set norm 0x%llx for device %s: %s"),
+ (_("Failed to set norm 0x%llx for device %s: %s."),
norm, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -535,7 +535,7 @@ gst_v4l2_get_frequency (GstV4l2Object * v4l2object,
freq_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to get current tuner frequency for device %s"),
+ (_("Failed to get current tuner frequency for device %s."),
v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -576,7 +576,7 @@ gst_v4l2_set_frequency (GstV4l2Object * v4l2object,
freq_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to set current tuner frequency for device %s to %lu"),
+ (_("Failed to set current tuner frequency for device %s to %lu."),
v4l2object->videodev, frequency), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -610,7 +610,7 @@ gst_v4l2_signal_strength (GstV4l2Object * v4l2object,
tuner_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to get signal strength for device %s"),
+ (_("Failed to get signal strength for device %s."),
v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -646,7 +646,7 @@ gst_v4l2_get_attribute (GstV4l2Object * v4l2object,
ctrl_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to get value for control %d on device %s"),
+ (_("Failed to get value for control %d on device %s."),
attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -681,7 +681,7 @@ gst_v4l2_set_attribute (GstV4l2Object * v4l2object,
ctrl_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to set value %d for control %d on device %s"),
+ (_("Failed to set value %d for control %d on device %s."),
value, attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -708,7 +708,7 @@ gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input)
input_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to get current input on device %s"),
+ (_("Failed to get current input on device %s."),
v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -731,7 +731,7 @@ gst_v4l2_set_input (GstV4l2Object * v4l2object, gint input)
input_failed:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
- (_("Failed to set input %d on device %s"),
+ (_("Failed to set input %d on device %s."),
input, v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c
index 489c1118..22995ee0 100644
--- a/sys/v4l2/v4l2src_calls.c
+++ b/sys/v4l2/v4l2src_calls.c
@@ -92,7 +92,7 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src)
failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
- (_("failed to get number %d in pixelformat enumeration for %s: %s"),
+ (_("Failed to get number %d in pixelformat enumeration for %s."),
n, v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
g_free (format);
return FALSE;
@@ -185,7 +185,7 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src)
break;
default:
GST_ELEMENT_WARNING (v4l2src, RESOURCE, FAILED,
- (_("Grabbing frame got interrupted on %s. No expected reason"),
+ (_("Grabbing frame got interrupted on %s. No expected reason."),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
break;
}
@@ -208,7 +208,7 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src)
einval:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, FAILED,
- (_("Failed trying to get frames from device %s"),
+ (_("Failed trying to get frames from device %s."),
v4l2src->v4l2object->videodev),
(_("The buffer type is not supported, or the index is out of bounds,"
" or no buffers have been allocated yet, or the userptr"
@@ -219,18 +219,18 @@ einval:
nomem:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, FAILED,
- (_("Failed trying to get frames from device %s. Not enough memory"),
+ (_("Failed trying to get frames from device %s. Not enough memory."),
v4l2src->v4l2object->videodev),
- (_("insufficient memory to enqueue a user pointer buffer. device %s"),
+ (_("insufficient memory to enqueue a user pointer buffer. device %s."),
v4l2src->v4l2object->videodev));
return -1;
}
too_many_trials:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, FAILED,
- (_("Failed trying to get frames from device %s"),
+ (_("Failed trying to get frames from device %s."),
v4l2src->v4l2object->videodev),
- (_("Failed after 100 tries. device %s"),
+ (_("Failed after 100 tries. device %s."),
v4l2src->v4l2object->videodev));
return -1;
}
@@ -261,7 +261,7 @@ gst_v4l2src_get_capture (GstV4l2Src * v4l2src)
fmt_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
- (_("failed to get pixelformat for device %s"),
+ (_("Failed to get pixelformat for device %s."),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -340,7 +340,7 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src,
fmt_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
- (_("failed to set pixelformat to %s @ %dx%d for device %s: %s"),
+ (_("Failed to set pixelformat to %s @ %dx%d for device %s: %s."),
fmt->description, *width, *height, v4l2src->v4l2object->videodev),
GST_ERROR_SYSTEM);
return FALSE;
@@ -348,13 +348,14 @@ fmt_failed:
pixfmt_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
- (_("failed to set pixelformat to %s @ %dx%d for device %s: %s"),
+ (_("Failed to set pixelformat to %s @ %dx%d for device %s: %s."),
fmt->description, *width, *height, v4l2src->v4l2object->videodev),
GST_ERROR_SYSTEM);
return FALSE;
}
fail:
{
+ /* ERROR was posted */
return FALSE;
}
}
@@ -474,7 +475,7 @@ reqbufs_failed:
broken_driver:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
- (_("the driver of device '%s' is broken."),
+ (_("The driver of device '%s' is broken."),
v4l2src->v4l2object->videodev),
("no supported read capability from %s",
v4l2src->v4l2object->videodev));
@@ -493,7 +494,7 @@ no_buffers:
querybuf_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
- (_("Could not get buffer properties of buffer %d"), n),
+ (_("Could not get buffer properties of buffer %d."), n),
GST_ERROR_SYSTEM);
gst_v4l2src_capture_deinit (v4l2src);
return FALSE;
@@ -501,7 +502,7 @@ querybuf_failed:
mmap_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
- (_("Could not mmap video buffer %d: %s"), n), GST_ERROR_SYSTEM);
+ (_("Could not mmap video buffer %d."), n), GST_ERROR_SYSTEM);
gst_v4l2src_capture_deinit (v4l2src);
buffer->start = 0;
return FALSE;
@@ -544,7 +545,7 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src)
streamon_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, OPEN_READ,
- (_("Error starting streaming capture from device %s"),
+ (_("Error starting streaming capture from device %s."),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -582,7 +583,7 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src)
streamoff_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, CLOSE,
- (_("Error stopping streaming capture from device %s: %s"),
+ (_("Error stopping streaming capture from device %s."),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -922,6 +923,8 @@ gst_v4l2src_buffer_new (GstV4l2Src * v4l2src, guint size, guint8 * data,
GstV4l2Buffer * srcbuf)
{
GstBuffer *buf;
+ GstClockTime timestamp, duration;
+ GstClock *clock;
if (data == NULL) {
buf = gst_buffer_new_and_alloc (size);
@@ -934,18 +937,38 @@ gst_v4l2src_buffer_new (GstV4l2Src * v4l2src, guint size, guint8 * data,
}
GST_BUFFER_SIZE (buf) = size;
- GST_BUFFER_TIMESTAMP (buf) =
- gst_clock_get_time (GST_ELEMENT (v4l2src)->clock);
- GST_BUFFER_TIMESTAMP (buf) -= GST_ELEMENT (v4l2src)->base_time;
- GST_BUFFER_OFFSET (buf) = v4l2src->offset++;
-
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
+
+ /* timestamps, LOCK to get clock and base time. */
+ GST_OBJECT_LOCK (v4l2src);
+ if ((clock = GST_ELEMENT_CLOCK (v4l2src))) {
+ /* we have a clock, get base time and ref clock */
+ timestamp = GST_ELEMENT (v4l2src)->base_time;
+ gst_object_ref (clock);
+ } else {
+ /* no clock, can't set timestamps */
+ timestamp = GST_CLOCK_TIME_NONE;
+ }
+ GST_OBJECT_UNLOCK (v4l2src);
+
+ if (clock) {
+ /* the time now is the time of the clock minus the base time */
+ timestamp = gst_clock_get_time (clock) - timestamp;
+ gst_object_unref (clock);
+ }
+
if (v4l2src->fps_n > 0) {
- GST_BUFFER_DURATION (buf) =
+ duration =
gst_util_uint64_scale_int (GST_SECOND, v4l2src->fps_d, v4l2src->fps_n);
} else {
- GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
+ duration = GST_CLOCK_TIME_NONE;
}
+ GST_BUFFER_TIMESTAMP (buf) = timestamp;
+ GST_BUFFER_DURATION (buf) = duration;
+
+ /* offsets */
+ GST_BUFFER_OFFSET (buf) = v4l2src->offset++;
+ GST_BUFFER_OFFSET_END (buf) = v4l2src->offset;
/* the negotiate() method already set caps on the source pad */
gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (v4l2src)));
diff --git a/tests/icles/v4l2src-test.c b/tests/icles/v4l2src-test.c
index cb2e98fa..a81c357d 100644
--- a/tests/icles/v4l2src-test.c
+++ b/tests/icles/v4l2src-test.c
@@ -1,3 +1,24 @@
+/* GStreamer
+ *
+ * Copyright (C) 2006 Edgard Lima <edgard dot lima at indt dot org dot br>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
@@ -300,10 +321,12 @@ my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
case GST_MESSAGE_ERROR:{
GError *err;
gchar *debug;
+ gchar *str;
gst_message_parse_error (message, &err, &debug);
- g_print ("%s error: %s\n",
- gst_element_get_name (message->src), err->message);
+ str = gst_element_get_name (message->src);
+ g_print ("%s error: %s\n", str, err->message);
+ g_free (str);
g_print ("Debug: %s\n", debug);
g_error_free (err);
@@ -336,7 +359,7 @@ main (int argc, char *argv[])
gchar input[128] = { '\0' };
gulong frequency = 0;
gboolean undeffps = FALSE;
-
+ GstBus *bus;
/* see for input option */
@@ -420,7 +443,6 @@ main (int argc, char *argv[])
}
}
-
/* Print any remaining command line arguments (not options). */
if (optind < argc) {
printf ("Use -h to see help message.\n" "non-option ARGV-elements: ");
@@ -429,8 +451,6 @@ main (int argc, char *argv[])
putchar ('\n');
}
-
-
/* init */
gst_init (&argc, &argv);
@@ -469,8 +489,8 @@ main (int argc, char *argv[])
}
/* you would normally check that the elements were created properly */
- gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
- my_bus_callback, NULL);
+ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+ gst_bus_add_watch (bus, my_bus_callback, NULL);
/* put together a pipeline */
gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL);
@@ -490,6 +510,7 @@ main (int argc, char *argv[])
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
+ gst_object_unref (bus);
gst_object_unref (pipeline);
gst_deinit ();