gst_plugins_base/gst-libs/gst/interfaces/tunerchannel.c
changeset 0 0e761a78d257
child 7 567bb019e3e3
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer Tuner
       
     2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
       
     3  *
       
     4  * tunerchannel.c: tuner channel object design
       
     5  *
       
     6  * This library is free software; you can redistribute it and/or
       
     7  * modify it under the terms of the GNU Library General Public
       
     8  * License as published by the Free Software Foundation; either
       
     9  * version 2 of the License, or (at your option) any later version.
       
    10  *
       
    11  * This library is distributed in the hope that it will be useful,
       
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    14  * Library General Public License for more details.
       
    15  *
       
    16  * You should have received a copy of the GNU Library General Public
       
    17  * License along with this library; if not, write to the
       
    18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    19  * Boston, MA 02111-1307, USA.
       
    20  */
       
    21 
       
    22 #ifdef HAVE_CONFIG_H
       
    23 #include "config.h"
       
    24 #endif
       
    25 
       
    26 #include "tunerchannel.h"
       
    27 
       
    28 enum
       
    29 {
       
    30   /* FILL ME */
       
    31   SIGNAL_FREQUENCY_CHANGED,
       
    32   SIGNAL_SIGNAL_CHANGED,
       
    33   LAST_SIGNAL
       
    34 };
       
    35 
       
    36 static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
       
    37 static void gst_tuner_channel_init (GstTunerChannel * channel);
       
    38 static void gst_tuner_channel_dispose (GObject * object);
       
    39 
       
    40 static GObjectClass *parent_class = NULL;
       
    41 static guint signals[LAST_SIGNAL] = { 0 };
       
    42 #ifdef __SYMBIAN32__
       
    43 EXPORT_C
       
    44 #endif
       
    45 
       
    46 
       
    47 GType
       
    48 gst_tuner_channel_get_type (void)
       
    49 {
       
    50   static GType gst_tuner_channel_type = 0;
       
    51 
       
    52   if (!gst_tuner_channel_type) {
       
    53     static const GTypeInfo tuner_channel_info = {
       
    54       sizeof (GstTunerChannelClass),
       
    55       NULL,
       
    56       NULL,
       
    57       (GClassInitFunc) gst_tuner_channel_class_init,
       
    58       NULL,
       
    59       NULL,
       
    60       sizeof (GstTunerChannel),
       
    61       0,
       
    62       (GInstanceInitFunc) gst_tuner_channel_init,
       
    63       NULL
       
    64     };
       
    65 
       
    66     gst_tuner_channel_type =
       
    67         g_type_register_static (G_TYPE_OBJECT,
       
    68         "GstTunerChannel", &tuner_channel_info, 0);
       
    69   }
       
    70 
       
    71   return gst_tuner_channel_type;
       
    72 }
       
    73 
       
    74 static void
       
    75 gst_tuner_channel_class_init (GstTunerChannelClass * klass)
       
    76 {
       
    77   GObjectClass *object_klass = (GObjectClass *) klass;
       
    78 
       
    79   parent_class = g_type_class_peek_parent (klass);
       
    80 
       
    81   signals[SIGNAL_FREQUENCY_CHANGED] =
       
    82       g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
       
    83       G_SIGNAL_RUN_LAST,
       
    84       G_STRUCT_OFFSET (GstTunerChannelClass,
       
    85           frequency_changed),
       
    86       NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
       
    87   signals[SIGNAL_SIGNAL_CHANGED] =
       
    88       g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
       
    89       G_SIGNAL_RUN_LAST,
       
    90       G_STRUCT_OFFSET (GstTunerChannelClass,
       
    91           signal_changed),
       
    92       NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
       
    93 
       
    94   object_klass->dispose = gst_tuner_channel_dispose;
       
    95 }
       
    96 
       
    97 static void
       
    98 gst_tuner_channel_init (GstTunerChannel * channel)
       
    99 {
       
   100   channel->label = NULL;
       
   101   channel->flags = 0;
       
   102   channel->min_frequency = channel->max_frequency = 0;
       
   103   channel->min_signal = channel->max_signal = 0;
       
   104 }
       
   105 
       
   106 static void
       
   107 gst_tuner_channel_dispose (GObject * object)
       
   108 {
       
   109   GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
       
   110 
       
   111   if (channel->label) {
       
   112     g_free (channel->label);
       
   113     channel->label = NULL;
       
   114   }
       
   115 
       
   116   if (parent_class->dispose)
       
   117     parent_class->dispose (object);
       
   118 }