2002-09-28 23:28:37 +00:00
|
|
|
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-23 13:06:22 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* #define GST_DEBUG_ENABLED */
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-23 13:06:22 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <errno.h>
|
2004-03-09 16:36:30 +00:00
|
|
|
#include "gst/gst-i18n-plugin.h"
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
#include <gst/gst.h>
|
2002-09-20 20:10:43 +00:00
|
|
|
|
2002-09-09 20:14:15 +00:00
|
|
|
/* taken from linux/cdrom.h */
|
2004-03-15 19:32:28 +00:00
|
|
|
#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
|
|
|
|
#define CD_SECS 60 /* seconds per minute */
|
|
|
|
#define CD_FRAMES 75 /* frames per second */
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
#include "gstcdparanoia.h"
|
|
|
|
|
|
|
|
|
|
|
|
static GstElementDetails cdparanoia_details = {
|
|
|
|
"CD Audio (cdda) Source, Paranoia IV",
|
2002-04-20 21:42:51 +00:00
|
|
|
"Source/File",
|
2001-12-23 13:06:22 +00:00
|
|
|
"Read audio from CD in paranoid mode",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>",
|
|
|
|
};
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate cdparanoia_src_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
2003-12-22 01:47:09 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
2004-03-15 19:32:28 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"signed = (boolean) true, "
|
|
|
|
"width = (int) 16, "
|
2004-11-09 06:08:22 +00:00
|
|
|
"depth = (int) 16, " "rate = (int) 44100, " "channels = (int) 2")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
/********** Define useful types for non-programmatic interfaces **********/
|
2002-04-03 15:26:23 +00:00
|
|
|
#define GST_TYPE_PARANOIA_MODE (gst_paranoia_mode_get_type())
|
2001-12-23 13:06:22 +00:00
|
|
|
static GType
|
2002-04-03 15:26:23 +00:00
|
|
|
gst_paranoia_mode_get_type (void)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
|
|
|
static GType paranoia_mode_type = 0;
|
|
|
|
static GEnumValue paranoia_modes[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{PARANOIA_MODE_DISABLE, "0", "Disable paranoid checking"},
|
|
|
|
{PARANOIA_MODE_OVERLAP, "4", "cdda2wav-style overlap checking"},
|
|
|
|
{PARANOIA_MODE_FULL, "255", "Full paranoia"},
|
2002-10-31 00:06:48 +00:00
|
|
|
{0, NULL, NULL},
|
2001-12-23 13:06:22 +00:00
|
|
|
};
|
2002-10-31 00:06:48 +00:00
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
if (!paranoia_mode_type) {
|
2004-03-14 22:34:34 +00:00
|
|
|
paranoia_mode_type =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_enum_register_static ("GstParanoiaMode", paranoia_modes);
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
|
|
|
return paranoia_mode_type;
|
|
|
|
}
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
#define GST_TYPE_PARANOIA_ENDIAN (gst_paranoia_endian_get_type())
|
|
|
|
static GType
|
|
|
|
gst_paranoia_endian_get_type (void)
|
|
|
|
{
|
|
|
|
static GType paranoia_endian_type = 0;
|
|
|
|
static GEnumValue paranoia_endians[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{0, "0", "treat drive as little endian"},
|
|
|
|
{1, "1", "treat drive as big endian"},
|
|
|
|
{0, NULL, NULL},
|
2002-10-31 00:06:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!paranoia_endian_type) {
|
2004-03-14 22:34:34 +00:00
|
|
|
paranoia_endian_type =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_enum_register_static ("GstParanoiaEndian", paranoia_endians);
|
2002-10-31 00:06:48 +00:00
|
|
|
}
|
|
|
|
return paranoia_endian_type;
|
|
|
|
}
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
/********** Standard stuff for signals and arguments **********/
|
|
|
|
/* CDParanoia signals and args */
|
2002-10-31 00:06:48 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-23 13:06:22 +00:00
|
|
|
SMILIE_CHANGE,
|
|
|
|
TRANSPORT_ERROR,
|
|
|
|
UNCORRECTED_ERROR,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-23 13:06:22 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_LOCATION,
|
Synchronize property names where not yet the case. Devices are now device=X, other versions are deprecated (but still...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_set_property), (cdparanoia_get_property):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_set_property), (dvdnavsrc_get_property):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_set_property),
(dvdreadsrc_get_property):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_class_init),
(gst_vcdsrc_set_property), (gst_vcdsrc_get_property):
Synchronize property names where not yet the case. Devices are
now device=X, other versions are deprecated (but still exist).
Also use g_free() unconditionally.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(setup_source), (gst_play_base_bin_get_property):
Expose source.
2004-12-09 12:57:29 +00:00
|
|
|
ARG_DEVICE,
|
2001-12-23 13:06:22 +00:00
|
|
|
ARG_GENERIC_DEVICE,
|
|
|
|
ARG_DEFAULT_SECTORS,
|
|
|
|
ARG_SEARCH_OVERLAP,
|
|
|
|
ARG_ENDIAN,
|
|
|
|
ARG_READ_SPEED,
|
|
|
|
ARG_TOC_OFFSET,
|
|
|
|
ARG_TOC_BIAS,
|
|
|
|
ARG_NEVER_SKIP,
|
|
|
|
ARG_ABORT_ON_SKIP,
|
|
|
|
ARG_PARANOIA_MODE,
|
|
|
|
ARG_SMILIE,
|
2002-10-31 00:06:48 +00:00
|
|
|
ARG_DISCID
|
2001-12-23 13:06:22 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void cdparanoia_base_init (gpointer g_class);
|
|
|
|
static void cdparanoia_class_init (CDParanoiaClass * klass);
|
|
|
|
static void cdparanoia_init (CDParanoia * cdparanoia);
|
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 cdparanoia_finalize (GObject * obj);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
static void cdparanoia_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void cdparanoia_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static GstData *cdparanoia_get (GstPad * pad);
|
|
|
|
static gboolean cdparanoia_event (GstPad * pad, GstEvent * event);
|
|
|
|
static const GstEventMask *cdparanoia_get_event_mask (GstPad * pad);
|
|
|
|
static const GstFormat *cdparanoia_get_formats (GstPad * pad);
|
|
|
|
static gboolean cdparanoia_convert (GstPad * pad,
|
|
|
|
GstFormat src_format,
|
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
|
|
|
static gboolean cdparanoia_query (GstPad * pad, GstQueryType type,
|
|
|
|
GstFormat * format, gint64 * value);
|
|
|
|
static const GstQueryType *cdparanoia_get_query_types (GstPad * pad);
|
|
|
|
static void cdparanoia_set_index (GstElement * element, GstIndex * index);
|
|
|
|
static GstIndex *cdparanoia_get_index (GstElement * element);
|
|
|
|
|
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
static void cdparanoia_uri_handler_init (gpointer g_iface, gpointer iface_data);
|
|
|
|
|
|
|
|
static void
|
|
|
|
_do_init (GType cdparanoia_type)
|
|
|
|
{
|
|
|
|
static const GInterfaceInfo urihandler_info = {
|
|
|
|
cdparanoia_uri_handler_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
g_type_add_interface_static (cdparanoia_type, GST_TYPE_URI_HANDLER,
|
|
|
|
&urihandler_info);
|
|
|
|
}
|
2001-12-23 13:06:22 +00:00
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
GST_BOILERPLATE_FULL (CDParanoia, cdparanoia, GstElement, GST_TYPE_ELEMENT,
|
|
|
|
_do_init);
|
|
|
|
|
|
|
|
static GstElementStateReturn cdparanoia_change_state (GstElement * element);
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
static guint cdparanoia_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
/* our two formats */
|
2002-09-28 23:28:37 +00:00
|
|
|
static GstFormat track_format;
|
2002-10-31 00:06:48 +00:00
|
|
|
static GstFormat sector_format;
|
2002-09-28 23:28:37 +00:00
|
|
|
|
2003-11-01 14:17:49 +00:00
|
|
|
static void
|
|
|
|
cdparanoia_base_init (gpointer g_class)
|
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2003-11-01 14:17:49 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&cdparanoia_src_template));
|
|
|
|
gst_element_class_set_details (element_class, &cdparanoia_details);
|
2004-03-09 16:36:30 +00:00
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
/* Register the track and sector format */
|
|
|
|
track_format = gst_format_register ("track", "CD track");
|
|
|
|
sector_format = gst_format_register ("sector", "CD sector");
|
2003-11-01 14:17:49 +00:00
|
|
|
}
|
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_class_init (CDParanoiaClass * klass)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
2002-05-15 19:03:59 +00:00
|
|
|
char *success = strerror_tr[0];
|
2002-10-31 00:06:48 +00:00
|
|
|
|
2002-05-15 19:03:59 +00:00
|
|
|
success = NULL;
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
|
|
|
|
|
|
|
cdparanoia_signals[SMILIE_CHANGE] =
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_new ("smilie-change", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CDParanoiaClass, smilie_change), NULL,
|
|
|
|
NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
|
2001-12-23 13:06:22 +00:00
|
|
|
cdparanoia_signals[TRANSPORT_ERROR] =
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_new ("transport-error", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CDParanoiaClass, transport_error),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
2001-12-23 13:06:22 +00:00
|
|
|
cdparanoia_signals[UNCORRECTED_ERROR] =
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_new ("uncorrected-error", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CDParanoiaClass, uncorrected_error),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
|
Synchronize property names where not yet the case. Devices are now device=X, other versions are deprecated (but still...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_set_property), (cdparanoia_get_property):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_set_property), (dvdnavsrc_get_property):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_set_property),
(dvdreadsrc_get_property):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_class_init),
(gst_vcdsrc_set_property), (gst_vcdsrc_get_property):
Synchronize property names where not yet the case. Devices are
now device=X, other versions are deprecated (but still exist).
Also use g_free() unconditionally.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(setup_source), (gst_play_base_bin_get_property):
Expose source.
2004-12-09 12:57:29 +00:00
|
|
|
g_param_spec_string ("location", "Location",
|
|
|
|
"CD device location (deprecated; use device)",
|
2004-03-15 19:32:28 +00:00
|
|
|
NULL, G_PARAM_READWRITE));
|
Synchronize property names where not yet the case. Devices are now device=X, other versions are deprecated (but still...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_set_property), (cdparanoia_get_property):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_set_property), (dvdnavsrc_get_property):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_set_property),
(dvdreadsrc_get_property):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_class_init),
(gst_vcdsrc_set_property), (gst_vcdsrc_get_property):
Synchronize property names where not yet the case. Devices are
now device=X, other versions are deprecated (but still exist).
Also use g_free() unconditionally.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(setup_source), (gst_play_base_bin_get_property):
Expose source.
2004-12-09 12:57:29 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE,
|
|
|
|
g_param_spec_string ("device", "Device",
|
|
|
|
"CD device location", NULL, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENERIC_DEVICE,
|
|
|
|
g_param_spec_string ("generic_device", "Generic device",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Use specified generic scsi device", NULL, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEFAULT_SECTORS,
|
|
|
|
g_param_spec_int ("default_sectors", "Default sectors",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Force default number of sectors in read to n sectors", -1, 100, -1,
|
|
|
|
G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SEARCH_OVERLAP,
|
|
|
|
g_param_spec_int ("search_overlap", "Search overlap",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Force minimum overlap search during verification to n sectors", -1,
|
|
|
|
75, -1, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ENDIAN,
|
|
|
|
g_param_spec_enum ("endian", "Endian", "Force endian on drive",
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_TYPE_PARANOIA_ENDIAN, 0, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_READ_SPEED,
|
|
|
|
g_param_spec_int ("read_speed", "Read speed",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Read from device at specified speed", G_MININT, G_MAXINT, 0,
|
|
|
|
G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOC_OFFSET,
|
|
|
|
g_param_spec_int ("toc_offset", "TOC offset",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Add <n> sectors to the values reported", G_MININT, G_MAXINT, 0,
|
|
|
|
G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOC_BIAS,
|
|
|
|
g_param_spec_boolean ("toc_bias", "TOC bias",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Assume that the beginning offset of track 1 as reported in the TOC "
|
|
|
|
"will be addressed as LBA 0. Necessary for some Toshiba drives to "
|
|
|
|
"get track boundaries", TRUE, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NEVER_SKIP,
|
|
|
|
g_param_spec_int ("never_skip", "Never skip",
|
2004-03-15 19:32:28 +00:00
|
|
|
"never accept any less than perfect data reconstruction (don't allow "
|
|
|
|
"'V's) but if [n] is given, skip after [n] retries without progress.",
|
|
|
|
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ABORT_ON_SKIP,
|
|
|
|
g_param_spec_boolean ("abort_on_skip", "Abort on skip",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Abort on imperfect reads/skips", TRUE, G_PARAM_READWRITE));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARANOIA_MODE,
|
|
|
|
g_param_spec_enum ("paranoia_mode", "Paranoia mode",
|
2004-03-15 19:32:28 +00:00
|
|
|
"Type of checking to perform", GST_TYPE_PARANOIA_MODE, 0,
|
|
|
|
G_PARAM_READWRITE));
|
2002-10-31 00:06:48 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DISCID,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_string ("discid", "discid", "The dics id", NULL,
|
2004-03-15 19:32:28 +00:00
|
|
|
G_PARAM_READABLE));
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2004-10-11 12:02:09 +00:00
|
|
|
/* tags */
|
|
|
|
gst_tag_register ("discid", GST_TAG_FLAG_META, G_TYPE_STRING,
|
|
|
|
_("discid"), _("CDDA discid for metadata retrieval"),
|
|
|
|
gst_tag_merge_use_first);
|
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
gobject_class->set_property = cdparanoia_set_property;
|
|
|
|
gobject_class->get_property = cdparanoia_get_property;
|
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_class->finalize = cdparanoia_finalize;
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
gstelement_class->change_state = cdparanoia_change_state;
|
2004-03-14 22:34:34 +00:00
|
|
|
gstelement_class->set_index = cdparanoia_set_index;
|
|
|
|
gstelement_class->get_index = cdparanoia_get_index;
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_init (CDParanoia * cdparanoia)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
cdparanoia->srcpad =
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&cdparanoia_src_template), "src");
|
2001-12-23 13:06:22 +00:00
|
|
|
gst_pad_set_get_function (cdparanoia->srcpad, cdparanoia_get);
|
2002-10-31 00:06:48 +00:00
|
|
|
gst_pad_set_event_function (cdparanoia->srcpad, cdparanoia_event);
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_pad_set_event_mask_function (cdparanoia->srcpad,
|
|
|
|
cdparanoia_get_event_mask);
|
2002-10-31 00:06:48 +00:00
|
|
|
gst_pad_set_convert_function (cdparanoia->srcpad, cdparanoia_convert);
|
|
|
|
gst_pad_set_query_function (cdparanoia->srcpad, cdparanoia_query);
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_pad_set_query_type_function (cdparanoia->srcpad,
|
|
|
|
cdparanoia_get_query_types);
|
2002-10-31 00:06:48 +00:00
|
|
|
gst_pad_set_formats_function (cdparanoia->srcpad, cdparanoia_get_formats);
|
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (cdparanoia), cdparanoia->srcpad);
|
|
|
|
|
2002-09-01 13:57:57 +00:00
|
|
|
cdparanoia->device = g_strdup ("/dev/cdrom");
|
2001-12-23 13:06:22 +00:00
|
|
|
cdparanoia->generic_device = NULL;
|
|
|
|
cdparanoia->default_sectors = -1;
|
|
|
|
cdparanoia->search_overlap = -1;
|
2002-10-31 00:06:48 +00:00
|
|
|
cdparanoia->endian = 0;
|
2001-12-23 13:06:22 +00:00
|
|
|
cdparanoia->read_speed = -1;
|
|
|
|
cdparanoia->toc_offset = 0;
|
|
|
|
cdparanoia->toc_bias = FALSE;
|
|
|
|
cdparanoia->never_skip = FALSE;
|
|
|
|
cdparanoia->paranoia_mode = 2;
|
|
|
|
cdparanoia->abort_on_skip = FALSE;
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
cdparanoia->total_seconds = 0;
|
2004-06-14 20:33:56 +00:00
|
|
|
cdparanoia->discont_sent = FALSE;
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
cdparanoia->uri = NULL;
|
|
|
|
cdparanoia->uri_track = -1;
|
|
|
|
cdparanoia->seek_request = -1;
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +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
|
|
|
cdparanoia_finalize (GObject * obj)
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +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
|
|
|
CDParanoia *cdparanoia = CDPARANOIA (obj);
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
|
|
|
|
g_free (cdparanoia->uri);
|
|
|
|
cdparanoia->uri = NULL;
|
|
|
|
|
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 (obj);
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
}
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
|
|
|
CDParanoia *src;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_CDPARANOIA (object));
|
|
|
|
|
|
|
|
src = CDPARANOIA (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
Synchronize property names where not yet the case. Devices are now device=X, other versions are deprecated (but still...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_set_property), (cdparanoia_get_property):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_set_property), (dvdnavsrc_get_property):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_set_property),
(dvdreadsrc_get_property):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_class_init),
(gst_vcdsrc_set_property), (gst_vcdsrc_get_property):
Synchronize property names where not yet the case. Devices are
now device=X, other versions are deprecated (but still exist).
Also use g_free() unconditionally.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(setup_source), (gst_play_base_bin_get_property):
Expose source.
2004-12-09 12:57:29 +00:00
|
|
|
case ARG_DEVICE:
|
2001-12-23 13:06:22 +00:00
|
|
|
case ARG_LOCATION:
|
Synchronize property names where not yet the case. Devices are now device=X, other versions are deprecated (but still...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_set_property), (cdparanoia_get_property):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_set_property), (dvdnavsrc_get_property):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_set_property),
(dvdreadsrc_get_property):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_class_init),
(gst_vcdsrc_set_property), (gst_vcdsrc_get_property):
Synchronize property names where not yet the case. Devices are
now device=X, other versions are deprecated (but still exist).
Also use g_free() unconditionally.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(setup_source), (gst_play_base_bin_get_property):
Expose source.
2004-12-09 12:57:29 +00:00
|
|
|
g_free (src->device);
|
2001-12-23 13:06:22 +00:00
|
|
|
/* clear the filename if we get a NULL (is that possible?) */
|
2002-10-31 00:06:48 +00:00
|
|
|
if (!g_ascii_strcasecmp (g_value_get_string (value), ""))
|
2004-03-15 19:32:28 +00:00
|
|
|
src->device = NULL;
|
2001-12-23 13:06:22 +00:00
|
|
|
/* otherwise set the new filename */
|
|
|
|
else
|
2004-03-15 19:32:28 +00:00
|
|
|
src->device = g_strdup (g_value_get_string (value));
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
case ARG_GENERIC_DEVICE:
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
if (src->generic_device)
|
2004-03-15 19:32:28 +00:00
|
|
|
g_free (src->generic_device);
|
2001-12-23 13:06:22 +00:00
|
|
|
/* reset the device if we get a NULL (is that possible?) */
|
2002-10-31 00:06:48 +00:00
|
|
|
if (!g_ascii_strcasecmp (g_value_get_string (value), ""))
|
2004-03-15 19:32:28 +00:00
|
|
|
src->generic_device = NULL;
|
2001-12-23 13:06:22 +00:00
|
|
|
/* otherwise set the new filename */
|
|
|
|
else
|
2004-03-15 19:32:28 +00:00
|
|
|
src->generic_device = g_strdup (g_value_get_string (value));
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
case ARG_DEFAULT_SECTORS:
|
|
|
|
src->default_sectors = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_SEARCH_OVERLAP:
|
|
|
|
src->search_overlap = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_ENDIAN:
|
2002-10-31 00:06:48 +00:00
|
|
|
src->endian = g_value_get_enum (value);
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
case ARG_READ_SPEED:
|
|
|
|
src->read_speed = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_TOC_OFFSET:
|
|
|
|
src->toc_offset = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_TOC_BIAS:
|
|
|
|
src->toc_bias = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case ARG_NEVER_SKIP:
|
2002-10-31 00:06:48 +00:00
|
|
|
src->never_skip = g_value_get_int (value);
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
case ARG_ABORT_ON_SKIP:
|
|
|
|
src->abort_on_skip = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case ARG_PARANOIA_MODE:
|
2002-04-03 15:26:23 +00:00
|
|
|
src->paranoia_mode = g_value_get_enum (value);
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
|
|
|
CDParanoia *src;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_CDPARANOIA (object));
|
|
|
|
|
|
|
|
src = CDPARANOIA (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
Synchronize property names where not yet the case. Devices are now device=X, other versions are deprecated (but still...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_set_property), (cdparanoia_get_property):
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_class_init),
(dvdnavsrc_set_property), (dvdnavsrc_get_property):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_set_property),
(dvdreadsrc_get_property):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_class_init),
(gst_vcdsrc_set_property), (gst_vcdsrc_get_property):
Synchronize property names where not yet the case. Devices are
now device=X, other versions are deprecated (but still exist).
Also use g_free() unconditionally.
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(setup_source), (gst_play_base_bin_get_property):
Expose source.
2004-12-09 12:57:29 +00:00
|
|
|
case ARG_DEVICE:
|
2001-12-23 13:06:22 +00:00
|
|
|
case ARG_LOCATION:
|
|
|
|
g_value_set_string (value, src->device);
|
|
|
|
break;
|
|
|
|
case ARG_GENERIC_DEVICE:
|
|
|
|
g_value_set_string (value, src->generic_device);
|
|
|
|
break;
|
|
|
|
case ARG_DEFAULT_SECTORS:
|
|
|
|
g_value_set_int (value, src->default_sectors);
|
|
|
|
break;
|
|
|
|
case ARG_SEARCH_OVERLAP:
|
|
|
|
g_value_set_int (value, src->search_overlap);
|
|
|
|
break;
|
|
|
|
case ARG_ENDIAN:
|
2002-10-31 00:06:48 +00:00
|
|
|
g_value_set_enum (value, src->endian);
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
case ARG_READ_SPEED:
|
|
|
|
g_value_set_int (value, src->read_speed);
|
|
|
|
break;
|
|
|
|
case ARG_TOC_OFFSET:
|
|
|
|
g_value_set_int (value, src->toc_offset);
|
|
|
|
break;
|
|
|
|
case ARG_TOC_BIAS:
|
|
|
|
g_value_set_boolean (value, src->toc_bias);
|
|
|
|
break;
|
|
|
|
case ARG_NEVER_SKIP:
|
2002-10-31 00:06:48 +00:00
|
|
|
g_value_set_int (value, src->never_skip);
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
|
|
|
case ARG_ABORT_ON_SKIP:
|
|
|
|
g_value_set_boolean (value, src->abort_on_skip);
|
|
|
|
break;
|
|
|
|
case ARG_PARANOIA_MODE:
|
2002-04-03 15:26:23 +00:00
|
|
|
g_value_set_enum (value, src->paranoia_mode);
|
2001-12-23 13:06:22 +00:00
|
|
|
break;
|
2002-09-09 20:14:15 +00:00
|
|
|
case ARG_DISCID:
|
2003-03-30 02:13:37 +00:00
|
|
|
/**
|
|
|
|
* Due to possible autocorrections of start sectors of audio tracks on
|
|
|
|
* multisession cds, we can maybe not compute the correct discid.
|
|
|
|
* So issue a warning.
|
|
|
|
* See cdparanoia/interface/common-interface.c:FixupTOC
|
|
|
|
*/
|
2003-04-08 22:40:07 +00:00
|
|
|
if (src->d && src->d->cd_extra)
|
2004-03-15 19:32:28 +00:00
|
|
|
g_warning
|
|
|
|
("DiscID on multisession discs might be broken. Use at own risk.");
|
2002-10-31 00:06:48 +00:00
|
|
|
g_value_set_string (value, src->discid);
|
2002-09-09 20:14:15 +00:00
|
|
|
break;
|
2001-12-23 13:06:22 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
static void
|
|
|
|
cdparanoia_callback (long inpos, int function)
|
|
|
|
{
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
|
|
|
|
2003-10-08 16:08:22 +00:00
|
|
|
static GstData *
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_get (GstPad * pad)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
|
|
|
CDParanoia *src;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
src = CDPARANOIA (gst_pad_get_parent (pad));
|
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
g_return_val_if_fail (GST_FLAG_IS_SET (src, CDPARANOIA_OPEN), NULL);
|
2001-12-23 13:06:22 +00:00
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
if (src->seek_request != -1) {
|
|
|
|
gst_pad_send_event (src->srcpad,
|
|
|
|
gst_event_new_segment_seek (track_format |
|
|
|
|
GST_SEEK_METHOD_SET |
|
|
|
|
GST_SEEK_FLAG_FLUSH, src->seek_request - 1, src->seek_request));
|
|
|
|
src->seek_request = -1;
|
|
|
|
}
|
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
/* stop things apropriatly */
|
|
|
|
if (src->cur_sector > src->segment_end_sector) {
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("setting EOS");
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2001-12-28 20:24:41 +00:00
|
|
|
buf = GST_BUFFER (gst_event_new (GST_EVENT_EOS));
|
2002-11-01 00:40:15 +00:00
|
|
|
gst_element_set_eos (GST_ELEMENT (src));
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2002-11-01 00:40:15 +00:00
|
|
|
gint16 *cdda_buf;
|
|
|
|
gint64 timestamp;
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
/* convert the sequence sector number to a timestamp */
|
|
|
|
format = GST_FORMAT_TIME;
|
|
|
|
timestamp = 0LL;
|
2004-06-14 20:33:56 +00:00
|
|
|
gst_pad_convert (src->srcpad, sector_format, src->cur_sector, &format,
|
|
|
|
×tamp);
|
|
|
|
|
|
|
|
if (!src->discont_sent && src->prev_sec != src->cur_sector) {
|
|
|
|
GstEvent *discont_ev;
|
|
|
|
|
|
|
|
discont_ev =
|
|
|
|
gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, timestamp,
|
|
|
|
GST_FORMAT_UNDEFINED);
|
|
|
|
|
|
|
|
src->discont_sent = TRUE;
|
|
|
|
return GST_DATA (discont_ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
src->discont_sent = FALSE;
|
|
|
|
|
|
|
|
/* read a sector */
|
|
|
|
cdda_buf = paranoia_read (src->p, cdparanoia_callback);
|
2002-11-01 00:40:15 +00:00
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* have to copy the buffer for now since we don't own it... */
|
|
|
|
/* FIXME must ask monty about allowing ownership transfer */
|
2002-09-20 20:10:43 +00:00
|
|
|
buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW);
|
2001-12-28 20:24:41 +00:00
|
|
|
memcpy (GST_BUFFER_DATA (buf), cdda_buf, CD_FRAMESIZE_RAW);
|
2002-11-01 00:40:15 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buf) = timestamp;
|
2004-10-11 12:02:09 +00:00
|
|
|
gst_pad_convert (pad, GST_FORMAT_BYTES, CD_FRAMESIZE_RAW,
|
|
|
|
&format, ×tamp);
|
|
|
|
GST_BUFFER_DURATION (buf) = timestamp;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
/* update current sector */
|
|
|
|
src->cur_sector++;
|
2004-06-14 20:33:56 +00:00
|
|
|
src->prev_sec = src->cur_sector;
|
2001-12-28 20:24:41 +00:00
|
|
|
}
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
/* we're done, push the buffer off now */
|
2003-10-08 16:08:22 +00:00
|
|
|
return GST_DATA (buf);
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
|
|
|
|
2002-09-09 20:14:15 +00:00
|
|
|
/* need some stuff to get a discid (cdparanoia doesn't do cddb but lets
|
|
|
|
* not stop other ppl doing it ;-) */
|
|
|
|
typedef int byte;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
byte m;
|
|
|
|
byte s;
|
|
|
|
byte f;
|
|
|
|
}
|
|
|
|
toc_msf;
|
2002-09-09 20:14:15 +00:00
|
|
|
|
|
|
|
/* cdparanoia provides the toc in lba format dang we need it in msf so
|
|
|
|
* we have to convert it */
|
2002-10-31 00:06:48 +00:00
|
|
|
static inline void
|
2004-03-14 22:34:34 +00:00
|
|
|
lba_to_msf (const gint lba, byte * m, byte * s, byte * f)
|
2002-09-09 20:14:15 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
gint lba2 = lba;
|
|
|
|
|
|
|
|
lba2 += CD_MSF_OFFSET;
|
|
|
|
lba2 &= 0xffffff;
|
|
|
|
*m = lba2 / (CD_SECS * CD_FRAMES);
|
|
|
|
lba2 %= (CD_SECS * CD_FRAMES);
|
|
|
|
*s = lba2 / CD_FRAMES;
|
|
|
|
*f = lba2 % CD_FRAMES;
|
|
|
|
*f += (*m) * 60 * 75;
|
|
|
|
*f += (*s) * 75;
|
2002-09-09 20:14:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
lba_toc_to_msf_toc (TOC * lba_toc, toc_msf * msf_toc, gint tracks)
|
2002-09-09 20:14:15 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i <= tracks; i++)
|
2004-03-14 22:34:34 +00:00
|
|
|
lba_to_msf (lba_toc[i].dwStartSector, &msf_toc[i].m, &msf_toc[i].s,
|
2004-03-15 19:32:28 +00:00
|
|
|
&msf_toc[i].f);
|
2002-09-09 20:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the cddb hash function */
|
2002-09-20 20:10:43 +00:00
|
|
|
static guint
|
2002-10-31 00:06:48 +00:00
|
|
|
cddb_sum (gint n)
|
2002-09-09 20:14:15 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
guint ret;
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
while (n > 0) {
|
|
|
|
ret += (n % 10);
|
|
|
|
n /= 10;
|
|
|
|
}
|
|
|
|
return ret;
|
2002-09-09 20:14:15 +00:00
|
|
|
}
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cddb_discid (gchar * discid, toc_msf * toc, gint tracks)
|
2002-09-09 20:14:15 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
guint i = 0, t = 0, n = 0;
|
2002-09-09 20:14:15 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
while (i < tracks) {
|
|
|
|
n = n + cddb_sum ((toc[i].m * 60) + toc[i].s);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
t = ((toc[tracks].m * 60) + toc[tracks].s) - ((toc[0].m * 60)
|
2004-03-14 22:34:34 +00:00
|
|
|
+ toc[0].s);
|
2002-10-31 00:06:48 +00:00
|
|
|
sprintf (discid, "%08x", ((n % 0xff) << 24 | t << 8 | tracks));
|
2002-09-09 20:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get all the cddb info at once */
|
2002-10-31 00:06:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
get_cddb_info (TOC * toc, gint tracks, gchar * discid, gint64 * offsets,
|
|
|
|
gint64 * total_seconds)
|
2002-09-09 20:14:15 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
toc_msf msf_toc[MAXTRK];
|
|
|
|
gint i;
|
|
|
|
gint64 *p = offsets;
|
2002-09-09 20:14:15 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
lba_toc_to_msf_toc (toc, &msf_toc[0], tracks);
|
|
|
|
cddb_discid (discid, &msf_toc[0], tracks);
|
2002-09-09 20:14:15 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
for (i = 0; i < tracks; i++) {
|
|
|
|
*p++ = msf_toc[i].f;
|
|
|
|
}
|
|
|
|
|
|
|
|
*total_seconds = msf_toc[tracks].f / 75;
|
2002-09-09 20:14:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-01-01 23:57:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
add_index_associations (CDParanoia * src)
|
2003-01-01 23:57:41 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < src->d->tracks; i++) {
|
|
|
|
gint64 sector;
|
|
|
|
|
|
|
|
sector = cdda_track_firstsector (src->d, i + 1);
|
|
|
|
gst_index_add_association (src->index, src->index_id,
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_ASSOCIATION_FLAG_KEY_UNIT,
|
|
|
|
track_format, i,
|
|
|
|
sector_format, sector,
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
(gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100),
|
|
|
|
GST_FORMAT_BYTES, (gint64) (sector << 2), GST_FORMAT_DEFAULT,
|
|
|
|
(gint64) ((CD_FRAMESIZE_RAW >> 2) * sector), NULL);
|
2003-01-01 23:57:41 +00:00
|
|
|
#if 0
|
2004-03-14 22:34:34 +00:00
|
|
|
g_print ("Added association for track %d\n", i + 1);
|
|
|
|
g_print ("Sector: %lld\n", sector);
|
|
|
|
g_print ("Time: %lld\n",
|
2004-03-15 19:32:28 +00:00
|
|
|
(gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_print ("Bytes: %lld\n", (gint64) (sector << 2));
|
|
|
|
g_print ("Units: %lld\n", (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector));
|
|
|
|
g_print ("-----------\n");
|
2003-01-01 23:57:41 +00:00
|
|
|
#endif
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2003-01-01 23:57:41 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
/* open the file, necessary to go to RUNNING state */
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_open (CDParanoia * src)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
2004-10-11 12:02:09 +00:00
|
|
|
GstTagList *taglist;
|
2001-12-23 13:06:22 +00:00
|
|
|
gint i;
|
|
|
|
gint paranoia_mode;
|
|
|
|
|
|
|
|
g_return_val_if_fail (!GST_FLAG_IS_SET (src, CDPARANOIA_OPEN), FALSE);
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "trying to open device...");
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* find the device */
|
2001-12-23 13:06:22 +00:00
|
|
|
if (src->generic_device != NULL) {
|
|
|
|
src->d = cdda_identify_scsi (src->generic_device, src->device, FALSE, NULL);
|
|
|
|
} else {
|
|
|
|
if (src->device != NULL) {
|
|
|
|
src->d = cdda_identify (src->device, FALSE, NULL);
|
|
|
|
} else {
|
|
|
|
src->d = cdda_identify ("/dev/cdrom", FALSE, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* fail if the device couldn't be found */
|
2001-12-23 13:06:22 +00:00
|
|
|
if (src->d == NULL) {
|
2004-03-09 16:36:30 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
2004-03-15 19:32:28 +00:00
|
|
|
(_("Could not open CD device for reading.")), ("cdda_identify failed"));
|
2001-12-23 13:06:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* set verbosity mode */
|
2001-12-23 13:06:22 +00:00
|
|
|
cdda_verbose_set (src->d, CDDA_MESSAGE_FORGETIT, CDDA_MESSAGE_FORGETIT);
|
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* set various other parameters */
|
2001-12-23 13:06:22 +00:00
|
|
|
if (src->default_sectors != -1) {
|
2002-11-01 00:40:15 +00:00
|
|
|
src->d->nsectors = src->default_sectors;
|
|
|
|
src->d->bigbuff = src->default_sectors * CD_FRAMESIZE_RAW;
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* open the disc */
|
2001-12-23 13:06:22 +00:00
|
|
|
if (cdda_open (src->d)) {
|
2004-03-09 16:36:30 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
2004-03-15 19:32:28 +00:00
|
|
|
(_("Could not open CD device for reading.")), ("cdda_open failed"));
|
2001-12-23 13:06:22 +00:00
|
|
|
cdda_close (src->d);
|
|
|
|
src->d = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-09-09 20:14:15 +00:00
|
|
|
/* I don't like this here i would prefer it under get_cddb_info but for somereason
|
|
|
|
* when leaving the function it clobbers the allocated mem and all is lost bugger
|
2002-10-31 00:06:48 +00:00
|
|
|
*/
|
2002-09-09 20:14:15 +00:00
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
get_cddb_info (&src->d->disc_toc[0], src->d->tracks, src->discid,
|
2004-03-14 22:34:34 +00:00
|
|
|
src->offsets, &src->total_seconds);
|
2002-09-20 20:10:43 +00:00
|
|
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (src));
|
|
|
|
g_object_notify (G_OBJECT (src), "discid");
|
|
|
|
g_object_thaw_notify (G_OBJECT (src));
|
2002-10-31 00:06:48 +00:00
|
|
|
|
2004-10-11 12:02:09 +00:00
|
|
|
taglist = gst_tag_list_new ();
|
|
|
|
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, "discid", src->discid, NULL);
|
|
|
|
gst_element_found_tags (GST_ELEMENT (src), taglist);
|
|
|
|
/* no need to forward, because discid is useless to other elements */
|
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
if (src->toc_bias) {
|
|
|
|
src->toc_offset -= cdda_track_firstsector (src->d, 1);
|
|
|
|
}
|
2002-10-31 00:06:48 +00:00
|
|
|
for (i = 0; i < src->d->tracks + 1; i++) {
|
2001-12-23 13:06:22 +00:00
|
|
|
src->d->disc_toc[i].dwStartSector += src->toc_offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->read_speed != -1) {
|
|
|
|
cdda_speed_set (src->d, src->read_speed);
|
|
|
|
}
|
|
|
|
|
2004-10-11 12:18:42 +00:00
|
|
|
/* save thse ones - skip lead-in */
|
|
|
|
src->first_sector = cdda_track_firstsector (src->d, 1);
|
2004-03-14 22:34:34 +00:00
|
|
|
src->last_sector = cdda_disc_lastsector (src->d);
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
/* this is the default segment we will play */
|
|
|
|
src->segment_start_sector = src->first_sector;
|
2004-03-14 22:34:34 +00:00
|
|
|
src->segment_end_sector = src->last_sector;
|
2001-12-23 13:06:22 +00:00
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* create the paranoia struct and set it up */
|
2001-12-23 13:06:22 +00:00
|
|
|
src->p = paranoia_init (src->d);
|
|
|
|
if (src->p == NULL) {
|
2004-03-09 16:36:30 +00:00
|
|
|
GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL), (NULL));
|
2001-12-23 13:06:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
paranoia_mode = src->paranoia_mode;
|
2002-10-31 00:06:48 +00:00
|
|
|
if (src->never_skip)
|
|
|
|
paranoia_mode |= PARANOIA_MODE_NEVERSKIP;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
paranoia_modeset (src->p, paranoia_mode);
|
|
|
|
|
|
|
|
if (src->search_overlap != -1) {
|
|
|
|
paranoia_overlapset (src->p, src->search_overlap);
|
|
|
|
}
|
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
src->cur_sector = src->first_sector;
|
2004-06-14 20:33:56 +00:00
|
|
|
src->prev_sec = src->cur_sector;
|
2001-12-23 13:06:22 +00:00
|
|
|
paranoia_seek (src->p, src->cur_sector, SEEK_SET);
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("successfully seek'd to beginning of disk");
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
GST_FLAG_SET (src, CDPARANOIA_OPEN);
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (src->index && GST_INDEX_IS_WRITABLE (src->index)) {
|
|
|
|
add_index_associations (src);
|
|
|
|
}
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "device successfully openend");
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close the file */
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_close (CDParanoia * src)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_FLAG_IS_SET (src, CDPARANOIA_OPEN));
|
|
|
|
|
2002-02-03 19:58:48 +00:00
|
|
|
/* kill the paranoia state */
|
2001-12-23 13:06:22 +00:00
|
|
|
paranoia_free (src->p);
|
|
|
|
src->p = NULL;
|
2002-10-31 00:06:48 +00:00
|
|
|
|
|
|
|
src->total_seconds = 0LL;
|
2002-02-03 19:58:48 +00:00
|
|
|
/* close the disc */
|
2001-12-23 13:06:22 +00:00
|
|
|
cdda_close (src->d);
|
|
|
|
src->d = NULL;
|
|
|
|
|
|
|
|
GST_FLAG_UNSET (src, CDPARANOIA_OPEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_change_state (GstElement * element)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
2002-09-20 20:10:43 +00:00
|
|
|
CDParanoia *cdparanoia;
|
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
g_return_val_if_fail (GST_IS_CDPARANOIA (element), GST_STATE_FAILURE);
|
|
|
|
|
2002-09-20 20:10:43 +00:00
|
|
|
cdparanoia = CDPARANOIA (element);
|
|
|
|
|
|
|
|
switch (GST_STATE_TRANSITION (element)) {
|
2004-03-14 22:34:34 +00:00
|
|
|
case GST_STATE_NULL_TO_READY:
|
|
|
|
if (!cdparanoia_open (CDPARANOIA (element))) {
|
2004-03-15 19:32:28 +00:00
|
|
|
g_warning ("cdparanoia: failed opening cd");
|
|
|
|
return GST_STATE_FAILURE;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_PAUSED:
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
if (cdparanoia->uri_track > 0) {
|
|
|
|
cdparanoia->seek_request = cdparanoia->uri_track;
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
|
|
|
/* FIXME: Need code here to reset element to start of cd */
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_NULL:
|
|
|
|
cdparanoia_close (CDPARANOIA (element));
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
cdparanoia->seek_request = -1;
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2001-12-23 13:06:22 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
/* if we haven't failed already, give the parent class a chance too ;-) */
|
|
|
|
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
|
|
|
|
|
|
|
return GST_STATE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-09-28 23:28:37 +00:00
|
|
|
static const GstEventMask *
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_get_event_mask (GstPad * pad)
|
2002-09-28 23:28:37 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
static const GstEventMask masks[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET |
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
2004-03-14 22:34:34 +00:00
|
|
|
{GST_EVENT_SEEK_SEGMENT, GST_SEEK_METHOD_SET |
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
2002-10-31 00:06:48 +00:00
|
|
|
{0,}
|
|
|
|
};
|
2002-09-28 23:28:37 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
return masks;
|
2002-09-28 23:28:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_event (GstPad * pad, GstEvent * event)
|
2002-09-28 23:28:37 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
CDParanoia *src;
|
2002-11-01 00:40:15 +00:00
|
|
|
gboolean res = TRUE;
|
2002-10-31 00:06:48 +00:00
|
|
|
|
|
|
|
src = CDPARANOIA (gst_pad_get_parent (pad));
|
|
|
|
|
2003-01-01 23:57:41 +00:00
|
|
|
if (!GST_FLAG_IS_SET (src, CDPARANOIA_OPEN)) {
|
2004-03-09 16:36:30 +00:00
|
|
|
GST_DEBUG ("device not open, cannot handle event");
|
2002-11-01 00:40:15 +00:00
|
|
|
goto error;
|
2004-03-09 16:36:30 +00:00
|
|
|
}
|
2002-11-01 00:40:15 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
2002-11-01 00:40:15 +00:00
|
|
|
case GST_EVENT_SEEK_SEGMENT:
|
|
|
|
{
|
|
|
|
gint64 offset, endoffset;
|
|
|
|
gint format;
|
|
|
|
gint64 seg_start_sector = -1, seg_end_sector = -1;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
format = GST_EVENT_SEEK_FORMAT (event);
|
|
|
|
offset = GST_EVENT_SEEK_OFFSET (event);
|
2002-11-01 00:40:15 +00:00
|
|
|
endoffset = GST_EVENT_SEEK_ENDOFFSET (event);
|
|
|
|
|
|
|
|
/* we can only seek on sectors, so we convert the requested
|
|
|
|
* offsets to sectors first */
|
|
|
|
if (offset != -1) {
|
2004-03-15 19:32:28 +00:00
|
|
|
res &= gst_pad_convert (src->srcpad, format, offset,
|
|
|
|
§or_format, &seg_start_sector);
|
2002-11-01 00:40:15 +00:00
|
|
|
}
|
|
|
|
if (endoffset != -1) {
|
2004-03-15 19:32:28 +00:00
|
|
|
res &= gst_pad_convert (src->srcpad, format, endoffset,
|
|
|
|
§or_format, &seg_end_sector);
|
2002-11-01 00:40:15 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
if (!res) {
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_DEBUG ("could not convert offsets to sectors");
|
|
|
|
goto error;
|
2002-10-31 00:06:48 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
switch (GST_EVENT_SEEK_METHOD (event)) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_SEEK_METHOD_SET:
|
|
|
|
/* values are set for regular seek set */
|
|
|
|
break;
|
|
|
|
case GST_SEEK_METHOD_CUR:
|
|
|
|
if (seg_start_sector != -1) {
|
|
|
|
seg_start_sector += src->cur_sector;
|
|
|
|
}
|
|
|
|
if (seg_end_sector != -1) {
|
|
|
|
seg_end_sector += src->cur_sector;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_SEEK_METHOD_END:
|
|
|
|
if (seg_start_sector != -1) {
|
|
|
|
seg_start_sector = src->last_sector - seg_start_sector;
|
|
|
|
}
|
|
|
|
if (seg_end_sector != -1) {
|
|
|
|
seg_end_sector = src->last_sector - seg_end_sector;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto error;
|
2002-10-31 00:06:48 +00:00
|
|
|
}
|
2002-11-01 00:40:15 +00:00
|
|
|
/* do we need to update the start sector? */
|
|
|
|
if (seg_start_sector != -1) {
|
2004-10-11 12:18:42 +00:00
|
|
|
seg_start_sector += src->first_sector;
|
2004-03-15 19:32:28 +00:00
|
|
|
seg_start_sector = CLAMP (seg_start_sector,
|
|
|
|
src->first_sector, src->last_sector);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
if (paranoia_seek (src->p, seg_start_sector, SEEK_SET) > -1) {
|
|
|
|
GST_DEBUG ("seeked to %" G_GINT64_FORMAT, seg_start_sector);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
src->segment_start_sector = seg_start_sector;
|
|
|
|
src->cur_sector = src->segment_start_sector;
|
|
|
|
} else {
|
|
|
|
goto error;
|
|
|
|
}
|
2002-10-31 00:06:48 +00:00
|
|
|
}
|
2002-11-01 00:40:15 +00:00
|
|
|
if (seg_end_sector != -1) {
|
2004-10-11 12:18:42 +00:00
|
|
|
seg_end_sector += src->first_sector;
|
2004-03-15 19:32:28 +00:00
|
|
|
seg_end_sector = CLAMP (seg_end_sector,
|
|
|
|
src->first_sector, src->last_sector);
|
|
|
|
src->segment_end_sector = seg_end_sector;
|
2002-10-31 00:06:48 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_DEBUG ("configured for %d -> %d sectors\n",
|
2004-03-15 19:32:28 +00:00
|
|
|
src->segment_start_sector, src->segment_end_sector);
|
2002-10-31 00:06:48 +00:00
|
|
|
break;
|
2002-11-01 00:40:15 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
default:
|
|
|
|
goto error;
|
2002-10-31 00:06:48 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
if (FALSE) {
|
2004-03-14 22:34:34 +00:00
|
|
|
error:
|
2002-11-01 00:40:15 +00:00
|
|
|
res = FALSE;
|
|
|
|
}
|
2002-10-31 00:06:48 +00:00
|
|
|
gst_event_unref (event);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
return res;
|
2002-09-28 23:28:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const GstFormat *
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_get_formats (GstPad * pad)
|
2002-09-28 23:28:37 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
static GstFormat formats[] = {
|
|
|
|
GST_FORMAT_TIME,
|
2002-11-01 00:40:15 +00:00
|
|
|
GST_FORMAT_BYTES,
|
2003-05-24 10:41:58 +00:00
|
|
|
GST_FORMAT_DEFAULT,
|
2004-03-15 19:32:28 +00:00
|
|
|
0, /* filled later */
|
|
|
|
0, /* filled later */
|
2002-10-31 00:06:48 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
formats[3] = track_format;
|
|
|
|
formats[4] = sector_format;
|
2002-09-28 23:28:37 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
return formats;
|
2002-09-28 23:28:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_convert (GstPad * pad,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value)
|
2002-09-28 23:28:37 +00:00
|
|
|
{
|
2002-10-31 00:06:48 +00:00
|
|
|
CDParanoia *src;
|
2002-09-28 23:28:37 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
src = CDPARANOIA (gst_pad_get_parent (pad));
|
2002-09-28 23:28:37 +00:00
|
|
|
|
2003-01-01 23:57:41 +00:00
|
|
|
if (!GST_FLAG_IS_SET (src, CDPARANOIA_OPEN)) {
|
2002-11-01 00:40:15 +00:00
|
|
|
return FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2002-11-01 00:40:15 +00:00
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
switch (src_format) {
|
2004-03-14 22:34:34 +00:00
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
src_value <<= 2; /* 4 bytes per sample */
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_value = src_value * 44100 / GST_SECOND;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (*dest_format == track_format || *dest_format == sector_format) {
|
|
|
|
gint sector =
|
|
|
|
(src_value * 44100) / ((CD_FRAMESIZE_RAW >> 2) * GST_SECOND);
|
|
|
|
|
|
|
|
if (*dest_format == sector_format) {
|
|
|
|
*dest_value = sector;
|
|
|
|
} else {
|
|
|
|
*dest_value = cdda_sector_gettrack (src->d, sector) - 1;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
return FALSE;
|
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
src_value >>= 2;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*dest_value = src_value * 4;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*dest_value = src_value * GST_SECOND / 44100;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (*dest_format == track_format || *dest_format == sector_format) {
|
|
|
|
gint sector = src_value / (CD_FRAMESIZE_RAW >> 2);
|
|
|
|
|
|
|
|
if (*dest_format == track_format) {
|
|
|
|
*dest_value = cdda_sector_gettrack (src->d, sector) - 1;
|
|
|
|
} else {
|
|
|
|
*dest_value = sector;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
return FALSE;
|
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
gint64 sector;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
if (src_format == track_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
/* some sanity checks */
|
|
|
|
if (src_value < 0 || src_value > src->d->tracks)
|
|
|
|
return FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
sector = cdda_track_firstsector (src->d, src_value + 1);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else if (src_format == sector_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
sector = src_value;
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2004-03-15 19:32:28 +00:00
|
|
|
return FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*dest_value = ((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
sector <<= 2;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_value = (CD_FRAMESIZE_RAW >> 2) * sector;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (*dest_format == sector_format) {
|
|
|
|
*dest_value = sector;
|
|
|
|
} else if (*dest_format == track_format) {
|
|
|
|
/* if we go past the last sector, make sure to report the last track */
|
2005-02-08 11:28:54 +00:00
|
|
|
if (sector > src->last_sector - src->first_sector)
|
2004-03-15 19:32:28 +00:00
|
|
|
*dest_value = cdda_sector_gettrack (src->d, src->last_sector);
|
|
|
|
else
|
2005-02-08 11:28:54 +00:00
|
|
|
*dest_value = cdda_sector_gettrack (src->d,
|
|
|
|
sector + src->first_sector) - 1;
|
2004-03-15 19:32:28 +00:00
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-01 00:40:15 +00:00
|
|
|
return TRUE;
|
2002-09-28 23:28:37 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static const GstQueryType *
|
|
|
|
cdparanoia_get_query_types (GstPad * pad)
|
2002-11-01 17:06:08 +00:00
|
|
|
{
|
2002-12-30 17:53:18 +00:00
|
|
|
static const GstQueryType src_query_types[] = {
|
|
|
|
GST_QUERY_TOTAL,
|
|
|
|
GST_QUERY_POSITION,
|
|
|
|
GST_QUERY_START,
|
|
|
|
GST_QUERY_SEGMENT_END,
|
2002-11-01 17:06:08 +00:00
|
|
|
0
|
|
|
|
};
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2002-11-01 17:06:08 +00:00
|
|
|
return src_query_types;
|
|
|
|
}
|
|
|
|
|
2002-10-31 00:06:48 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_query (GstPad * pad, GstQueryType type,
|
|
|
|
GstFormat * format, gint64 * value)
|
2002-10-31 00:06:48 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
CDParanoia *src;
|
|
|
|
|
|
|
|
src = CDPARANOIA (gst_pad_get_parent (pad));
|
|
|
|
|
2003-01-01 23:57:41 +00:00
|
|
|
if (!GST_FLAG_IS_SET (src, CDPARANOIA_OPEN)) {
|
2002-10-31 00:06:48 +00:00
|
|
|
return FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2002-10-31 00:06:48 +00:00
|
|
|
|
|
|
|
switch (type) {
|
2002-12-30 17:53:18 +00:00
|
|
|
case GST_QUERY_TOTAL:
|
2002-11-01 00:40:15 +00:00
|
|
|
/* we take the last sector + 1 so that we also have the full
|
|
|
|
* size of that last sector */
|
2004-03-14 22:34:34 +00:00
|
|
|
res = gst_pad_convert (src->srcpad,
|
2004-10-11 12:18:42 +00:00
|
|
|
sector_format, src->last_sector + 1 - src->first_sector,
|
|
|
|
format, value);
|
2002-10-31 00:06:48 +00:00
|
|
|
break;
|
2002-12-30 17:53:18 +00:00
|
|
|
case GST_QUERY_POSITION:
|
2002-11-01 00:40:15 +00:00
|
|
|
/* bring our current sector to the requested format */
|
2004-03-14 22:34:34 +00:00
|
|
|
res = gst_pad_convert (src->srcpad,
|
2004-10-11 12:18:42 +00:00
|
|
|
sector_format, src->cur_sector - src->first_sector, format, value);
|
2002-10-31 00:06:48 +00:00
|
|
|
break;
|
2002-12-30 17:53:18 +00:00
|
|
|
case GST_QUERY_START:
|
2004-03-14 22:34:34 +00:00
|
|
|
res = gst_pad_convert (src->srcpad,
|
2004-10-11 12:18:42 +00:00
|
|
|
sector_format, src->segment_start_sector - src->first_sector,
|
|
|
|
format, value);
|
2002-11-01 17:06:08 +00:00
|
|
|
break;
|
2002-12-30 17:53:18 +00:00
|
|
|
case GST_QUERY_SEGMENT_END:
|
2004-03-14 22:34:34 +00:00
|
|
|
res = gst_pad_convert (src->srcpad,
|
2004-10-11 12:18:42 +00:00
|
|
|
sector_format, src->segment_end_sector - src->first_sector,
|
|
|
|
format, value);
|
2002-11-01 17:06:08 +00:00
|
|
|
break;
|
2002-10-31 00:06:48 +00:00
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2003-01-01 23:57:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_set_index (GstElement * element, GstIndex * index)
|
2003-01-01 23:57:41 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
CDParanoia *cdparanoia;
|
2003-01-01 23:57:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia = CDPARANOIA (element);
|
2003-01-01 23:57:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia->index = index;
|
2003-01-01 23:57:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_index_get_writer_id (index, GST_OBJECT (cdparanoia->srcpad),
|
|
|
|
&cdparanoia->index_id);
|
|
|
|
gst_index_add_format (index, cdparanoia->index_id, track_format);
|
|
|
|
gst_index_add_format (index, cdparanoia->index_id, sector_format);
|
2003-01-01 23:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstIndex *
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia_get_index (GstElement * element)
|
2003-01-01 23:57:41 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
CDParanoia *cdparanoia;
|
2003-01-01 23:57:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
cdparanoia = CDPARANOIA (element);
|
2002-10-31 00:06:48 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
return cdparanoia->index;
|
2003-01-01 23:57:41 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2001-12-23 13:06:22 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-23 13:06:22 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
if (!gst_element_register (plugin, "cdparanoia", GST_RANK_NONE,
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_TYPE_CDPARANOIA))
|
2004-03-14 22:34:34 +00:00
|
|
|
return FALSE;
|
2001-12-23 13:06:22 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
|
|
|
|
|
|
|
static guint
|
|
|
|
cdparanoia_uri_get_type (void)
|
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
|
|
|
static gchar **
|
|
|
|
cdparanoia_uri_get_protocols (void)
|
|
|
|
{
|
|
|
|
static gchar *protocols[] = { "cdda", NULL };
|
|
|
|
|
|
|
|
return protocols;
|
|
|
|
}
|
|
|
|
static const gchar *
|
|
|
|
cdparanoia_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
CDParanoia *cdparanoia = CDPARANOIA (handler);
|
|
|
|
|
|
|
|
return cdparanoia->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
cdparanoia_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|
|
|
{
|
|
|
|
gchar *protocol, *location;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
CDParanoia *cdparanoia = CDPARANOIA (handler);
|
|
|
|
|
2004-11-01 13:23:29 +00:00
|
|
|
ret = TRUE;
|
|
|
|
|
ext/cdparanoia/gstcdparanoia.*: Added reworked patch from #154903 from milosz derezynski. This adds the cdda://<track...
Original commit message from CVS:
* ext/cdparanoia/gstcdparanoia.c: (_do_init),
(cdparanoia_base_init), (cdparanoia_class_init), (cdparanoia_init),
(cdparanoia_dispose), (cdparanoia_get), (cdparanoia_change_state),
(cdparanoia_convert), (cdparanoia_uri_get_type),
(cdparanoia_uri_get_protocols), (cdparanoia_uri_get_uri),
(cdparanoia_uri_set_uri), (cdparanoia_uri_handler_init):
* ext/cdparanoia/gstcdparanoia.h:
Added reworked patch from #154903 from milosz derezynski. This
adds the cdda://<tracknum> uri.
2004-10-08 17:02:51 +00:00
|
|
|
protocol = gst_uri_get_protocol (uri);
|
|
|
|
if (strcmp (protocol, "cdda") != 0) {
|
|
|
|
g_free (protocol);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
g_free (protocol);
|
|
|
|
location = gst_uri_get_location (uri);
|
|
|
|
cdparanoia->uri_track = strtol (location, NULL, 10);
|
|
|
|
if (cdparanoia->uri_track > 0) {
|
|
|
|
cdparanoia->seek_request = cdparanoia->uri_track;
|
|
|
|
}
|
|
|
|
g_free (location);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cdparanoia_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = cdparanoia_uri_get_type;
|
|
|
|
iface->get_protocols = cdparanoia_uri_get_protocols;
|
|
|
|
iface->get_uri = cdparanoia_uri_get_uri;
|
|
|
|
iface->set_uri = cdparanoia_uri_set_uri;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"cdparanoia",
|
|
|
|
"Read audio from CD in paranoid mode",
|
|
|
|
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|