mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
cdaudio: Remove cdaudio plugin
This element is being removed due to it been considered obsolete and the functionaily it provides no longer needed. Details on the decision can be found here: https://bugzilla.gnome.org/show_bug.cgi?id=711223 Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=711232
This commit is contained in:
parent
010fd8a471
commit
980f5b4702
9 changed files with 9 additions and 724 deletions
14
configure.ac
14
configure.ac
|
@ -1103,18 +1103,6 @@ AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [
|
|||
# AC_SUBST(CAIRO_LIBS)
|
||||
#])
|
||||
|
||||
dnl *** cdaudio ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_CDAUDIO, true)
|
||||
AG_GST_CHECK_FEATURE(CDAUDIO, [cdaudio], cdaudio, [
|
||||
PKG_CHECK_MODULES(CDAUDIO, libcdaudio, [
|
||||
HAVE_CDAUDIO="yes"
|
||||
], [
|
||||
HAVE_CDAUDIO="no"
|
||||
])
|
||||
AC_SUBST(CDAUDIO_CFLAGS)
|
||||
AC_SUBST(CDAUDIO_LIBS)
|
||||
])
|
||||
|
||||
dnl *** chromaprint ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_CHROMAPRINT, true)
|
||||
AG_GST_CHECK_FEATURE(CHROMAPRINT, [chromaprint], chromaprint, [
|
||||
|
@ -2190,7 +2178,6 @@ AM_CONDITIONAL(USE_VOAMRWBENC, false)
|
|||
AM_CONDITIONAL(USE_VOAACENC, false)
|
||||
AM_CONDITIONAL(USE_APEXSINK, false)
|
||||
AM_CONDITIONAL(USE_BZ2, false)
|
||||
AM_CONDITIONAL(USE_CDAUDIO, false)
|
||||
AM_CONDITIONAL(USE_CHROMAPRINT, false)
|
||||
AM_CONDITIONAL(USE_CURL, false)
|
||||
AM_CONDITIONAL(USE_DASH, false)
|
||||
|
@ -2461,7 +2448,6 @@ ext/voaacenc/Makefile
|
|||
ext/assrender/Makefile
|
||||
ext/apexsink/Makefile
|
||||
ext/bz2/Makefile
|
||||
ext/cdaudio/Makefile
|
||||
ext/chromaprint/Makefile
|
||||
ext/curl/Makefile
|
||||
ext/dash/Makefile
|
||||
|
|
|
@ -16878,56 +16878,6 @@
|
|||
<DEFAULT>0.5</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstCDAudio::device</NAME>
|
||||
<TYPE>gchar*</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Device</NICK>
|
||||
<BLURB>CDROM device.</BLURB>
|
||||
<DEFAULT>NULL</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstCDAudio::volume-bl</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,255]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Volume bl</NICK>
|
||||
<BLURB>Back left volume.</BLURB>
|
||||
<DEFAULT>255</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstCDAudio::volume-br</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,255]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Volume br</NICK>
|
||||
<BLURB>Back right volume.</BLURB>
|
||||
<DEFAULT>255</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstCDAudio::volume-fl</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,255]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Volume fl</NICK>
|
||||
<BLURB>Front left volume.</BLURB>
|
||||
<DEFAULT>255</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstCDAudio::volume-fr</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,255]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Volume fr</NICK>
|
||||
<BLURB>Front right volume.</BLURB>
|
||||
<DEFAULT>255</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstNasSink::host</NAME>
|
||||
<TYPE>gchar*</TYPE>
|
||||
|
|
|
@ -11,7 +11,6 @@ GstAutoVideoConvert GstChildProxy
|
|||
GstBaseCameraSrc GstChildProxy
|
||||
GstBaseVideoEncoder GstPreset
|
||||
GstBin GstChildProxy
|
||||
GstCDAudio GstURIHandler
|
||||
GstCameraBin GstChildProxy GstImplementsInterface GstColorBalance GstTagSetter
|
||||
GstCameraBin GstChildProxy GstTagSetter
|
||||
GstCameraBin2 GstChildProxy GstTagSetter
|
||||
|
|
|
@ -15,14 +15,6 @@ gint64 arg2
|
|||
gint64 arg3
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
<NAME>GstCDAudio::track-change</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
<FLAGS>l</FLAGS>
|
||||
GstCDAudio *gstcdaudio
|
||||
gint arg1
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
<NAME>GstInputSelector::block</NAME>
|
||||
<RETURNS>gint64</RETURNS>
|
||||
|
|
|
@ -28,12 +28,6 @@ else
|
|||
BZ2_DIR=
|
||||
endif
|
||||
|
||||
if USE_CDAUDIO
|
||||
CDAUDIO_DIR=cdaudio
|
||||
else
|
||||
CDAUDIO_DIR=
|
||||
endif
|
||||
|
||||
if USE_CHROMAPRINT
|
||||
CHROMAPRINT_DIR=chromaprint
|
||||
else
|
||||
|
@ -389,7 +383,6 @@ SUBDIRS=\
|
|||
$(APEXSINK_DIR) \
|
||||
$(AUDIOFILE_DIR) \
|
||||
$(BZ2_DIR) \
|
||||
$(CDAUDIO_DIR) \
|
||||
$(CHROMAPRINT_DIR) \
|
||||
$(CURL_DIR) \
|
||||
$(DASH_DIR) \
|
||||
|
@ -451,7 +444,6 @@ DIST_SUBDIRS = \
|
|||
assrender \
|
||||
apexsink \
|
||||
bz2 \
|
||||
cdaudio \
|
||||
chromaprint \
|
||||
curl \
|
||||
dash \
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
plugin_LTLIBRARIES = libgstcdaudio.la
|
||||
|
||||
libgstcdaudio_la_SOURCES = gstcdaudio.c
|
||||
libgstcdaudio_la_CFLAGS = $(GST_CFLAGS)
|
||||
libgstcdaudio_la_LIBADD = $(GST_LIBS)
|
||||
libgstcdaudio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -lcdaudio
|
||||
libgstcdaudio_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
|
||||
|
|
@ -1,626 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* <2006> Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <cdaudio.h>
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_cdaudio_debug);
|
||||
#define GST_CAT_DEFAULT gst_cdaudio_debug
|
||||
|
||||
#define GST_TYPE_CDAUDIO (gst_cdaudio_get_type())
|
||||
#define GST_CDAUDIO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CDAUDIO,GstCDAudio))
|
||||
#define GST_CDAUDIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CDAUDIO,GstCDAudioClass))
|
||||
#define GST_IS_CDAUDIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CDAUDIO))
|
||||
#define GST_IS_CDAUDIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CDAUDIO))
|
||||
|
||||
typedef struct _GstCDAudio GstCDAudio;
|
||||
typedef struct _GstCDAudioClass GstCDAudioClass;
|
||||
|
||||
struct _GstCDAudio
|
||||
{
|
||||
GstElement parent;
|
||||
|
||||
/* properties */
|
||||
gchar *device;
|
||||
gchar *uri;
|
||||
|
||||
gint cd_desc;
|
||||
gulong discid;
|
||||
|
||||
gboolean was_playing;
|
||||
|
||||
struct disc_info info;
|
||||
struct disc_volume volume;
|
||||
|
||||
GTimer *timer;
|
||||
};
|
||||
|
||||
struct _GstCDAudioClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
|
||||
void (*close_tray) (GstElement * element);
|
||||
/* signal callbacks */
|
||||
void (*track_change) (GstElement * element, guint track);
|
||||
};
|
||||
|
||||
#define DEFAULT_DEVICE "/dev/cdrom"
|
||||
#define DEFAULT_VOLUME_FR 255
|
||||
#define DEFAULT_VOLUME_FL 255
|
||||
#define DEFAULT_VOLUME_BR 255
|
||||
#define DEFAULT_VOLUME_BL 255
|
||||
|
||||
/* props */
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_DEVICE,
|
||||
PROP_VOLUME_FR,
|
||||
PROP_VOLUME_FL,
|
||||
PROP_VOLUME_BR,
|
||||
PROP_VOLUME_BL,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
/* signals */
|
||||
enum
|
||||
{
|
||||
TRACK_CHANGE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static void gst_cdaudio_finalize (GObject * object);
|
||||
|
||||
static void gst_cdaudio_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec);
|
||||
static void gst_cdaudio_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * spec);
|
||||
static GstStateChangeReturn gst_cdaudio_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
static gboolean gst_cdaudio_query (GstElement * element, GstQuery * query);
|
||||
|
||||
static gboolean gst_cdaudio_send_event (GstElement * element, GstEvent * event);
|
||||
|
||||
static void cdaudio_uri_handler_init (gpointer g_iface, gpointer iface_data);
|
||||
|
||||
static GstFormat track_format;
|
||||
static GstFormat sector_format;
|
||||
|
||||
static GstElementClass *parent_class;
|
||||
static guint gst_cdaudio_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType gst_cdaudio_get_type (void);
|
||||
|
||||
#define _do_init \
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, cdaudio_uri_handler_init); \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_cdaudio_debug, "cdaudio", 0, "CDAudio Element");
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GstCDAudio, gst_cdaudio, GST_TYPE_ELEMENT, _do_init);
|
||||
|
||||
static void
|
||||
gst_cdaudio_class_init (GstCDAudioClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_klass;
|
||||
GstElementClass *gstelement_klass;
|
||||
|
||||
gobject_klass = (GObjectClass *) klass;
|
||||
gstelement_klass = (GstElementClass *) klass;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gst_element_class_set_static_metadata (gstelement_klass, "CD player",
|
||||
"Generic/Bin",
|
||||
"Play CD audio through the CD Drive", "Wim Taymans <wim@fluendo.com>");
|
||||
|
||||
gobject_klass->set_property = gst_cdaudio_set_property;
|
||||
gobject_klass->get_property = gst_cdaudio_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_DEVICE,
|
||||
g_param_spec_string ("device", "Device", "CDROM device",
|
||||
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_klass, PROP_VOLUME_FL,
|
||||
g_param_spec_int ("volume-fl", "Volume fl", "Front left volume",
|
||||
0, 255, 255, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_klass, PROP_VOLUME_FR,
|
||||
g_param_spec_int ("volume-fr", "Volume fr", "Front right volume",
|
||||
0, 255, 255, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_klass, PROP_VOLUME_BL,
|
||||
g_param_spec_int ("volume-bl", "Volume bl", "Back left volume",
|
||||
0, 255, 255, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_klass, PROP_VOLUME_BR,
|
||||
g_param_spec_int ("volume-br", "Volume br", "Back right volume",
|
||||
0, 255, 255, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_cdaudio_signals[TRACK_CHANGE] =
|
||||
g_signal_new ("track-change", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstCDAudioClass, track_change), NULL,
|
||||
NULL, NULL, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_cdaudio_finalize);
|
||||
|
||||
gstelement_klass->change_state = GST_DEBUG_FUNCPTR (gst_cdaudio_change_state);
|
||||
gstelement_klass->send_event = GST_DEBUG_FUNCPTR (gst_cdaudio_send_event);
|
||||
gstelement_klass->query = GST_DEBUG_FUNCPTR (gst_cdaudio_query);
|
||||
|
||||
/* Register the track and sector format */
|
||||
track_format = gst_format_register ("track", "CD track");
|
||||
sector_format = gst_format_register ("sector", "CD sector");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_cdaudio_init (GstCDAudio * cdaudio)
|
||||
{
|
||||
cdaudio->device = g_strdup (DEFAULT_DEVICE);
|
||||
cdaudio->volume.vol_front.right = DEFAULT_VOLUME_FR;
|
||||
cdaudio->volume.vol_front.left = DEFAULT_VOLUME_FL;
|
||||
cdaudio->volume.vol_back.right = DEFAULT_VOLUME_BR;
|
||||
cdaudio->volume.vol_back.left = DEFAULT_VOLUME_BL;
|
||||
|
||||
cdaudio->was_playing = FALSE;
|
||||
cdaudio->timer = g_timer_new ();
|
||||
|
||||
GST_OBJECT_FLAG_SET (cdaudio, GST_ELEMENT_FLAG_SINK);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_cdaudio_finalize (GObject * object)
|
||||
{
|
||||
GstCDAudio *cdaudio = GST_CDAUDIO (object);
|
||||
|
||||
g_timer_destroy (cdaudio->timer);
|
||||
g_free (cdaudio->device);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_cdaudio_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * spec)
|
||||
{
|
||||
GstCDAudio *cdaudio;
|
||||
|
||||
cdaudio = GST_CDAUDIO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE:
|
||||
g_free (cdaudio->device);
|
||||
cdaudio->device = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_VOLUME_FR:
|
||||
cdaudio->volume.vol_front.right = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_VOLUME_FL:
|
||||
cdaudio->volume.vol_front.left = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_VOLUME_BR:
|
||||
cdaudio->volume.vol_back.right = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_VOLUME_BL:
|
||||
cdaudio->volume.vol_back.left = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_cdaudio_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * spec)
|
||||
{
|
||||
GstCDAudio *cdaudio;
|
||||
|
||||
cdaudio = GST_CDAUDIO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DEVICE:
|
||||
g_value_set_string (value, cdaudio->device);
|
||||
break;
|
||||
case PROP_VOLUME_FR:
|
||||
g_value_set_int (value, cdaudio->volume.vol_front.right);
|
||||
break;
|
||||
case PROP_VOLUME_FL:
|
||||
g_value_set_int (value, cdaudio->volume.vol_front.left);
|
||||
break;
|
||||
case PROP_VOLUME_BR:
|
||||
g_value_set_int (value, cdaudio->volume.vol_back.right);
|
||||
break;
|
||||
case PROP_VOLUME_BL:
|
||||
g_value_set_int (value, cdaudio->volume.vol_back.left);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
debug_track_info (GstCDAudio * cdaudio)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < cdaudio->info.disc_total_tracks; i++) {
|
||||
GST_DEBUG_OBJECT (cdaudio, "%d %d %d %d:%02d", i,
|
||||
cdaudio->info.disc_track[i].track_length.frames,
|
||||
cdaudio->info.disc_track[i].track_pos.frames,
|
||||
cdaudio->info.disc_track[i].track_length.minutes,
|
||||
cdaudio->info.disc_track[i].track_length.seconds);
|
||||
}
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_cdaudio_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
GstCDAudio *cdaudio;
|
||||
GstStateChangeReturn ret;
|
||||
gint res;
|
||||
|
||||
cdaudio = GST_CDAUDIO (element);
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
if ((res = cd_init_device (cdaudio->device)) < 0)
|
||||
goto init_failed;
|
||||
|
||||
cdaudio->cd_desc = res;
|
||||
|
||||
/* close tray */
|
||||
if ((res = cd_close (cdaudio->cd_desc)) < 0)
|
||||
goto close_failed;
|
||||
|
||||
if ((res = cd_stat (cdaudio->cd_desc, &cdaudio->info)) < 0) {
|
||||
/* we just give a warning here */
|
||||
GST_ELEMENT_WARNING (cdaudio, LIBRARY, INIT,
|
||||
("Could not retrieve CD track info."), (NULL));
|
||||
} else {
|
||||
debug_track_info (cdaudio);
|
||||
cdaudio->discid = cddb_discid (cdaudio->cd_desc);
|
||||
/* FIXME, post message with discid */
|
||||
}
|
||||
cdaudio->was_playing = FALSE;
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
{
|
||||
if (cdaudio->was_playing)
|
||||
res = cd_resume (cdaudio->cd_desc);
|
||||
else
|
||||
res = cd_play (cdaudio->cd_desc, 1);
|
||||
|
||||
if (res < 0)
|
||||
goto play_failed;
|
||||
|
||||
cdaudio->was_playing = TRUE;
|
||||
g_timer_start (cdaudio->timer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
if ((res = cd_pause (cdaudio->cd_desc)) < 0)
|
||||
goto pause_failed;
|
||||
g_timer_stop (cdaudio->timer);
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
if ((res = cd_stop (cdaudio->cd_desc)) < 0)
|
||||
goto stop_failed;
|
||||
if ((res = cd_finish (cdaudio->cd_desc)) < 0)
|
||||
goto finish_failed;
|
||||
cdaudio->cd_desc = -1;
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
init_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (cdaudio, LIBRARY, INIT,
|
||||
("Could not init CD device %s. (%d)", cdaudio->device, res), (NULL));
|
||||
cdaudio->cd_desc = -1;
|
||||
return GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
close_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (cdaudio, LIBRARY, INIT,
|
||||
("Could not close CD tray for device %s. (%d)", cdaudio->device, res),
|
||||
(NULL));
|
||||
return GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
play_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (cdaudio, LIBRARY, INIT,
|
||||
("Could not play CD device %s. (%d)", cdaudio->device, res), (NULL));
|
||||
return GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
pause_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (cdaudio, LIBRARY, INIT,
|
||||
("Could not pause CD device %s. (%d)", cdaudio->device, res), (NULL));
|
||||
return GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
stop_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (cdaudio, LIBRARY, INIT,
|
||||
("Could not stop CD device %s. (%d)", cdaudio->device, res), (NULL));
|
||||
return GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
finish_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (cdaudio, LIBRARY, INIT,
|
||||
("Could not finish CD device %s. (%d)", cdaudio->device, res), (NULL));
|
||||
return GST_STATE_CHANGE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_cdaudio_send_event (GstElement * element, GstEvent * event)
|
||||
{
|
||||
GstCDAudio *cdaudio;
|
||||
gboolean res = TRUE;
|
||||
|
||||
cdaudio = GST_CDAUDIO (element);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEEK:
|
||||
{
|
||||
gdouble rate;
|
||||
GstFormat format;
|
||||
GstSeekFlags flags;
|
||||
GstSeekType start_type, stop_type;
|
||||
gint64 start, stop;
|
||||
gint ret;
|
||||
|
||||
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
|
||||
&stop_type, &stop);
|
||||
|
||||
/* FIXME, implement more formats */
|
||||
if (format != GST_FORMAT_TIME)
|
||||
goto wrong_format;
|
||||
|
||||
if (rate != 1.0)
|
||||
goto wrong_rate;
|
||||
|
||||
if (start_type != GST_SEEK_TYPE_SET)
|
||||
goto unsupported;
|
||||
|
||||
ret = cd_play_pos (cdaudio->cd_desc, 1, start / GST_SECOND);
|
||||
if (ret < 0)
|
||||
goto seek_failed;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
gst_event_unref (event);
|
||||
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
wrong_format:
|
||||
{
|
||||
GST_DEBUG_OBJECT (cdaudio, "only seek in TIME is supported");
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
wrong_rate:
|
||||
{
|
||||
GST_DEBUG_OBJECT (cdaudio, "only seek with 1.0 rate is supported");
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
unsupported:
|
||||
{
|
||||
GST_DEBUG_OBJECT (cdaudio, "only seek SET is supported");
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
seek_failed:
|
||||
{
|
||||
GST_DEBUG_OBJECT (cdaudio, "seek failed");
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_cdaudio_query (GstElement * element, GstQuery * query)
|
||||
{
|
||||
GstCDAudio *cdaudio;
|
||||
gboolean res = TRUE;
|
||||
gulong micros;
|
||||
gdouble seconds;
|
||||
|
||||
cdaudio = GST_CDAUDIO (element);
|
||||
|
||||
GST_LOG_OBJECT (element, "handling %s query",
|
||||
gst_query_type_get_name (GST_QUERY_TYPE (query)));
|
||||
|
||||
/* take new snapshot every 1000 miliseconds */
|
||||
seconds = g_timer_elapsed (cdaudio->timer, µs);
|
||||
if (micros > 1000 || seconds > 1) {
|
||||
cd_stat (cdaudio->cd_desc, &cdaudio->info);
|
||||
g_timer_start (cdaudio->timer);
|
||||
}
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GstFormat dest_format;
|
||||
gint64 dest_val;
|
||||
|
||||
gst_query_parse_duration (query, &dest_format, NULL);
|
||||
|
||||
switch (dest_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
dest_val = (cdaudio->info.disc_length.minutes * 60 +
|
||||
cdaudio->info.disc_length.seconds) * GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (dest_format == track_format) {
|
||||
dest_val = cdaudio->info.disc_total_tracks;
|
||||
} else {
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res)
|
||||
gst_query_set_duration (query, dest_format, dest_val);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_POSITION:
|
||||
{
|
||||
GstFormat dest_format;
|
||||
gint64 dest_val;
|
||||
|
||||
gst_query_parse_position (query, &dest_format, NULL);
|
||||
|
||||
switch (dest_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
dest_val = (cdaudio->info.disc_time.minutes * 60 +
|
||||
cdaudio->info.disc_time.seconds) * GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (dest_format == track_format) {
|
||||
dest_val = cdaudio->info.disc_current_track;
|
||||
} else {
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res)
|
||||
gst_query_set_position (query, dest_format, dest_val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "cdaudio", GST_RANK_NONE,
|
||||
GST_TYPE_CDAUDIO))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*** GSTURIHANDLER INTERFACE *************************************************/
|
||||
|
||||
static GstURIType
|
||||
cdaudio_uri_get_type (GType type)
|
||||
{
|
||||
return GST_URI_SRC;
|
||||
}
|
||||
|
||||
static const gchar *const *
|
||||
cdaudio_uri_get_protocols (GType type)
|
||||
{
|
||||
static const gchar *protocols[] = { "cd", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
cdaudio_uri_get_uri (GstURIHandler * handler)
|
||||
{
|
||||
GstCDAudio *cdaudio = GST_CDAUDIO (handler);
|
||||
|
||||
return cdaudio->uri;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cdaudio_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
||||
GError ** error)
|
||||
{
|
||||
gchar *protocol, *location;
|
||||
gboolean ret;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
//GstCDAudio *cdaudio = GST_CDAUDIO(handler);
|
||||
|
||||
protocol = gst_uri_get_protocol (uri);
|
||||
if (strcmp (protocol, "cd") != 0)
|
||||
goto wrong_protocol;
|
||||
|
||||
g_free (protocol);
|
||||
|
||||
location = gst_uri_get_location (uri);
|
||||
/*
|
||||
cdaudio->uri_track = strtol(location,NULL,10);
|
||||
if (cdaudio->uri_track > 0) {
|
||||
cdaudio->seek_request = cdaudio->uri_track;
|
||||
}
|
||||
*/
|
||||
g_free (location);
|
||||
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
wrong_protocol:
|
||||
{
|
||||
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
|
||||
"Unsupported cdaudio protocol");
|
||||
g_free (protocol);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cdaudio_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
||||
{
|
||||
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
||||
|
||||
iface->get_type = cdaudio_uri_get_type;
|
||||
iface->get_protocols = cdaudio_uri_get_protocols;
|
||||
iface->get_uri = cdaudio_uri_get_uri;
|
||||
iface->set_uri = cdaudio_uri_set_uri;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
cdaudio,
|
||||
"Play CD audio through the CD Drive",
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
|
@ -14,7 +14,7 @@ TESTS_ENVIRONMENT = \
|
|||
GST_PLUGIN_SYSTEM_PATH_1_0= \
|
||||
GST_PLUGIN_PATH_1_0=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(GST_PLUGINS_LIBAV_DIR):$(GST_PLUGINS_UGLY_DIR):$(GST_PLUGINS_GOOD_DIR):$(GST_PLUGINS_BASE_DIR):$(GST_PLUGINS_DIR) \
|
||||
GST_PLUGIN_LOADING_WHITELIST="gstreamer@$(GST_PLUGINS_DIR):gst-plugins-base@$(GSTPB_PLUGINS_DIR):gst-plugins-good:gst-plugins-ugly:gst-libav:gst-plugins-bad@$(top_builddir)" \
|
||||
GST_STATE_IGNORE_ELEMENTS="apexsink avdtpsrc camerabin cdaudio dc1394src \
|
||||
GST_STATE_IGNORE_ELEMENTS="apexsink avdtpsrc camerabin dc1394src \
|
||||
dccpclientsrc dccpclientsink dccpserversrc dccpserversink decklinksrc \
|
||||
decklinksink dvbsrc dvbbasebin dfbvideosink festival fluidsynth gsettingsvideosrc \
|
||||
gsettingsvideosink gsettingsaudiosrc gsettingsaudiosink linsyssdisrc linsyssdisink nassink \
|
||||
|
|
|
@ -71,13 +71,13 @@
|
|||
#undef GST_MJPEGTOOLS_API
|
||||
|
||||
/* package name in plugins */
|
||||
#define GST_PACKAGE_NAME "GStreamer Bad Plug-ins source release"
|
||||
#define GST_PACKAGE_NAME "GStreamer Bad Plug-ins git"
|
||||
|
||||
/* package origin */
|
||||
#define GST_PACKAGE_ORIGIN "Unknown package origin"
|
||||
|
||||
/* GStreamer package release date/time for plugins as YYYY-MM-DD */
|
||||
#define GST_PACKAGE_RELEASE_DATETIME "2013-09-24"
|
||||
#define GST_PACKAGE_RELEASE_DATETIME "2013-10-31T21:09Z"
|
||||
|
||||
/* Define if static plugins should be built */
|
||||
#undef GST_PLUGIN_BUILD_STATIC
|
||||
|
@ -106,9 +106,6 @@
|
|||
/* Define to enable bz2 library (used by bz2). */
|
||||
#undef HAVE_BZ2
|
||||
|
||||
/* Define to enable cdaudio (used by cdaudio). */
|
||||
#undef HAVE_CDAUDIO
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
|
||||
CoreFoundation framework. */
|
||||
#undef HAVE_CFLOCALECOPYCURRENT
|
||||
|
@ -370,6 +367,9 @@
|
|||
/* Define to enable openjpeg library (used by openjpeg). */
|
||||
#undef HAVE_OPENJPEG
|
||||
|
||||
/* Define if OpenJPEG 1 is used */
|
||||
#undef HAVE_OPENJPEG_1
|
||||
|
||||
/* Define to enable OpenSL ES (used by opensl). */
|
||||
#undef HAVE_OPENSLES
|
||||
|
||||
|
@ -583,7 +583,7 @@
|
|||
#define PACKAGE_NAME "GStreamer Bad Plug-ins"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "GStreamer Bad Plug-ins 1.2.0"
|
||||
#define PACKAGE_STRING "GStreamer Bad Plug-ins 1.3.0.1"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "gst-plugins-bad"
|
||||
|
@ -592,7 +592,7 @@
|
|||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.2.0"
|
||||
#define PACKAGE_VERSION "1.3.0.1"
|
||||
|
||||
/* directory where plugins are located */
|
||||
#ifdef _DEBUG
|
||||
|
@ -635,7 +635,7 @@
|
|||
#undef USE_EGL_X11
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.2.0"
|
||||
#define VERSION "1.3.0.1"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
|
|
Loading…
Reference in a new issue