2004-02-20 00:52:07 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
|
|
*
|
|
|
|
* 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 "gstxine.h"
|
|
|
|
|
|
|
|
GST_BOILERPLATE (GstXine, gst_xine, GstElement, GST_TYPE_ELEMENT)
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn gst_xine_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2004-02-20 00:52:07 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static xine_ao_driver_t *_xine_create_audio_driver (GstXine * xine);
|
|
|
|
static xine_vo_driver_t *_xine_create_video_driver (GstXine * xine);
|
2004-02-20 00:52:07 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
static void gst_xine_base_init (gpointer klass)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xine_class_init (GstXineClass * klass)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element = GST_ELEMENT_CLASS (klass);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-02-20 00:52:07 +00:00
|
|
|
klass->xine = xine_new ();
|
|
|
|
xine_init (klass->xine);
|
|
|
|
|
|
|
|
klass->create_audio_driver = _xine_create_audio_driver;
|
|
|
|
klass->create_video_driver = _xine_create_video_driver;
|
|
|
|
|
|
|
|
element->change_state = gst_xine_change_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-08-28 17:59:20 +00:00
|
|
|
gst_xine_init (GstXine * filter, GstXineClass * g_class)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_xine_change_state (GstElement * element, GstStateChange transition)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
GstXine *xine = GST_XINE (element);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2004-02-20 00:52:07 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2004-02-20 00:52:07 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2004-02-20 00:52:07 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2004-02-20 00:52:07 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2004-02-20 00:52:07 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2004-02-20 00:52:07 +00:00
|
|
|
if (xine->stream != NULL)
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_xine_free_stream (xine);
|
2004-02-20 00:52:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_ERROR_OBJECT (element, "invalid state change");
|
|
|
|
break;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
|
2005-09-05 17:20:29 +00:00
|
|
|
(element), GST_STATE_CHANGE_SUCCESS);
|
2004-02-20 00:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static xine_ao_driver_t *
|
2004-03-14 22:34:33 +00:00
|
|
|
_xine_create_audio_driver (GstXine * xine)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
return xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine, "none", NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static xine_vo_driver_t *
|
2004-03-14 22:34:33 +00:00
|
|
|
_xine_create_video_driver (GstXine * xine)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
return xine_open_video_driver (GST_XINE_GET_CLASS (xine)->xine, "none",
|
|
|
|
XINE_VISUAL_TYPE_NONE, NULL);
|
2004-02-20 00:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xine_stream_t *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xine_get_stream (GstXine * xine)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
if (!xine->stream) {
|
|
|
|
GstXineClass *klass = GST_XINE_GET_CLASS (xine);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-02-20 00:52:07 +00:00
|
|
|
g_assert (xine->video_driver == NULL);
|
|
|
|
g_assert (xine->audio_driver == NULL);
|
|
|
|
xine->audio_driver = klass->create_audio_driver (xine);
|
|
|
|
xine->video_driver = klass->create_video_driver (xine);
|
2004-03-14 22:34:33 +00:00
|
|
|
xine->stream =
|
2004-03-15 19:32:27 +00:00
|
|
|
xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver);
|
2004-02-20 00:52:07 +00:00
|
|
|
|
|
|
|
/* FIXME: fail gracefully */
|
|
|
|
g_assert (xine->stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
return xine->stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xine_free_stream (GstXine * xine)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (xine->stream != NULL);
|
|
|
|
g_assert (xine->video_driver != NULL);
|
|
|
|
g_assert (xine->audio_driver != NULL);
|
|
|
|
|
|
|
|
xine_dispose (xine->stream);
|
|
|
|
xine->stream = NULL;
|
|
|
|
xine_close_video_driver (GST_XINE_GET_CLASS (xine)->xine, xine->video_driver);
|
|
|
|
xine->video_driver = NULL;
|
|
|
|
xine_close_audio_driver (GST_XINE_GET_CLASS (xine)->xine, xine->audio_driver);
|
|
|
|
xine->audio_driver = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
_free_xine_buf_element (buf_element_t * buffer)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
gst_buffer_unref (GST_BUFFER (buffer->source));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_buffer_to_xine_buffer (buf_element_t * ret, GstBuffer * buffer)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (ret != NULL);
|
|
|
|
g_return_if_fail (buffer != NULL);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-02-20 00:52:07 +00:00
|
|
|
/* FIXME: what's the difference? */
|
|
|
|
ret->mem = GST_BUFFER_DATA (buffer);
|
|
|
|
ret->content = GST_BUFFER_DATA (buffer);
|
|
|
|
ret->size = GST_BUFFER_SIZE (buffer);
|
|
|
|
ret->max_size = GST_BUFFER_MAXSIZE (buffer);
|
|
|
|
/* FIXME: add more */
|
|
|
|
ret->free_buffer = _free_xine_buf_element;
|
|
|
|
ret->source = buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2004-02-20 00:52:07 +00:00
|
|
|
{
|
2004-02-22 20:52:15 +00:00
|
|
|
if (!gst_xine_input_init_plugin (plugin) ||
|
ext/xine/xineinput.c: call parent dispose.
Original commit message from CVS:
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 22:21:30 +00:00
|
|
|
!gst_xine_audio_dec_init_plugin (plugin) ||
|
|
|
|
!gst_xine_audio_sink_init_plugin (plugin))
|
2004-02-22 20:52:15 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2004-02-20 00:52:07 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"xine",
|
|
|
|
"wrapper for libxine (version " XINE_VERSION ") plugins",
|
2006-04-01 10:09:11 +00:00
|
|
|
plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|