summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2004-01-12 02:11:03 +0000
committerBenjamin Otte <otte@gnome.org>2004-01-12 02:11:03 +0000
commit09984b518a5f6bbb91cec7568a8d2d28132439a6 (patch)
treeae068cc9fdf925ae3506fb7c4c8c2a2136544df1
parentf768ab94c7f8fe3aa53ee32499cedd810f1159a4 (diff)
downloadgst-plugins-bad-09984b518a5f6bbb91cec7568a8d2d28132439a6.tar.gz
gst-plugins-bad-09984b518a5f6bbb91cec7568a8d2d28132439a6.tar.bz2
gst-plugins-bad-09984b518a5f6bbb91cec7568a8d2d28132439a6.zip
gst-libs/gst/tuner/tuner.*: GObjects aren't const.
Original commit message from CVS: 2004-01-12 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst-libs/gst/tuner/tuner.c: (gst_tuner_class_init), (gst_tuner_find_norm_by_name), (gst_v4l2_find_channel_by_name), (gst_tuner_channel_changed), (gst_tuner_norm_changed), (gst_tuner_frequency_changed), (gst_tuner_signal_changed): * gst-libs/gst/tuner/tuner.h: GObjects aren't const. Add find_by_name functions. Add checks to _changed functions. * sys/v4l/gstv4ltuner.c: (gst_v4l_tuner_get_channel), (gst_v4l_tuner_get_norm): Fixes for above.
-rw-r--r--ChangeLog14
-rw-r--r--gst-libs/gst/tuner/tuner.c56
-rw-r--r--gst-libs/gst/tuner/tuner.h16
3 files changed, 76 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ed667dd..e2ab4e28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2004-01-12 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * gst-libs/gst/tuner/tuner.c: (gst_tuner_class_init),
+ (gst_tuner_find_norm_by_name), (gst_v4l2_find_channel_by_name),
+ (gst_tuner_channel_changed), (gst_tuner_norm_changed),
+ (gst_tuner_frequency_changed), (gst_tuner_signal_changed):
+ * gst-libs/gst/tuner/tuner.h:
+ GObjects aren't const.
+ Add find_by_name functions.
+ Add checks to _changed functions.
+ * sys/v4l/gstv4ltuner.c: (gst_v4l_tuner_get_channel),
+ (gst_v4l_tuner_get_norm):
+ Fixes for above.
+
+2004-01-12 Benjamin Otte <in7y118@public.uni-hamburg.de>
+
* gst-libs/gst/video/video.h:
Fix caps template names to be understandable.
Prefix everything with GST_VIDEO.
diff --git a/gst-libs/gst/tuner/tuner.c b/gst-libs/gst/tuner/tuner.c
index 24c4aa03..cc41402c 100644
--- a/gst-libs/gst/tuner/tuner.c
+++ b/gst-libs/gst/tuner/tuner.c
@@ -26,6 +26,8 @@
#include "tuner.h"
#include "tunermarshal.h"
+#include <string.h>
+
enum {
NORM_CHANGED,
CHANNEL_CHANGED,
@@ -86,14 +88,14 @@ gst_tuner_class_init (GstTunerClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GST_TYPE_TUNER_CHANNEL);
- gst_tuner_signals[NORM_CHANGED] =
+ gst_tuner_signals[FREQUENCY_CHANGED] =
g_signal_new ("frequency_changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
- gst_tuner_signals[NORM_CHANGED] =
+ gst_tuner_signals[SIGNAL_CHANGED] =
g_signal_new ("signal_changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, signal_changed),
@@ -141,7 +143,7 @@ gst_tuner_set_channel (GstTuner *tuner,
}
}
-const GstTunerChannel *
+GstTunerChannel *
gst_tuner_get_channel (GstTuner *tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -176,7 +178,7 @@ gst_tuner_set_norm (GstTuner *tuner,
}
}
-const GstTunerNorm *
+GstTunerNorm *
gst_tuner_get_norm (GstTuner *tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -235,10 +237,47 @@ gst_tuner_signal_strength (GstTuner *tuner,
return 0;
}
+GstTunerNorm *
+gst_tuner_find_norm_by_name (GstTuner *tuner, gchar *norm)
+{
+ GList *walk;
+
+ g_return_val_if_fail (GST_TUNER (tuner), NULL);
+ g_return_val_if_fail (norm != NULL, NULL);
+
+ walk = (GList *) gst_tuner_list_norms (tuner);
+ while (walk) {
+ if (strcmp (GST_TUNER_NORM (walk->data)->label, norm) == 0)
+ return GST_TUNER_NORM (walk->data);
+ walk = g_list_next (walk);
+ }
+ return NULL;
+}
+
+GstTunerChannel *
+gst_v4l2_find_channel_by_name (GstTuner *tuner, gchar *channel)
+{
+ GList *walk;
+
+ g_return_val_if_fail (GST_TUNER (tuner), NULL);
+ g_return_val_if_fail (channel != NULL, NULL);
+
+ walk = (GList *) gst_tuner_list_channels (tuner);
+ while (walk) {
+ if (strcmp (GST_TUNER_CHANNEL (walk->data)->label, channel) == 0)
+ return GST_TUNER_CHANNEL (walk->data);
+ walk = g_list_next (walk);
+ }
+ return NULL;
+}
+
void
gst_tuner_channel_changed (GstTuner *tuner,
GstTunerChannel *channel)
{
+ g_return_if_fail (GST_IS_TUNER (tuner));
+ g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
+
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[CHANNEL_CHANGED], 0,
channel);
@@ -248,6 +287,9 @@ void
gst_tuner_norm_changed (GstTuner *tuner,
GstTunerNorm *norm)
{
+ g_return_if_fail (GST_IS_TUNER (tuner));
+ g_return_if_fail (GST_IS_TUNER_NORM (norm));
+
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[NORM_CHANGED], 0,
norm);
@@ -258,6 +300,9 @@ gst_tuner_frequency_changed (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency)
{
+ g_return_if_fail (GST_IS_TUNER (tuner));
+ g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
+
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[FREQUENCY_CHANGED], 0,
channel, frequency);
@@ -272,6 +317,9 @@ gst_tuner_signal_changed (GstTuner *tuner,
GstTunerChannel *channel,
gint signal)
{
+ g_return_if_fail (GST_IS_TUNER (tuner));
+ g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
+
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[SIGNAL_CHANGED], 0,
channel, signal);
diff --git a/gst-libs/gst/tuner/tuner.h b/gst-libs/gst/tuner/tuner.h
index b1991c2c..de02051a 100644
--- a/gst-libs/gst/tuner/tuner.h
+++ b/gst-libs/gst/tuner/tuner.h
@@ -50,14 +50,13 @@ typedef struct _GstTunerClass {
const GList * (* list_channels) (GstTuner *tuner);
void (* set_channel) (GstTuner *tuner,
GstTunerChannel *channel);
- const GstTunerChannel *
+ GstTunerChannel *
(* get_channel) (GstTuner *tuner);
const GList * (* list_norms) (GstTuner *tuner);
void (* set_norm) (GstTuner *tuner,
GstTunerNorm *norm);
- const GstTunerNorm *
- (* get_norm) (GstTuner *tuner);
+ GstTunerNorm *(* get_norm) (GstTuner *tuner);
void (* set_frequency) (GstTuner *tuner,
GstTunerChannel *channel,
@@ -88,14 +87,13 @@ GType gst_tuner_get_type (void);
const GList * gst_tuner_list_channels (GstTuner *tuner);
void gst_tuner_set_channel (GstTuner *tuner,
GstTunerChannel *channel);
-const GstTunerChannel *
+GstTunerChannel *
gst_tuner_get_channel (GstTuner *tuner);
const GList * gst_tuner_list_norms (GstTuner *tuner);
void gst_tuner_set_norm (GstTuner *tuner,
GstTunerNorm *channel);
-const GstTunerNorm *
- gst_tuner_get_norm (GstTuner *tuner);
+GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner);
void gst_tuner_set_frequency (GstTuner *tuner,
GstTunerChannel *channel,
@@ -105,6 +103,12 @@ gulong gst_tuner_get_frequency (GstTuner *tuner,
gint gst_tuner_signal_strength (GstTuner *tuner,
GstTunerChannel *channel);
+/* helper functions */
+GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
+ gchar *norm);
+GstTunerChannel * gst_tuner_find_channel_by_name(GstTuner *tuner,
+ gchar *channel);
+
/* trigger signals */
void gst_tuner_channel_changed (GstTuner *tuner,
GstTunerChannel *channel);