diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2006-09-27 16:14:18 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2006-09-27 16:14:18 +0000 |
commit | 668add505e154984bcba8e7d4a0f7b7b0a3c3358 (patch) | |
tree | 297291334bc1ecfd766f0cea86fffcda10056cc9 /tests | |
parent | 0b0c7f16f849d76c033c2e37c4d40ab2be513357 (diff) | |
download | gst-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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/icles/v4l2src-test.c | 37 |
1 files changed, 29 insertions, 8 deletions
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 (); |