2003-10-10 12:47:41 +00:00
|
|
|
/* GStreamer Tuner
|
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
*
|
|
|
|
* tunerchannel.c: tuner channel object design
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "tunerchannel.h"
|
|
|
|
|
2008-05-09 21:42:26 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gsttunerchannel
|
|
|
|
* @short_description: A channel from an element implementing the #GstTuner
|
|
|
|
* interface.
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>The #GstTunerChannel object is provided by an element implementing
|
|
|
|
* the #GstTuner interface.
|
|
|
|
* </para>
|
|
|
|
* <para>
|
|
|
|
* GstTunerChannel provides a name and flags to determine the type and
|
|
|
|
* capabilities of the channel. If the GST_TUNER_CHANNEL_FREQUENCY flag is
|
|
|
|
* set, then the channel also information about the minimum and maximum
|
|
|
|
* frequency, and range of the reported signal strength.
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-10-10 12:47:41 +00:00
|
|
|
/* FILL ME */
|
|
|
|
SIGNAL_FREQUENCY_CHANGED,
|
|
|
|
SIGNAL_SIGNAL_CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
|
|
|
|
static void gst_tuner_channel_init (GstTunerChannel * channel);
|
|
|
|
static void gst_tuner_channel_dispose (GObject * object);
|
2003-10-10 12:47:41 +00:00
|
|
|
|
|
|
|
static GObjectClass *parent_class = NULL;
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
GType
|
|
|
|
gst_tuner_channel_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gst_tuner_channel_type = 0;
|
|
|
|
|
|
|
|
if (!gst_tuner_channel_type) {
|
|
|
|
static const GTypeInfo tuner_channel_info = {
|
|
|
|
sizeof (GstTunerChannelClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_tuner_channel_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstTunerChannel),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_tuner_channel_init,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
gst_tuner_channel_type =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_type_register_static (G_TYPE_OBJECT,
|
|
|
|
"GstTunerChannel", &tuner_channel_info, 0);
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return gst_tuner_channel_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_tuner_channel_class_init (GstTunerChannelClass * klass)
|
2003-10-10 12:47:41 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_klass = (GObjectClass *) klass;
|
|
|
|
|
2006-04-08 21:02:53 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2003-10-10 12:47:41 +00:00
|
|
|
|
2008-05-09 21:42:26 +00:00
|
|
|
/**
|
|
|
|
* GstTunerChannel::frequency-changed:
|
|
|
|
* @tunerchannel: The #GstTunerChannel
|
|
|
|
* @frequency: The new frequency (an unsigned long)
|
|
|
|
*
|
|
|
|
* Reports that the current frequency has changed.
|
|
|
|
*/
|
2003-10-10 12:47:41 +00:00
|
|
|
signals[SIGNAL_FREQUENCY_CHANGED] =
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstTunerChannelClass,
|
2004-03-15 19:32:28 +00:00
|
|
|
frequency_changed),
|
2004-03-14 22:34:34 +00:00
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
|
2008-05-09 21:42:26 +00:00
|
|
|
/**
|
|
|
|
* GstTunerChannel::signal-changed:
|
|
|
|
* @tunerchannel: The #GstTunerChannel
|
|
|
|
* @signal: The new signal strength (an integer)
|
|
|
|
*
|
|
|
|
* Reports that the signal strength has changed.
|
|
|
|
*
|
|
|
|
* See Also: gst_tuner_signal_strength()
|
|
|
|
*/
|
2003-10-10 12:47:41 +00:00
|
|
|
signals[SIGNAL_SIGNAL_CHANGED] =
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstTunerChannelClass,
|
2004-03-15 19:32:28 +00:00
|
|
|
signal_changed),
|
2004-03-14 22:34:34 +00:00
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
2003-10-10 12:47:41 +00:00
|
|
|
|
|
|
|
object_klass->dispose = gst_tuner_channel_dispose;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_tuner_channel_init (GstTunerChannel * channel)
|
2003-10-10 12:47:41 +00:00
|
|
|
{
|
|
|
|
channel->label = NULL;
|
|
|
|
channel->flags = 0;
|
|
|
|
channel->min_frequency = channel->max_frequency = 0;
|
|
|
|
channel->min_signal = channel->max_signal = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_tuner_channel_dispose (GObject * object)
|
2003-10-10 12:47:41 +00:00
|
|
|
{
|
|
|
|
GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
|
|
|
|
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
if (channel->label) {
|
2003-10-10 12:47:41 +00:00
|
|
|
g_free (channel->label);
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
channel->label = NULL;
|
|
|
|
}
|
2003-10-10 12:47:41 +00:00
|
|
|
|
|
|
|
if (parent_class->dispose)
|
|
|
|
parent_class->dispose (object);
|
|
|
|
}
|