mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
New cdparanoiasrc element based on cddabasesrc; enable cdparanoia plugin again (there are still fixes required to pla...
Original commit message from CVS: * configure.ac: * ext/cdparanoia/Makefile.am: * ext/cdparanoia/gstcdparanoia.c: * ext/cdparanoia/gstcdparanoia.h: * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_mode_get_type), (gst_cd_paranoia_src_base_init), (gst_cd_paranoia_src_init), (gst_cd_paranoia_src_class_init), (gst_cd_paranoia_src_open), (gst_cd_paranoia_src_close), (gst_cd_paranoia_paranoia_callback), (gst_cd_paranoia_src_read_sector), (gst_cd_paranoia_src_finalize), (gst_cd_paranoia_src_set_property), (gst_cd_paranoia_src_get_property), (plugin_init): * ext/cdparanoia/gstcdparanoiasrc.h: New cdparanoiasrc element based on cddabasesrc; enable cdparanoia plugin again (there are still fixes required to playbin to make cdda:// uris work there).
This commit is contained in:
parent
0d0dd13a71
commit
a8937ea36e
7 changed files with 500 additions and 1244 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
2005-12-29 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* ext/cdparanoia/Makefile.am:
|
||||||
|
* ext/cdparanoia/gstcdparanoia.c:
|
||||||
|
* ext/cdparanoia/gstcdparanoia.h:
|
||||||
|
* ext/cdparanoia/gstcdparanoiasrc.c:
|
||||||
|
(gst_cd_paranoia_mode_get_type), (gst_cd_paranoia_src_base_init),
|
||||||
|
(gst_cd_paranoia_src_init), (gst_cd_paranoia_src_class_init),
|
||||||
|
(gst_cd_paranoia_src_open), (gst_cd_paranoia_src_close),
|
||||||
|
(gst_cd_paranoia_paranoia_callback),
|
||||||
|
(gst_cd_paranoia_src_read_sector), (gst_cd_paranoia_src_finalize),
|
||||||
|
(gst_cd_paranoia_src_set_property),
|
||||||
|
(gst_cd_paranoia_src_get_property), (plugin_init):
|
||||||
|
* ext/cdparanoia/gstcdparanoiasrc.h:
|
||||||
|
New cdparanoiasrc element based on cddabasesrc; enable cdparanoia
|
||||||
|
plugin again (there are still fixes required to playbin to make
|
||||||
|
cdda:// uris work there).
|
||||||
|
|
||||||
2005-12-29 Tim-Philipp Müller <tim at centricular dot net>
|
2005-12-29 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* tests/check/Makefile.am:
|
* tests/check/Makefile.am:
|
||||||
|
|
|
@ -430,11 +430,6 @@ GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
|
||||||
defined if cdda headers are in a cdda/ directory)
|
defined if cdda headers are in a cdda/ directory)
|
||||||
fi
|
fi
|
||||||
AC_SUBST(CDPARANOIA_LIBS)
|
AC_SUBST(CDPARANOIA_LIBS)
|
||||||
|
|
||||||
dnl FIXME: temporarily disable for release
|
|
||||||
HAVE_CDPARANOIA=no
|
|
||||||
], disabled, , [
|
|
||||||
AC_MSG_NOTICE(cdparanoiasrc not stable yet, not building)
|
|
||||||
])
|
])
|
||||||
dnl FIXME : add second check somehow if that is necessary
|
dnl FIXME : add second check somehow if that is necessary
|
||||||
dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
|
dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
plugin_LTLIBRARIES = libgstcdparanoia.la
|
plugin_LTLIBRARIES = libgstcdparanoia.la
|
||||||
|
|
||||||
libgstcdparanoia_la_SOURCES = gstcdparanoia.c
|
libgstcdparanoia_la_SOURCES = gstcdparanoiasrc.c
|
||||||
libgstcdparanoia_la_CFLAGS = $(GST_CFLAGS)
|
libgstcdparanoia_la_CFLAGS = $(GST_CFLAGS)
|
||||||
libgstcdparanoia_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstcdparanoia_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
libgstcdparanoia_la_LIBADD = $(CDPARANOIA_LIBS) $(GST_LIBS) $(GST_BASE_LIBS)
|
libgstcdparanoia_la_LIBADD = \
|
||||||
|
$(top_builddir)/gst-libs/gst/cdda/libgstcdda-@GST_MAJORMINOR@.la \
|
||||||
|
$(CDPARANOIA_LIBS) \
|
||||||
|
$(GST_BASE_LIBS) \
|
||||||
|
$(GST_LIBS)
|
||||||
|
|
||||||
|
noinst_HEADERS = gstcdparanoiasrc.h
|
||||||
|
|
||||||
|
|
||||||
noinst_HEADERS = gstcdparanoia.h
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,122 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CDPARANOIA_H__
|
|
||||||
#define __CDPARANOIA_H__
|
|
||||||
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/base/gstpushsrc.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define size16 gint16
|
|
||||||
#define size32 gint32
|
|
||||||
|
|
||||||
#ifdef CDPARANOIA_HEADERS_IN_DIR
|
|
||||||
#include <cdda/cdda_interface.h>
|
|
||||||
#include <cdda/cdda_paranoia.h>
|
|
||||||
#else
|
|
||||||
#include <cdda_interface.h>
|
|
||||||
#include <cdda_paranoia.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*#define CDPARANOIA_BASEOFFSET 0xf1d2 */
|
|
||||||
#define CDPARANOIA_BASEOFFSET 0x0
|
|
||||||
|
|
||||||
#define GST_TYPE_CDPARANOIA \
|
|
||||||
(cdparanoia_get_type())
|
|
||||||
#define CDPARANOIA(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CDPARANOIA,CDParanoia))
|
|
||||||
#define CDPARANOIA_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CDPARANOIA,CDParanoiaClass))
|
|
||||||
#define GST_IS_CDPARANOIA(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CDPARANOIA))
|
|
||||||
#define GST_IS_CDPARANOIA_CLASS(obj) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CDPARANOIA))
|
|
||||||
|
|
||||||
typedef struct _CDParanoia CDParanoia;
|
|
||||||
typedef struct _CDParanoiaClass CDParanoiaClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CDParanoia:
|
|
||||||
*
|
|
||||||
* Opaque #CDParanoia structure
|
|
||||||
*/
|
|
||||||
struct _CDParanoia {
|
|
||||||
GstPushSrc pushsrc;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
|
|
||||||
/* Index */
|
|
||||||
GstIndex *index;
|
|
||||||
int index_id;
|
|
||||||
|
|
||||||
gchar *device;
|
|
||||||
gchar *generic_device;
|
|
||||||
gint default_sectors;
|
|
||||||
gint search_overlap;
|
|
||||||
gint endian;
|
|
||||||
gint read_speed;
|
|
||||||
gint toc_offset;
|
|
||||||
gboolean toc_bias;
|
|
||||||
gint never_skip;
|
|
||||||
gboolean abort_on_skip;
|
|
||||||
gint paranoia_mode;
|
|
||||||
gchar *uri; /* URI caching */
|
|
||||||
gint uri_track;
|
|
||||||
gint seek_request;
|
|
||||||
|
|
||||||
cdrom_drive *d;
|
|
||||||
cdrom_paranoia *p;
|
|
||||||
|
|
||||||
gint cur_sector;
|
|
||||||
gint segment_start_sector;
|
|
||||||
gint segment_end_sector;
|
|
||||||
|
|
||||||
gint first_sector;
|
|
||||||
gint last_sector;
|
|
||||||
|
|
||||||
gchar discid[20];
|
|
||||||
gint64 offsets[MAXTRK];
|
|
||||||
gint64 total_seconds;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _CDParanoiaClass {
|
|
||||||
GstPushSrcClass parent_class;
|
|
||||||
|
|
||||||
/* signal callbacks */
|
|
||||||
void (*smilie_change) (CDParanoia *cdparanoia, gchar *smilie);
|
|
||||||
void (*transport_error) (CDParanoia *cdparanoia, gint offset);
|
|
||||||
void (*uncorrected_error) (CDParanoia *cdparanoia, gint offset);
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
|
||||||
};
|
|
||||||
|
|
||||||
GType cdparanoia_get_type(void);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CDPARANOIA_H__ */
|
|
398
ext/cdparanoia/gstcdparanoiasrc.c
Normal file
398
ext/cdparanoia/gstcdparanoiasrc.c
Normal file
|
@ -0,0 +1,398 @@
|
||||||
|
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
|
* <2005> Wim Taymans <wim@fluendo.com>
|
||||||
|
* <2005> Tim-Philipp Müller <tim centricular net>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "gstcdparanoiasrc.h"
|
||||||
|
#include "gst/gst-i18n-plugin.h"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_READ_SPEED,
|
||||||
|
PROP_PARANOIA_MODE,
|
||||||
|
PROP_SEARCH_OVERLAP,
|
||||||
|
PROP_GENERIC_DEVICE
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_READ_SPEED -1
|
||||||
|
#define DEFAULT_SEARCH_OVERLAP -1
|
||||||
|
#define DEFAULT_PARANOIA_MODE PARANOIA_MODE_FRAGMENT
|
||||||
|
#define DEFAULT_GENERIC_DEVICE NULL
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (gst_cd_paranoia_src_debug);
|
||||||
|
#define GST_CAT_DEFAULT gst_cd_paranoia_src_debug
|
||||||
|
|
||||||
|
GST_BOILERPLATE (GstCdParanoiaSrc, gst_cd_paranoia_src, GstCddaBaseSrc,
|
||||||
|
GST_TYPE_CDDA_BASE_SRC);
|
||||||
|
|
||||||
|
static void gst_cd_paranoia_src_finalize (GObject * obj);
|
||||||
|
static void gst_cd_paranoia_src_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec * pspec);
|
||||||
|
static void gst_cd_paranoia_src_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec * pspec);
|
||||||
|
static GstBuffer *gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * src,
|
||||||
|
gint sector);
|
||||||
|
static gboolean gst_cd_paranoia_src_open (GstCddaBaseSrc * src,
|
||||||
|
const gchar * device);
|
||||||
|
static void gst_cd_paranoia_src_close (GstCddaBaseSrc * src);
|
||||||
|
|
||||||
|
static GstElementDetails cdparanoia_details = {
|
||||||
|
"CD Audio (cdda) Source, Paranoia IV",
|
||||||
|
"Source/File",
|
||||||
|
"Read audio from CD in paranoid mode",
|
||||||
|
"Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>"
|
||||||
|
};
|
||||||
|
|
||||||
|
#define GST_TYPE_CD_PARANOIA_MODE (gst_cd_paranoia_mode_get_type())
|
||||||
|
static GType
|
||||||
|
gst_cd_paranoia_mode_get_type (void)
|
||||||
|
{
|
||||||
|
static const GFlagsValue paranoia_modes[] = {
|
||||||
|
{PARANOIA_MODE_DISABLE, "PARANOIA_MODE_DISABLE", "disable"},
|
||||||
|
{PARANOIA_MODE_FRAGMENT, "PARANOIA_MODE_FRAGMENT", "fragment"},
|
||||||
|
{PARANOIA_MODE_OVERLAP, "PARANOIA_MODE_OVERLAP", "overlap"},
|
||||||
|
{PARANOIA_MODE_SCRATCH, "PARANOIA_MODE_SCRATCH", "scratch"},
|
||||||
|
{PARANOIA_MODE_REPAIR, "PARANOIA_MODE_REPAIR", "repair"},
|
||||||
|
{PARANOIA_MODE_FULL, "PARANOIA_MODE_FULL", "full"},
|
||||||
|
{0, NULL, NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
static GType type; /* 0 */
|
||||||
|
|
||||||
|
if (!type) {
|
||||||
|
type = g_flags_register_static ("GstCdParanoiaMode", paranoia_modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_base_init (gpointer g_class)
|
||||||
|
{
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
|
|
||||||
|
gst_element_class_set_details (element_class, &cdparanoia_details);
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_cd_paranoia_src_debug, "cdparanoiasrc", 0,
|
||||||
|
"CD Paranoia Source");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_init (GstCdParanoiaSrc * src, GstCdParanoiaSrcClass * klass)
|
||||||
|
{
|
||||||
|
src->d = NULL;
|
||||||
|
src->p = NULL;
|
||||||
|
src->next_sector = -1;
|
||||||
|
|
||||||
|
src->search_overlap = DEFAULT_SEARCH_OVERLAP;
|
||||||
|
src->paranoia_mode = DEFAULT_PARANOIA_MODE;
|
||||||
|
src->read_speed = DEFAULT_READ_SPEED;
|
||||||
|
src->generic_device = g_strdup (DEFAULT_GENERIC_DEVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_class_init (GstCdParanoiaSrcClass * klass)
|
||||||
|
{
|
||||||
|
GstCddaBaseSrcClass *cddabasesrc_class = GST_CDDA_BASE_SRC_CLASS (klass);
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
gobject_class->set_property = gst_cd_paranoia_src_set_property;
|
||||||
|
gobject_class->get_property = gst_cd_paranoia_src_get_property;
|
||||||
|
gobject_class->finalize = gst_cd_paranoia_src_finalize;
|
||||||
|
|
||||||
|
cddabasesrc_class->open = gst_cd_paranoia_src_open;
|
||||||
|
cddabasesrc_class->close = gst_cd_paranoia_src_close;
|
||||||
|
cddabasesrc_class->read_sector = gst_cd_paranoia_src_read_sector;
|
||||||
|
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GENERIC_DEVICE,
|
||||||
|
g_param_spec_string ("generic-device", "Generic device",
|
||||||
|
"Use specified generic scsi device", DEFAULT_GENERIC_DEVICE,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_READ_SPEED,
|
||||||
|
g_param_spec_int ("read-speed", "Read speed",
|
||||||
|
"Read from device at specified speed", -1, G_MAXINT,
|
||||||
|
DEFAULT_READ_SPEED, G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PARANOIA_MODE,
|
||||||
|
g_param_spec_flags ("paranoia-mode", "Paranoia mode",
|
||||||
|
"Type of checking to perform", GST_TYPE_CD_PARANOIA_MODE,
|
||||||
|
DEFAULT_PARANOIA_MODE, G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEARCH_OVERLAP,
|
||||||
|
g_param_spec_int ("search-overlap", "Search overlap",
|
||||||
|
"Force minimum overlap search during verification to n sectors", -1,
|
||||||
|
75, DEFAULT_SEARCH_OVERLAP, G_PARAM_READWRITE));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_cd_paranoia_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device)
|
||||||
|
{
|
||||||
|
GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (cddabasesrc);
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "trying to open device %s (generic-device=%s) ...",
|
||||||
|
device, GST_STR_NULL (src->generic_device));
|
||||||
|
|
||||||
|
/* find the device */
|
||||||
|
if (src->generic_device != NULL) {
|
||||||
|
src->d = cdda_identify_scsi (src->generic_device, device, FALSE, NULL);
|
||||||
|
} else {
|
||||||
|
if (device != NULL) {
|
||||||
|
src->d = cdda_identify (device, FALSE, NULL);
|
||||||
|
} else {
|
||||||
|
src->d = cdda_identify ("/dev/cdrom", FALSE, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fail if the device couldn't be found */
|
||||||
|
if (src->d == NULL)
|
||||||
|
goto no_device;
|
||||||
|
|
||||||
|
/* set verbosity mode */
|
||||||
|
cdda_verbose_set (src->d, CDDA_MESSAGE_FORGETIT, CDDA_MESSAGE_FORGETIT);
|
||||||
|
|
||||||
|
/* open the disc */
|
||||||
|
if (cdda_open (src->d))
|
||||||
|
goto open_failed;
|
||||||
|
|
||||||
|
if (src->read_speed != -1) {
|
||||||
|
cdda_speed_set (src->d, src->read_speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 1; i < src->d->tracks + 1; i++) {
|
||||||
|
GstCddaBaseSrcTrack track = { 0, };
|
||||||
|
|
||||||
|
track.num = i;
|
||||||
|
track.is_audio = IS_AUDIO (src->d, i - 1);
|
||||||
|
track.start = cdda_track_firstsector (src->d, i);
|
||||||
|
track.end = cdda_track_lastsector (src->d, i);
|
||||||
|
track.tags = NULL;
|
||||||
|
|
||||||
|
gst_cdda_base_src_add_track (GST_CDDA_BASE_SRC (src), &track);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create the paranoia struct and set it up */
|
||||||
|
src->p = paranoia_init (src->d);
|
||||||
|
if (src->p == NULL)
|
||||||
|
goto init_failed;
|
||||||
|
|
||||||
|
paranoia_modeset (src->p, src->paranoia_mode);
|
||||||
|
|
||||||
|
if (src->search_overlap != -1)
|
||||||
|
paranoia_overlapset (src->p, src->search_overlap);
|
||||||
|
|
||||||
|
src->next_sector = -1;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
no_device:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
|
(_("Could not open CD device for reading.")), ("cdda_identify failed"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
open_failed:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
|
(_("Could not open CD device for reading.")), ("cdda_open failed"));
|
||||||
|
cdda_close (src->d);
|
||||||
|
src->d = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
init_failed:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (src, LIBRARY, INIT,
|
||||||
|
("failed to initialize paranoia"), ("failed to initialize paranoia"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_close (GstCddaBaseSrc * cddabasesrc)
|
||||||
|
{
|
||||||
|
GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (cddabasesrc);
|
||||||
|
|
||||||
|
paranoia_free (src->p);
|
||||||
|
src->p = NULL;
|
||||||
|
|
||||||
|
cdda_close (src->d);
|
||||||
|
src->d = NULL;
|
||||||
|
|
||||||
|
src->next_sector = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_paranoia_callback (long inpos, int function)
|
||||||
|
{
|
||||||
|
/* do nothing for now, maybe emit signals later */
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstBuffer *
|
||||||
|
gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector)
|
||||||
|
{
|
||||||
|
GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (cddabasesrc);
|
||||||
|
GstBuffer *buf;
|
||||||
|
gint16 *cdda_buf;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Do we really need to output this? (tpm) */
|
||||||
|
/* 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 */
|
||||||
|
if (src->d && src->d->cd_extra) {
|
||||||
|
g_message
|
||||||
|
("DiscID on multisession discs might be broken. Use at own risk.");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (src->next_sector == -1 || src->next_sector != sector) {
|
||||||
|
if (paranoia_seek (src->p, sector, SEEK_SET) == -1) {
|
||||||
|
GST_WARNING_OBJECT (src, "seek to sector %d failed!", sector);
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, SEEK,
|
||||||
|
(_("Could not seek CD.")),
|
||||||
|
("paranoia_seek to %d failed: %s", sector, g_strerror (errno)));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
GST_DEBUG_OBJECT (src, "successfully seeked to sector %d", sector);
|
||||||
|
src->next_sector = sector;
|
||||||
|
}
|
||||||
|
|
||||||
|
cdda_buf = paranoia_read (src->p, gst_cd_paranoia_paranoia_callback);
|
||||||
|
|
||||||
|
if (cdda_buf == NULL) {
|
||||||
|
GST_WARNING_OBJECT (src, "read at sector %d failed!", sector);
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
||||||
|
(_("Could not read CD.")),
|
||||||
|
("paranoia_read at %d failed: %s", sector, g_strerror (errno)));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW);
|
||||||
|
memcpy (GST_BUFFER_DATA (buf), cdda_buf, CD_FRAMESIZE_RAW);
|
||||||
|
|
||||||
|
/* cdda base class will take care of timestamping etc. */
|
||||||
|
++src->next_sector;
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_finalize (GObject * obj)
|
||||||
|
{
|
||||||
|
GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (obj);
|
||||||
|
|
||||||
|
g_free (src->generic_device);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (src);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_GENERIC_DEVICE:{
|
||||||
|
g_free (src->generic_device);
|
||||||
|
src->generic_device = g_value_dup_string (value);
|
||||||
|
if (src->generic_device && src->generic_device[0] == '\0') {
|
||||||
|
g_free (src->generic_device);
|
||||||
|
src->generic_device = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROP_READ_SPEED:{
|
||||||
|
src->read_speed = g_value_get_int (value);
|
||||||
|
if (src->read_speed == 0)
|
||||||
|
src->read_speed = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROP_PARANOIA_MODE:{
|
||||||
|
src->paranoia_mode = g_value_get_flags (value) & PARANOIA_MODE_FULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROP_SEARCH_OVERLAP:{
|
||||||
|
src->search_overlap = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_cd_paranoia_src_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (src);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_READ_SPEED:
|
||||||
|
g_value_set_int (value, src->read_speed);
|
||||||
|
break;
|
||||||
|
case PROP_PARANOIA_MODE:
|
||||||
|
g_value_set_flags (value, src->paranoia_mode);
|
||||||
|
break;
|
||||||
|
case PROP_GENERIC_DEVICE:
|
||||||
|
g_value_set_string (value, src->generic_device);
|
||||||
|
break;
|
||||||
|
case PROP_SEARCH_OVERLAP:
|
||||||
|
g_value_set_int (value, src->search_overlap);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
plugin_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
if (!gst_element_register (plugin, "cdparanoiasrc", GST_RANK_SECONDARY,
|
||||||
|
GST_TYPE_CD_PARANOIA_SRC))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
|
GST_VERSION_MINOR,
|
||||||
|
"cdparanoia",
|
||||||
|
"Read audio from CD in paranoid mode",
|
||||||
|
plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
74
ext/cdparanoia/gstcdparanoiasrc.h
Normal file
74
ext/cdparanoia/gstcdparanoiasrc.h
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GST_CD_PARANOIA_SRC_H__
|
||||||
|
#define __GST_CD_PARANOIA_SRC_H__
|
||||||
|
|
||||||
|
#include "gst/cdda/gstcddabasesrc.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define size16 gint16
|
||||||
|
#define size32 gint32
|
||||||
|
|
||||||
|
#ifdef CDPARANOIA_HEADERS_IN_DIR
|
||||||
|
#include <cdda/cdda_interface.h>
|
||||||
|
#include <cdda/cdda_paranoia.h>
|
||||||
|
#else
|
||||||
|
#include <cdda_interface.h>
|
||||||
|
#include <cdda_paranoia.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GST_TYPE_CD_PARANOIA_SRC (gst_cd_paranoia_src_get_type())
|
||||||
|
#define GST_CD_PARANOIA_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CD_PARANOIA_SRC,GstCdParanoiaSrc))
|
||||||
|
#define GST_CD_PARANOIA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CD_PARANOIA_SRC,GstCdParanoiaSrcClass))
|
||||||
|
#define GST_IS_CD_PARANOIA_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CD_PARANOIA_SRC))
|
||||||
|
#define GST_IS_CD_PARANOIA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CD_PARANOIA_SRC))
|
||||||
|
#define GST_CD_PARANOIA_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASAE_SRC, GstCdParanoiaSrcClass))
|
||||||
|
|
||||||
|
typedef struct _GstCdParanoiaSrc GstCdParanoiaSrc;
|
||||||
|
typedef struct _GstCdParanoiaSrcClass GstCdParanoiaSrcClass;
|
||||||
|
|
||||||
|
struct _GstCdParanoiaSrc {
|
||||||
|
GstCddaBaseSrc cddabasesrc;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
cdrom_drive *d;
|
||||||
|
cdrom_paranoia *p;
|
||||||
|
|
||||||
|
gint next_sector; /* -1 or next sector we expect to
|
||||||
|
* read, so we know when to do a seek */
|
||||||
|
|
||||||
|
gint paranoia_mode;
|
||||||
|
gint read_speed;
|
||||||
|
gint search_overlap;
|
||||||
|
|
||||||
|
gchar *generic_device;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GstCdParanoiaSrcClass {
|
||||||
|
GstCddaBaseSrcClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gst_cd_paranoia_src_get_type (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_CD_PARANOIA_SRC_H__ */
|
||||||
|
|
Loading…
Reference in a new issue