summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorEdgard Lima <edgard.lima@indt.org.br>2006-05-01 21:37:51 +0000
committerEdgard Lima <edgard.lima@indt.org.br>2006-05-01 21:37:51 +0000
commit3281a636374c4baeab2cdbd31991744198cd62cf (patch)
tree852565c885a0d07ad64152eb1bced9a8338c5379 /sys
parent9e8733719f54b7511cc6d66aa55a957b24921ded (diff)
downloadgst-plugins-bad-3281a636374c4baeab2cdbd31991744198cd62cf.tar.gz
gst-plugins-bad-3281a636374c4baeab2cdbd31991744198cd62cf.tar.bz2
gst-plugins-bad-3281a636374c4baeab2cdbd31991744198cd62cf.zip
Few improvements to move to good.
Original commit message from CVS: Few improvements to move to good.
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/Makefile.am38
-rw-r--r--sys/v4l2/gstv4l2colorbalance.c43
-rw-r--r--sys/v4l2/gstv4l2xoverlay.c15
-rw-r--r--sys/v4l2/v4l2_calls.c53
4 files changed, 72 insertions, 77 deletions
diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am
index 165657a0..547e0687 100644
--- a/sys/v4l2/Makefile.am
+++ b/sys/v4l2/Makefile.am
@@ -8,23 +8,29 @@ xv_source =
xv_libs =
endif
-libgstvideo4linux2_la_SOURCES = \
- gstv4l2.c \
- gstv4l2colorbalance.c \
- gstv4l2element.c \
- gstv4l2src.c \
- gstv4l2tuner.c \
- v4l2_calls.c \
- v4l2src_calls.c $(xv_source)
+libgstvideo4linux2_la_SOURCES = gstv4l2.c \
+ gstv4l2colorbalance.c \
+ gstv4l2element.c \
+ gstv4l2src.c \
+ gstv4l2tuner.c \
+ v4l2_calls.c \
+ v4l2src_calls.c \
+ $(xv_source)
-libgstvideo4linux2_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) $(GST_BASE_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS)
+libgstvideo4linux2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) \
+ $(GST_CFLAGS) \
+ $(X_CFLAGS)
+
libgstvideo4linux2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideo4linux2_la_LIBADD = \
- -lgstinterfaces-$(GST_MAJORMINOR) \
- $(GST_BASE_LIBS) $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) $(xv_libs)
+
+libgstvideo4linux2_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+ $(GST_BASE_LIBS) \
+ $(GST_LIBS) \
+ $(xv_libs) \
+ -lgstinterfaces-$(GST_MAJORMINOR)
noinst_HEADERS = gstv4l2element.h v4l2_calls.h \
- gstv4l2src.h v4l2src_calls.h \
- gstv4l2tuner.h gstv4l2xoverlay.h \
- gstv4l2colorbalance.h
+ gstv4l2src.h v4l2src_calls.h \
+ gstv4l2tuner.h gstv4l2xoverlay.h \
+ gstv4l2colorbalance.h
diff --git a/sys/v4l2/gstv4l2colorbalance.c b/sys/v4l2/gstv4l2colorbalance.c
index cfb3d578..7a0378f7 100644
--- a/sys/v4l2/gstv4l2colorbalance.c
+++ b/sys/v4l2/gstv4l2colorbalance.c
@@ -27,12 +27,6 @@
#include "gstv4l2colorbalance.h"
#include "gstv4l2element.h"
-static void
-gst_v4l2_color_balance_channel_class_init (GstV4l2ColorBalanceChannelClass *
- klass);
-static void gst_v4l2_color_balance_channel_init (GstV4l2ColorBalanceChannel *
- channel);
-
static const GList *gst_v4l2_color_balance_list_channels (GstColorBalance *
balance);
static void gst_v4l2_color_balance_set_value (GstColorBalance * balance,
@@ -40,44 +34,27 @@ static void gst_v4l2_color_balance_set_value (GstColorBalance * balance,
static gint gst_v4l2_color_balance_get_value (GstColorBalance * balance,
GstColorBalanceChannel * channel);
-static GstColorBalanceChannelClass *parent_class = NULL;
-GType
-gst_v4l2_color_balance_channel_get_type (void)
+GST_BOILERPLATE (GstV4l2ColorBalanceChannel,
+ gst_v4l2_color_balance_channel,
+ GstColorBalanceChannel, GST_TYPE_COLOR_BALANCE_CHANNEL);
+
+
+static void
+gst_v4l2_color_balance_channel_base_init (gpointer g_class)
{
- static GType gst_v4l2_color_balance_channel_type = 0;
-
- if (!gst_v4l2_color_balance_channel_type) {
- static const GTypeInfo v4l2_tuner_channel_info = {
- sizeof (GstV4l2ColorBalanceChannelClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_v4l2_color_balance_channel_class_init,
- NULL,
- NULL,
- sizeof (GstV4l2ColorBalanceChannel),
- 0,
- (GInstanceInitFunc) gst_v4l2_color_balance_channel_init,
- NULL
- };
-
- gst_v4l2_color_balance_channel_type =
- g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL,
- "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0);
- }
-
- return gst_v4l2_color_balance_channel_type;
}
+
static void
gst_v4l2_color_balance_channel_class_init (GstV4l2ColorBalanceChannelClass *
klass)
{
- parent_class = g_type_class_peek_parent (klass);
}
static void
-gst_v4l2_color_balance_channel_init (GstV4l2ColorBalanceChannel * channel)
+gst_v4l2_color_balance_channel_init (GstV4l2ColorBalanceChannel * channel,
+ GstV4l2ColorBalanceChannelClass * klass)
{
channel->id = (guint32) - 1;
}
diff --git a/sys/v4l2/gstv4l2xoverlay.c b/sys/v4l2/gstv4l2xoverlay.c
index 66ea505c..8d597a45 100644
--- a/sys/v4l2/gstv4l2xoverlay.c
+++ b/sys/v4l2/gstv4l2xoverlay.c
@@ -71,30 +71,33 @@ gst_v4l2_xoverlay_open (GstV4l2Element * v4l2element)
/* we need a display, obviously */
if (!name || !(dpy = XOpenDisplay (name))) {
- GST_WARNING ("No $DISPLAY set or failed to open - no overlay");
+ GST_WARNING_OBJECT (v4l2element,
+ "No $DISPLAY set or failed to open - no overlay");
return;
}
/* First let's check that XVideo extension is available */
if (!XQueryExtension (dpy, "XVideo", &i, &i, &i)) {
- GST_WARNING ("Xv extension not available - no overlay");
+ GST_WARNING_OBJECT (v4l2element, "Xv extension not available - no overlay");
XCloseDisplay (dpy);
return;
}
/* find port that belongs to this device */
if (XvQueryExtension (dpy, &ver, &rel, &req, &ev, &err) != Success) {
- GST_WARNING ("Xv extension not supported - no overlay");
+ GST_WARNING_OBJECT (v4l2element, "Xv extension not supported - no overlay");
XCloseDisplay (dpy);
return;
}
if (XvQueryAdaptors (dpy, DefaultRootWindow (dpy), &anum, &ai) != Success) {
- GST_WARNING ("Failed to query Xv adaptors");
+ GST_WARNING_OBJECT (v4l2element, "Failed to query Xv adaptors");
XCloseDisplay (dpy);
return;
}
if (fstat (v4l2element->video_fd, &s) < 0) {
- GST_ERROR ("Failed to stat() file descriptor: %s", g_strerror (errno));
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, GST_RESOURCE_ERROR_NOT_FOUND,
+ (_("Cannot identify '%s': %d, %s\n"),
+ v4l2element->videodev, errno, strerror (errno)), GST_ERROR_SYSTEM);
XCloseDisplay (dpy);
return;
}
@@ -112,7 +115,7 @@ gst_v4l2_xoverlay_open (GstV4l2Element * v4l2element)
XvFreeAdaptorInfo (ai);
if (id == 0) {
- GST_WARNING ("Did not find XvPortID for device - no overlay");
+ GST_WARNING (v4l2element, "Did not find XvPortID for device - no overlay");
XCloseDisplay (dpy);
return;
}
diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
index 81516b41..a43811fd 100644
--- a/sys/v4l2/v4l2_calls.c
+++ b/sys/v4l2/v4l2_calls.c
@@ -48,13 +48,14 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2_debug);
gboolean
gst_v4l2_get_capabilities (GstV4l2Element * v4l2element)
{
- GST_DEBUG ("getting capabilities");
+ GST_DEBUG_OBJECT (v4l2element, "getting capabilities");
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) {
- GST_ERROR_OBJECT (v4l2element, "Error getting %s capabilities: %s",
- v4l2element->videodev, g_strerror (errno));
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS,
+ (_("Error getting capabilities '%s': %d, %s\n"),
+ v4l2element->videodev, errno, strerror (errno)), GST_ERROR_SYSTEM);
return FALSE;
}
@@ -74,7 +75,7 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
gint n;
GstPadDirection dir = GST_PAD_UNKNOWN;
- GST_DEBUG ("getting enumerations");
+ GST_DEBUG_OBJECT (v4l2element, "getting enumerations");
GST_V4L2_CHECK_OPEN (v4l2element);
if (dir != GST_PAD_SINK) {
@@ -242,7 +243,8 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
/* we only handle these for now */
break;
default:
- GST_DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n);
+ GST_DEBUG_OBJECT (v4l2element, "ControlID %s (%d) unhandled, FIXME",
+ control.name, n);
control.id++;
break;
}
@@ -305,7 +307,7 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element)
static void
gst_v4l2_empty_lists (GstV4l2Element * v4l2element)
{
- GST_DEBUG ("deleting enumerations");
+ GST_DEBUG_OBJECT (v4l2element, "deleting enumerations");
g_list_foreach (v4l2element->inputs, (GFunc) g_object_unref, NULL);
g_list_free (v4l2element->inputs);
@@ -381,7 +383,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element)
{
struct stat st;
- GST_DEBUG ("Trying to open device %s", v4l2element->videodev);
+ GST_DEBUG_OBJECT (v4l2element, "Trying to open device %s",
+ v4l2element->videodev);
GST_V4L2_CHECK_NOT_OPEN (v4l2element);
GST_V4L2_CHECK_NOT_ACTIVE (v4l2element);
@@ -391,12 +394,15 @@ gst_v4l2_open (GstV4l2Element * v4l2element)
/* check if it is a device */
if (-1 == stat (v4l2element->videodev, &st)) {
- GST_ERROR ("Cannot identify '%s': %d, %s\n",
- v4l2element->videodev, errno, strerror (errno));
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND,
+ (_("Cannot identify '%s': %d, %s\n"),
+ v4l2element->videodev, errno, strerror (errno)), GST_ERROR_SYSTEM);
goto error;
}
if (!S_ISCHR (st.st_mode)) {
- GST_ERROR ("%s is no device\n", v4l2element->videodev);
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND,
+ (_("It isn't a device '%s': %d, %s\n"),
+ v4l2element->videodev, errno, strerror (errno)), GST_ERROR_SYSTEM);
goto error;
}
@@ -460,7 +466,7 @@ error:
gboolean
gst_v4l2_close (GstV4l2Element * v4l2element)
{
- GST_DEBUG ("Trying to close %s", v4l2element->videodev);
+ GST_DEBUG_OBJECT (v4l2element, "Trying to close %s", v4l2element->videodev);
GST_V4L2_CHECK_OPEN (v4l2element);
GST_V4L2_CHECK_NOT_ACTIVE (v4l2element);
@@ -484,7 +490,7 @@ gst_v4l2_close (GstV4l2Element * v4l2element)
gboolean
gst_v4l2_get_norm (GstV4l2Element * v4l2element, v4l2_std_id * norm)
{
- GST_DEBUG ("getting norm");
+ GST_DEBUG_OBJECT (v4l2element, "getting norm");
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
@@ -508,7 +514,7 @@ gst_v4l2_get_norm (GstV4l2Element * v4l2element, v4l2_std_id * norm)
gboolean
gst_v4l2_set_norm (GstV4l2Element * v4l2element, v4l2_std_id norm)
{
- GST_DEBUG ("trying to set norm to %llx", norm);
+ GST_DEBUG_OBJECT (v4l2element, "trying to set norm to %llx", norm);
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
if (!GST_V4L2_IS_ACTIVE (v4l2element))
@@ -536,7 +542,7 @@ gst_v4l2_get_input (GstV4l2Element * v4l2element, gint * input)
{
gint n;
- GST_DEBUG ("trying to get input");
+ GST_DEBUG_OBJECT (v4l2element, "trying to get input");
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
@@ -562,7 +568,7 @@ gst_v4l2_get_input (GstV4l2Element * v4l2element, gint * input)
gboolean
gst_v4l2_set_input (GstV4l2Element * v4l2element, gint input)
{
- GST_DEBUG ("trying to set input to %d", input);
+ GST_DEBUG_OBJECT (v4l2element, "trying to set input to %d", input);
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
if (!GST_V4L2_IS_ACTIVE (v4l2element))
@@ -589,7 +595,7 @@ gst_v4l2_get_output (GstV4l2Element * v4l2element, gint * output)
{
gint n;
- GST_DEBUG ("trying to get output");
+ GST_DEBUG_OBJECT (v4l2element, "trying to get output");
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
@@ -615,7 +621,7 @@ gst_v4l2_get_output (GstV4l2Element * v4l2element, gint * output)
gboolean
gst_v4l2_set_output (GstV4l2Element * v4l2element, gint output)
{
- GST_DEBUG ("trying to set output to %d", output);
+ GST_DEBUG_OBJECT (v4l2element, "trying to set output to %d", output);
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
if (!GST_V4L2_IS_ACTIVE (v4l2element))
@@ -645,7 +651,7 @@ gst_v4l2_get_frequency (GstV4l2Element * v4l2element,
struct v4l2_frequency freq;
GstTunerChannel *channel;
- GST_DEBUG ("getting current tuner frequency");
+ GST_DEBUG_OBJECT (v4l2element, "getting current tuner frequency");
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
@@ -678,7 +684,8 @@ gst_v4l2_set_frequency (GstV4l2Element * v4l2element,
struct v4l2_frequency freq;
GstTunerChannel *channel;
- GST_DEBUG ("setting current tuner frequency to %lu", frequency);
+ GST_DEBUG_OBJECT (v4l2element, "setting current tuner frequency to %lu",
+ frequency);
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
if (!GST_V4L2_IS_ACTIVE (v4l2element))
@@ -714,7 +721,7 @@ gst_v4l2_signal_strength (GstV4l2Element * v4l2element,
{
struct v4l2_tuner tuner;
- GST_DEBUG ("trying to get signal strength");
+ GST_DEBUG_OBJECT (v4l2element, "trying to get signal strength");
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
@@ -747,7 +754,8 @@ gst_v4l2_get_attribute (GstV4l2Element * v4l2element,
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
- GST_DEBUG ("getting value of attribute %d", attribute_num);
+ GST_DEBUG_OBJECT (v4l2element, "getting value of attribute %d",
+ attribute_num);
control.id = attribute_num;
@@ -779,7 +787,8 @@ gst_v4l2_set_attribute (GstV4l2Element * v4l2element,
if (!GST_V4L2_IS_OPEN (v4l2element))
return FALSE;
- GST_DEBUG ("setting value of attribute %d to %d", attribute_num, value);
+ GST_DEBUG_OBJECT (v4l2element, "setting value of attribute %d to %d",
+ attribute_num, value);
control.id = attribute_num;
control.value = value;