2002-12-30 18:01:31 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:13 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
#include <string.h>
|
2002-12-30 18:01:31 +00:00
|
|
|
#include <cdaudio.h>
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2005-12-06 19:55:58 +00:00
|
|
|
#define GST_TYPE_CDAUDIO (gst_cdaudio_get_type())
|
|
|
|
#define GST_CDAUDIO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CDAUDIO,GstCDAudio))
|
|
|
|
#define GST_CDAUDIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CDAUDIO,GstCDAudioClass))
|
|
|
|
#define GST_IS_CDAUDIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CDAUDIO))
|
|
|
|
#define GST_IS_CDAUDIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CDAUDIO))
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
typedef struct _GstCDAudio GstCDAudio;
|
|
|
|
typedef struct _GstCDAudioClass GstCDAudioClass;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
struct _GstCDAudio
|
|
|
|
{
|
|
|
|
GstBin element;
|
|
|
|
|
2002-12-30 18:01:31 +00:00
|
|
|
/* properties */
|
2004-03-14 22:34:33 +00:00
|
|
|
gchar *device;
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
gchar *uri;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gint cd_desc;
|
|
|
|
gulong discid;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gboolean was_playing;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
struct disc_info info;
|
|
|
|
struct disc_volume volume;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GTimer *timer;
|
2002-12-30 18:01:31 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
struct _GstCDAudioClass
|
|
|
|
{
|
|
|
|
GstBinClass parent_class;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
void (*close_tray) (GstElement * element);
|
2002-12-30 18:01:31 +00:00
|
|
|
/* signal callbacks */
|
2004-03-14 22:34:33 +00:00
|
|
|
void (*track_change) (GstElement * element, guint track);
|
2002-12-30 18:01:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* props */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0,
|
|
|
|
ARG_DEVICE,
|
|
|
|
ARG_DISCID,
|
|
|
|
ARG_VOLUME_FR,
|
|
|
|
ARG_VOLUME_FL,
|
|
|
|
ARG_VOLUME_BR,
|
2004-05-21 23:28:57 +00:00
|
|
|
ARG_VOLUME_BL
|
2002-12-30 18:01:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* signals */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TRACK_CHANGE,
|
2004-05-21 23:28:57 +00:00
|
|
|
LAST_SIGNAL
|
2002-12-30 18:01:31 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_cdaudio_class_init (GstCDAudioClass * klass);
|
|
|
|
static void gst_cdaudio_init (GstCDAudio * cdaudio);
|
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
|
|
|
static void gst_cdaudio_finalize (GObject * object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
static void gst_cdaudio_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * spec);
|
|
|
|
static void gst_cdaudio_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * spec);
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn gst_cdaudio_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
static const GstEventMask *gst_cdaudio_get_event_masks (GstElement * element);
|
|
|
|
static gboolean gst_cdaudio_send_event (GstElement * element, GstEvent * event);
|
|
|
|
static const GstFormat *gst_cdaudio_get_formats (GstElement * element);
|
|
|
|
static gboolean gst_cdaudio_convert (GstElement * element,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value);
|
|
|
|
static const GstQueryType *gst_cdaudio_get_query_types (GstElement * element);
|
|
|
|
static gboolean gst_cdaudio_query (GstElement * element, GstQueryType type,
|
|
|
|
GstFormat * format, gint64 * value);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static void cdaudio_uri_handler_init (gpointer g_iface, gpointer iface_data);
|
|
|
|
|
2002-12-30 18:01:31 +00:00
|
|
|
static GstFormat track_format;
|
|
|
|
static GstFormat sector_format;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static GstBinClass *parent_class;
|
2002-12-30 18:01:31 +00:00
|
|
|
static guint gst_cdaudio_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2006-04-25 21:56:38 +00:00
|
|
|
static const GstElementDetails gst_cdaudio_details =
|
|
|
|
GST_ELEMENT_DETAILS ("CD player",
|
2006-04-06 11:35:26 +00:00
|
|
|
"Generic/Bin",
|
|
|
|
"Play CD audio through the CD Drive",
|
|
|
|
"Wim Taymans <wim@fluendo.com>");
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static void
|
|
|
|
_do_init (GType cdaudio_type)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static const GInterfaceInfo urihandler_info = {
|
|
|
|
cdaudio_uri_handler_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
g_type_add_interface_static (cdaudio_type, GST_TYPE_URI_HANDLER,
|
|
|
|
&urihandler_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstCDAudio, gst_cdaudio, GstBin, GST_TYPE_BIN, _do_init);
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_cdaudio_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_cdaudio_details);
|
|
|
|
|
|
|
|
/* Register the track and sector format */
|
|
|
|
track_format = gst_format_register ("track", "CD track");
|
|
|
|
sector_format = gst_format_register ("sector", "CD sector");
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_cdaudio_class_init (GstCDAudioClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_klass;
|
|
|
|
GstElementClass *gstelement_klass;
|
|
|
|
GstBinClass *gstbin_klass;
|
|
|
|
|
|
|
|
gobject_klass = (GObjectClass *) klass;
|
|
|
|
gstelement_klass = (GstElementClass *) klass;
|
|
|
|
gstbin_klass = (GstBinClass *) klass;
|
|
|
|
|
2006-04-08 21:48:01 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
gobject_klass->set_property = gst_cdaudio_set_property;
|
|
|
|
gobject_klass->get_property = gst_cdaudio_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_klass, ARG_DEVICE,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_string ("device", "Device", "CDROM device",
|
2004-03-15 19:32:27 +00:00
|
|
|
NULL, G_PARAM_READWRITE));
|
2002-12-30 18:01:31 +00:00
|
|
|
g_object_class_install_property (gobject_klass, ARG_DISCID,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_ulong ("discid", "Disc ID", "CDDB Disc ID",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, G_MAXULONG, 0, G_PARAM_READABLE));
|
2002-12-30 18:01:31 +00:00
|
|
|
g_object_class_install_property (gobject_klass, ARG_VOLUME_FL,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_int ("volume_fl", "Volume fl", "Front left volume",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, 255, 255, G_PARAM_READWRITE));
|
2002-12-30 18:01:31 +00:00
|
|
|
g_object_class_install_property (gobject_klass, ARG_VOLUME_FR,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_int ("volume_fr", "Volume fr", "Front right volume",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, 255, 255, G_PARAM_READWRITE));
|
2002-12-30 18:01:31 +00:00
|
|
|
g_object_class_install_property (gobject_klass, ARG_VOLUME_BL,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_int ("volume_bl", "Volume bl", "Back left volume",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, 255, 255, G_PARAM_READWRITE));
|
2002-12-30 18:01:31 +00:00
|
|
|
g_object_class_install_property (gobject_klass, ARG_VOLUME_BR,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_int ("volume_br", "Volume br", "Back right volume",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, 255, 255, G_PARAM_READWRITE));
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
gst_cdaudio_signals[TRACK_CHANGE] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("track-change", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCDAudioClass, track_change), NULL,
|
|
|
|
NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
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
|
|
|
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_cdaudio_finalize);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gstelement_klass->change_state = GST_DEBUG_FUNCPTR (gst_cdaudio_change_state);
|
|
|
|
gstelement_klass->get_event_masks =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_cdaudio_get_event_masks);
|
|
|
|
gstelement_klass->send_event = GST_DEBUG_FUNCPTR (gst_cdaudio_send_event);
|
|
|
|
gstelement_klass->get_formats = GST_DEBUG_FUNCPTR (gst_cdaudio_get_formats);
|
|
|
|
gstelement_klass->convert = GST_DEBUG_FUNCPTR (gst_cdaudio_convert);
|
|
|
|
gstelement_klass->get_query_types =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_cdaudio_get_query_types);
|
|
|
|
gstelement_klass->query = GST_DEBUG_FUNCPTR (gst_cdaudio_query);
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-08-28 17:59:20 +00:00
|
|
|
gst_cdaudio_init (GstCDAudio * cdaudio, GstCDAudioClass * g_class)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
cdaudio->device = g_strdup ("/dev/cdrom");
|
|
|
|
cdaudio->was_playing = FALSE;
|
|
|
|
cdaudio->timer = g_timer_new ();
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
GST_OBJECT_FLAG_SET (cdaudio, GST_BIN_FLAG_MANAGER);
|
|
|
|
GST_OBJECT_FLAG_SET (cdaudio, GST_BIN_SELF_SCHEDULABLE);
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
gst_cdaudio_finalize (GObject * object)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
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
|
|
|
GstCDAudio *cdaudio = GST_CDAUDIO (object);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
g_timer_destroy (cdaudio->timer);
|
|
|
|
g_free (cdaudio->device);
|
|
|
|
|
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
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_cdaudio_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * spec)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
GstCDAudio *cdaudio;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_CDAUDIO (object));
|
|
|
|
|
|
|
|
cdaudio = GST_CDAUDIO (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_FR:
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_FL:
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_BR:
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_BL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_cdaudio_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * spec)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
GstCDAudio *cdaudio;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_CDAUDIO (object));
|
|
|
|
|
|
|
|
cdaudio = GST_CDAUDIO (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
|
|
|
g_value_set_string (value, cdaudio->device);
|
|
|
|
break;
|
|
|
|
case ARG_DISCID:
|
|
|
|
g_value_set_ulong (value, cdaudio->discid);
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_FR:
|
|
|
|
g_value_set_int (value, cdaudio->volume.vol_front.right);
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_FL:
|
|
|
|
g_value_set_int (value, cdaudio->volume.vol_front.left);
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_BR:
|
|
|
|
g_value_set_int (value, cdaudio->volume.vol_back.right);
|
|
|
|
break;
|
|
|
|
case ARG_VOLUME_BL:
|
|
|
|
g_value_set_int (value, cdaudio->volume.vol_back.left);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-20 16:48:57 +00:00
|
|
|
debug_track_info (GstCDAudio * cdaudio)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
2004-10-20 16:48:57 +00:00
|
|
|
for (i = 0; i < cdaudio->info.disc_total_tracks; i++) {
|
|
|
|
GST_DEBUG_OBJECT (cdaudio, "%d %d %d %d:%02d", i,
|
|
|
|
cdaudio->info.disc_track[i].track_length.frames,
|
|
|
|
cdaudio->info.disc_track[i].track_pos.frames,
|
|
|
|
cdaudio->info.disc_track[i].track_length.minutes,
|
|
|
|
cdaudio->info.disc_track[i].track_length.seconds);
|
|
|
|
}
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_cdaudio_change_state (GstElement * element, GstStateChange transition)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
GstCDAudio *cdaudio;
|
|
|
|
|
|
|
|
cdaudio = GST_CDAUDIO (element);
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2002-12-30 18:01:31 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2004-03-14 22:34:33 +00:00
|
|
|
cdaudio->cd_desc = cd_init_device (cdaudio->device);
|
|
|
|
if (cdaudio->cd_desc < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
/* close tray */
|
|
|
|
if (cd_close (cdaudio->cd_desc) < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
if (cd_stat (cdaudio->cd_desc, &cdaudio->info) < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-10-20 16:48:57 +00:00
|
|
|
debug_track_info (cdaudio);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
cdaudio->discid = cddb_discid (cdaudio->cd_desc);
|
|
|
|
g_object_notify (G_OBJECT (cdaudio), "discid");
|
|
|
|
|
|
|
|
cdaudio->was_playing = FALSE;
|
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
gint res;
|
|
|
|
|
|
|
|
if (cdaudio->was_playing)
|
2004-03-15 19:32:27 +00:00
|
|
|
res = cd_resume (cdaudio->cd_desc);
|
2002-12-30 18:01:31 +00:00
|
|
|
else
|
2004-03-15 19:32:27 +00:00
|
|
|
res = cd_play (cdaudio->cd_desc, 1);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (res < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
|
|
|
cdaudio->was_playing = TRUE;
|
|
|
|
g_timer_start (cdaudio->timer);
|
|
|
|
break;
|
|
|
|
}
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2002-12-30 18:01:31 +00:00
|
|
|
if (cd_pause (cdaudio->cd_desc) < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
g_timer_stop (cdaudio->timer);
|
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2002-12-30 18:01:31 +00:00
|
|
|
if (cd_stop (cdaudio->cd_desc) < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
if (cd_finish (cdaudio->cd_desc) < 0)
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2002-12-30 18:01:31 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2002-12-30 18:01:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
return GST_STATE_CHANGE_SUCCESS;
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static const GstEventMask *
|
|
|
|
gst_cdaudio_get_event_masks (GstElement * element)
|
|
|
|
{
|
|
|
|
static const GstEventMask masks[] = {
|
|
|
|
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET |
|
|
|
|
GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
|
|
|
{GST_EVENT_SEEK_SEGMENT, GST_SEEK_METHOD_SET |
|
|
|
|
GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
|
|
|
{0,}
|
|
|
|
};
|
2004-03-14 22:34:33 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
return masks;
|
|
|
|
}
|
2002-12-30 18:01:31 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_cdaudio_send_event (GstElement * element, GstEvent * event)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
GstCDAudio *cdaudio;
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
cdaudio = GST_CDAUDIO (element);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
{
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
if (cd_play_pos (cdaudio->cd_desc, 1,
|
|
|
|
(gint) (GST_EVENT_SEEK_OFFSET (event) / (GST_SECOND))) == -1)
|
|
|
|
res = FALSE;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
const GstFormat *
|
|
|
|
gst_cdaudio_get_formats (GstElement * element)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
static GstFormat formats[] = {
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
GST_FORMAT_BYTES,
|
2003-05-24 10:33:08 +00:00
|
|
|
GST_FORMAT_DEFAULT,
|
2004-03-15 19:32:27 +00:00
|
|
|
0, /* fillted below */
|
|
|
|
0, /* fillted below */
|
2002-12-30 18:01:31 +00:00
|
|
|
0,
|
|
|
|
};
|
|
|
|
|
|
|
|
formats[3] = track_format;
|
|
|
|
formats[4] = sector_format;
|
|
|
|
|
|
|
|
return formats;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_cdaudio_convert (GstElement * element,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
const GstQueryType *
|
|
|
|
gst_cdaudio_get_query_types (GstElement * element)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
static const GstQueryType query_types[] = {
|
|
|
|
GST_QUERY_TOTAL,
|
|
|
|
GST_QUERY_POSITION,
|
|
|
|
GST_QUERY_START,
|
|
|
|
GST_QUERY_SEGMENT_END,
|
|
|
|
0
|
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2002-12-30 18:01:31 +00:00
|
|
|
return query_types;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_cdaudio_query (GstElement * element, GstQueryType type,
|
|
|
|
GstFormat * format, gint64 * value)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
|
|
|
GstCDAudio *cdaudio;
|
|
|
|
gboolean res = TRUE;
|
|
|
|
gulong micros;
|
|
|
|
gdouble seconds;
|
|
|
|
|
|
|
|
cdaudio = GST_CDAUDIO (element);
|
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
/* take new snapshot every 1000 miliseconds */
|
2002-12-30 18:01:31 +00:00
|
|
|
seconds = g_timer_elapsed (cdaudio->timer, µs);
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
if (micros > 1000 || seconds > 1) {
|
2002-12-30 18:01:31 +00:00
|
|
|
cd_stat (cdaudio->cd_desc, &cdaudio->info);
|
|
|
|
g_timer_start (cdaudio->timer);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case GST_QUERY_TOTAL:
|
|
|
|
switch (*format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*value = (cdaudio->info.disc_length.minutes * 60 +
|
|
|
|
cdaudio->info.disc_length.seconds) * GST_SECOND;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if (*format == track_format) {
|
|
|
|
*value = cdaudio->info.disc_total_tracks;
|
|
|
|
} else {
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
switch (*format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*value = (cdaudio->info.disc_time.minutes * 60 +
|
|
|
|
cdaudio->info.disc_time.seconds) * GST_SECOND;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if (*format == track_format) {
|
|
|
|
*value = cdaudio->info.disc_current_track;
|
|
|
|
} else {
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
if (!gst_element_register (plugin, "cdaudio", GST_RANK_NONE,
|
|
|
|
GST_TYPE_CDAUDIO))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
|
|
|
|
|
|
|
static guint
|
|
|
|
cdaudio_uri_get_type (void)
|
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
|
|
|
static gchar **
|
|
|
|
cdaudio_uri_get_protocols (void)
|
|
|
|
{
|
|
|
|
static gchar *protocols[] = { "cd", NULL };
|
|
|
|
|
|
|
|
return protocols;
|
|
|
|
}
|
|
|
|
static const gchar *
|
|
|
|
cdaudio_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
GstCDAudio *cdaudio = GST_CDAUDIO (handler);
|
|
|
|
|
|
|
|
return cdaudio->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
cdaudio_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
2002-12-30 18:01:31 +00:00
|
|
|
{
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
gchar *protocol, *location;
|
|
|
|
gboolean ret;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
ret = TRUE;
|
2002-12-30 18:01:31 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
//GstCDAudio *cdaudio = GST_CDAUDIO(handler);
|
2002-12-30 18:01:31 +00:00
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
protocol = gst_uri_get_protocol (uri);
|
|
|
|
if (strcmp (protocol, "cd") != 0) {
|
|
|
|
g_free (protocol);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
g_free (protocol);
|
|
|
|
|
|
|
|
location = gst_uri_get_location (uri);
|
|
|
|
/*
|
|
|
|
cdaudio->uri_track = strtol(location,NULL,10);
|
|
|
|
if (cdaudio->uri_track > 0) {
|
|
|
|
cdaudio->seek_request = cdaudio->uri_track;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
g_free (location);
|
|
|
|
|
|
|
|
return ret;
|
2002-12-30 18:01:31 +00:00
|
|
|
}
|
|
|
|
|
ext/cdaudio/gstcdaudio.c: Added uri handler for cd://
Original commit message from CVS:
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),
(gst_cdaudio_get_event_masks), (gst_cdaudio_send_event),
(gst_cdaudio_query), (plugin_init), (cdaudio_uri_get_type),
(cdaudio_uri_get_protocols), (cdaudio_uri_get_uri),
(cdaudio_uri_set_uri), (cdaudio_uri_handler_init):
Added uri handler for cd://
Port to new API.
2004-10-18 13:45:12 +00:00
|
|
|
static void
|
|
|
|
cdaudio_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = cdaudio_uri_get_type;
|
|
|
|
iface->get_protocols = cdaudio_uri_get_protocols;
|
|
|
|
iface->get_uri = cdaudio_uri_get_uri;
|
|
|
|
iface->set_uri = cdaudio_uri_set_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"cdaudio",
|
|
|
|
"Play CD audio through the CD Drive",
|
2006-04-01 10:09:11 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|