summaryrefslogtreecommitdiffstats
path: root/ext/xine
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch)
treef863b467dea9559a6ec9c48affbfae11f8104164 /ext/xine
parenta19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff)
downloadgst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'ext/xine')
-rw-r--r--ext/xine/gstxine.h43
-rw-r--r--ext/xine/xine.c65
-rw-r--r--ext/xine/xineaudiodec.c335
-rw-r--r--ext/xine/xineaudiosink.c175
-rw-r--r--ext/xine/xinecaps.c24
-rw-r--r--ext/xine/xineinput.c205
6 files changed, 438 insertions, 409 deletions
diff --git a/ext/xine/gstxine.h b/ext/xine/gstxine.h
index 61ab50ef..53d40a23 100644
--- a/ext/xine/gstxine.h
+++ b/ext/xine/gstxine.h
@@ -25,7 +25,6 @@
#include <xine/buffer.h>
G_BEGIN_DECLS
-
#define GST_TYPE_XINE \
(gst_xine_get_type())
#define GST_XINE(obj) \
@@ -38,47 +37,45 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_XINE))
#define GST_IS_XINE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_XINE))
-
-typedef struct _GstXine GstXine;
+typedef struct _GstXine GstXine;
typedef struct _GstXineClass GstXineClass;
struct _GstXine
{
- GstElement element;
+ GstElement element;
- xine_stream_t * stream;
- xine_ao_driver_t * audio_driver;
- xine_vo_driver_t * video_driver;
+ xine_stream_t *stream;
+ xine_ao_driver_t *audio_driver;
+ xine_vo_driver_t *video_driver;
};
-struct _GstXineClass
+struct _GstXineClass
{
- GstElementClass parent_class;
+ GstElementClass parent_class;
- xine_t * xine;
+ xine_t *xine;
- xine_ao_driver_t * (* create_audio_driver) (GstXine * xine);
- xine_vo_driver_t * (* create_video_driver) (GstXine * xine);
+ xine_ao_driver_t *(*create_audio_driver) (GstXine * xine);
+ xine_vo_driver_t *(*create_video_driver) (GstXine * xine);
};
-GType gst_xine_get_type (void);
+GType gst_xine_get_type (void);
-xine_stream_t * gst_xine_get_stream (GstXine *xine);
-void gst_xine_free_stream (GstXine *xine);
+xine_stream_t *gst_xine_get_stream (GstXine * xine);
+void gst_xine_free_stream (GstXine * xine);
-void gst_buffer_to_xine_buffer (buf_element_t *element, GstBuffer *buffer);
+void gst_buffer_to_xine_buffer (buf_element_t * element, GstBuffer * buffer);
/* conversion functions from xinecaps.c */
-const gchar * gst_xine_get_caps_for_format (guint32 format);
-guint32 gst_xine_get_format_for_caps (const GstCaps *caps);
+const gchar *gst_xine_get_caps_for_format (guint32 format);
+guint32 gst_xine_get_format_for_caps (const GstCaps * caps);
/* init functions for the plugins */
-gboolean gst_xine_audio_sink_init_plugin (GstPlugin *plugin);
-gboolean gst_xine_audio_dec_init_plugin (GstPlugin *plugin);
-gboolean gst_xine_input_init_plugin (GstPlugin *plugin);
-
-G_END_DECLS
+gboolean gst_xine_audio_sink_init_plugin (GstPlugin * plugin);
+gboolean gst_xine_audio_dec_init_plugin (GstPlugin * plugin);
+gboolean gst_xine_input_init_plugin (GstPlugin * plugin);
+G_END_DECLS
#endif /* __GST_XINE_H__ */
diff --git a/ext/xine/xine.c b/ext/xine/xine.c
index e7736bf4..f1dbb399 100644
--- a/ext/xine/xine.c
+++ b/ext/xine/xine.c
@@ -25,22 +25,21 @@
GST_BOILERPLATE (GstXine, gst_xine, GstElement, GST_TYPE_ELEMENT)
-static GstElementStateReturn gst_xine_change_state (GstElement * element);
-
-static xine_ao_driver_t * _xine_create_audio_driver (GstXine * xine);
-static xine_vo_driver_t * _xine_create_video_driver (GstXine * xine);
+ static GstElementStateReturn gst_xine_change_state (GstElement * element);
+ static xine_ao_driver_t *_xine_create_audio_driver (GstXine * xine);
+ static xine_vo_driver_t *_xine_create_video_driver (GstXine * xine);
-static void
-gst_xine_base_init (gpointer klass)
+
+ static void gst_xine_base_init (gpointer klass)
{
}
static void
-gst_xine_class_init (GstXineClass *klass)
+gst_xine_class_init (GstXineClass * klass)
{
GstElementClass *element = GST_ELEMENT_CLASS (klass);
-
+
klass->xine = xine_new ();
xine_init (klass->xine);
@@ -51,15 +50,15 @@ gst_xine_class_init (GstXineClass *klass)
}
static void
-gst_xine_init (GstXine *filter)
+gst_xine_init (GstXine * filter)
{
}
static GstElementStateReturn
-gst_xine_change_state (GstElement *element)
+gst_xine_change_state (GstElement * element)
{
GstXine *xine = GST_XINE (element);
-
+
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
break;
@@ -79,32 +78,36 @@ gst_xine_change_state (GstElement *element)
GST_ERROR_OBJECT (element, "invalid state change");
break;
}
-
- return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state, (element), GST_STATE_SUCCESS);
+
+ return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
+ (element), GST_STATE_SUCCESS);
}
static xine_ao_driver_t *
-_xine_create_audio_driver (GstXine *xine)
+_xine_create_audio_driver (GstXine * xine)
{
return xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine, "none", NULL);
}
static xine_vo_driver_t *
-_xine_create_video_driver (GstXine *xine)
+_xine_create_video_driver (GstXine * xine)
{
- return xine_open_video_driver (GST_XINE_GET_CLASS (xine)->xine, "none", XINE_VISUAL_TYPE_NONE, NULL);
+ return xine_open_video_driver (GST_XINE_GET_CLASS (xine)->xine, "none",
+ XINE_VISUAL_TYPE_NONE, NULL);
}
xine_stream_t *
-gst_xine_get_stream (GstXine *xine)
+gst_xine_get_stream (GstXine * xine)
{
if (!xine->stream) {
GstXineClass *klass = GST_XINE_GET_CLASS (xine);
+
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);
- xine->stream = xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver);
+ xine->stream =
+ xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver);
/* FIXME: fail gracefully */
g_assert (xine->stream);
@@ -114,7 +117,7 @@ gst_xine_get_stream (GstXine *xine)
}
void
-gst_xine_free_stream (GstXine *xine)
+gst_xine_free_stream (GstXine * xine)
{
g_return_if_fail (xine->stream != NULL);
g_assert (xine->video_driver != NULL);
@@ -129,17 +132,17 @@ gst_xine_free_stream (GstXine *xine)
}
static void
-_free_xine_buf_element (buf_element_t *buffer)
+_free_xine_buf_element (buf_element_t * buffer)
{
gst_buffer_unref (GST_BUFFER (buffer->source));
}
void
-gst_buffer_to_xine_buffer (buf_element_t *ret, GstBuffer *buffer)
+gst_buffer_to_xine_buffer (buf_element_t * ret, GstBuffer * buffer)
{
g_return_if_fail (ret != NULL);
g_return_if_fail (buffer != NULL);
-
+
/* FIXME: what's the difference? */
ret->mem = GST_BUFFER_DATA (buffer);
ret->content = GST_BUFFER_DATA (buffer);
@@ -151,7 +154,7 @@ gst_buffer_to_xine_buffer (buf_element_t *ret, GstBuffer *buffer)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_xine_input_init_plugin (plugin) ||
!gst_xine_audio_dec_init_plugin (plugin) ||
@@ -161,14 +164,8 @@ plugin_init (GstPlugin *plugin)
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "xine",
- "wrapper for libxine (version "XINE_VERSION") plugins",
- plugin_init,
- VERSION,
- "GPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "xine",
+ "wrapper for libxine (version " XINE_VERSION ") plugins",
+ plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/ext/xine/xineaudiodec.c b/ext/xine/xineaudiodec.c
index 93f3984a..869c3b4d 100644
--- a/ext/xine/xineaudiodec.c
+++ b/ext/xine/xineaudiodec.c
@@ -37,46 +37,47 @@
GType gst_xine_audio_dec_get_type (void);
-typedef struct _GstXineAudioDec GstXineAudioDec;
+typedef struct _GstXineAudioDec GstXineAudioDec;
typedef struct _GstXineAudioDecClass GstXineAudioDecClass;
struct _GstXineAudioDec
{
- GstXine parent;
+ GstXine parent;
- GstPad * sinkpad;
- GstPad * srcpad;
+ GstPad *sinkpad;
+ GstPad *srcpad;
- audio_decoder_t * decoder;
- guint32 format;
- xine_waveformatex wave;
- gboolean setup;
+ audio_decoder_t *decoder;
+ guint32 format;
+ xine_waveformatex wave;
+ gboolean setup;
};
-struct _GstXineAudioDecClass
+struct _GstXineAudioDecClass
{
- GstXineClass parent_class;
+ GstXineClass parent_class;
- plugin_node_t * plugin_node;
+ plugin_node_t *plugin_node;
};
/*** xine audio driver wrapper ************************************************/
-
-typedef struct {
- xine_ao_driver_t driver;
- GstXineAudioDec * xine;
- gboolean open;
+
+typedef struct
+{
+ xine_ao_driver_t driver;
+ GstXineAudioDec *xine;
+ gboolean open;
} GstXineAudioDriver;
static guint32
-_driver_get_capabilities (xine_ao_driver_t *driver)
+_driver_get_capabilities (xine_ao_driver_t * driver)
{
/* FIXME: add more when gst handles more than 2 channels */
return AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_8BITS;
}
static gint
-_driver_get_property (xine_ao_driver_t *driver, int property)
+_driver_get_property (xine_ao_driver_t * driver, int property)
{
return 0;
}
@@ -88,80 +89,82 @@ _driver_set_property (xine_ao_driver_t * driver, int property, int value)
}
static gint
-_driver_open (xine_ao_driver_t *driver, xine_stream_t *stream, guint32 bits, guint32 rate, int mode)
+_driver_open (xine_ao_driver_t * driver, xine_stream_t * stream, guint32 bits,
+ guint32 rate, int mode)
{
GstCaps *caps;
GstXineAudioDriver *xine = ((GstXineAudioDriver *) driver);
-
+
caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, (gint) bits,
- "depth", G_TYPE_INT, (gint) bits,
- "signed", G_TYPE_BOOLEAN, (bits == 8) ? FALSE : TRUE,
- "channels", G_TYPE_INT, (mode | AO_CAP_MODE_STEREO) ? 2 : 1,
- "rate", G_TYPE_INT, rate,
- NULL);
-
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "width", G_TYPE_INT, (gint) bits,
+ "depth", G_TYPE_INT, (gint) bits,
+ "signed", G_TYPE_BOOLEAN, (bits == 8) ? FALSE : TRUE,
+ "channels", G_TYPE_INT, (mode | AO_CAP_MODE_STEREO) ? 2 : 1,
+ "rate", G_TYPE_INT, rate, NULL);
+
if (!gst_pad_set_explicit_caps (xine->xine->srcpad, caps)) {
gst_caps_free (caps);
driver->open = FALSE;
return -1;
}
-
+
xine->open = TRUE;
gst_caps_free (caps);
return rate;
}
static void
-_driver_close (xine_ao_driver_t *driver, xine_stream_t *stream)
+_driver_close (xine_ao_driver_t * driver, xine_stream_t * stream)
{
/* FIXME: unset explicit caps here? And how? */
driver->open = FALSE;
}
static void
-_driver_exit (xine_ao_driver_t *driver)
+_driver_exit (xine_ao_driver_t * driver)
{
g_free (driver);
}
static int
-_driver_control (xine_ao_driver_t *driver, int cmd, ...)
+_driver_control (xine_ao_driver_t * driver, int cmd, ...)
{
return 0;
}
static void
-_driver_flush (xine_ao_driver_t *driver)
+_driver_flush (xine_ao_driver_t * driver)
{
}
static int
-_driver_status (xine_ao_driver_t *driver, xine_stream_t *stream, uint32_t *bits, uint32_t *rate, int *mode)
+_driver_status (xine_ao_driver_t * driver, xine_stream_t * stream,
+ uint32_t * bits, uint32_t * rate, int *mode)
{
const GstCaps *caps;
GstStructure *structure;
gint temp;
GstXineAudioDriver *xine = (GstXineAudioDriver *) driver;
-
- if (xine->open == FALSE || !(caps = gst_pad_get_negotiated_caps (xine->xine->srcpad)))
+
+ if (xine->open == FALSE
+ || !(caps = gst_pad_get_negotiated_caps (xine->xine->srcpad)))
return 0;
structure = gst_caps_get_structure (caps, 0);
- *bits = 0; /* FIXME */
+ *bits = 0; /* FIXME */
if (!gst_structure_get_int (structure, "rate", &temp)) {
- g_assert_not_reached (); /* may never happen with negotiated caps */
+ g_assert_not_reached (); /* may never happen with negotiated caps */
return 0;
}
*rate = temp;
if (!gst_structure_get_int (structure, "channels", &temp)) {
- g_assert_not_reached (); /* may never happen with negotiated caps */
+ g_assert_not_reached (); /* may never happen with negotiated caps */
return 0;
}
*mode = (temp == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO;
if (!gst_structure_get_int (structure, "width", &temp)) {
- g_assert_not_reached (); /* may never happen with negotiated caps */
+ g_assert_not_reached (); /* may never happen with negotiated caps */
return 0;
}
if (temp == 8)
@@ -172,25 +175,26 @@ _driver_status (xine_ao_driver_t *driver, xine_stream_t *stream, uint32_t *bits,
#define _DRIVER_BUFFER_SIZE 4096
static audio_buffer_t *
-_driver_get_buffer (xine_ao_driver_t *driver)
+_driver_get_buffer (xine_ao_driver_t * driver)
{
GstXineAudioDriver *xine = (GstXineAudioDriver *) driver;
- audio_buffer_t *audio = g_new0 (audio_buffer_t, 1);
+ audio_buffer_t *audio = g_new0 (audio_buffer_t, 1);
audio->mem = g_malloc (_DRIVER_BUFFER_SIZE);
audio->mem_size = _DRIVER_BUFFER_SIZE;
audio->stream = gst_xine_get_stream (GST_XINE (xine->xine));
/* FIXME: fill more fields */
-
+
return audio;
}
-static void
-_driver_put_buffer (xine_ao_driver_t *driver, audio_buffer_t *audio, xine_stream_t *stream)
+static void
+_driver_put_buffer (xine_ao_driver_t * driver, audio_buffer_t * audio,
+ xine_stream_t * stream)
{
GstXineAudioDriver *xine = (GstXineAudioDriver *) driver;
GstBuffer *buffer;
-
+
buffer = gst_buffer_new ();
GST_BUFFER_DATA (buffer) = (guint8 *) audio->mem;
GST_BUFFER_SIZE (buffer) = audio->mem_size;
@@ -199,27 +203,27 @@ _driver_put_buffer (xine_ao_driver_t *driver, audio_buffer_t *audio, xine_stream
g_free (audio);
gst_pad_push (xine->xine->srcpad, GST_DATA (buffer));
}
-
+
static xine_ao_driver_t *
-_gst_xine_audio_dec_create_audio_driver (GstXine *xine)
+_gst_xine_audio_dec_create_audio_driver (GstXine * xine)
{
GstXineAudioDriver *driver = g_new (GstXineAudioDriver, 1);
driver->xine = GST_XINE_AUDIO_DEC (xine);
driver->open = FALSE;
-
- driver->driver.get_buffer = _driver_get_buffer;
- driver->driver.put_buffer = _driver_put_buffer;
- driver->driver.get_capabilities = _driver_get_capabilities;
- driver->driver.get_property = _driver_get_property;
- driver->driver.set_property = _driver_set_property;
- driver->driver.open = _driver_open;
- driver->driver.close = _driver_close;
- driver->driver.exit = _driver_exit;
- driver->driver.control = _driver_control;
- driver->driver.flush = _driver_flush;
- driver->driver.status = _driver_status;
-
+
+ driver->driver.get_buffer = _driver_get_buffer;
+ driver->driver.put_buffer = _driver_put_buffer;
+ driver->driver.get_capabilities = _driver_get_capabilities;
+ driver->driver.get_property = _driver_get_property;
+ driver->driver.set_property = _driver_set_property;
+ driver->driver.open = _driver_open;
+ driver->driver.close = _driver_close;
+ driver->driver.exit = _driver_exit;
+ driver->driver.control = _driver_control;
+ driver->driver.flush = _driver_flush;
+ driver->driver.status = _driver_status;
+
return (xine_ao_driver_t *) driver;
}
@@ -227,20 +231,22 @@ _gst_xine_audio_dec_create_audio_driver (GstXine *xine)
GST_BOILERPLATE (GstXineAudioDec, gst_xine_audio_dec, GstXine, GST_TYPE_XINE)
-static void gst_xine_audio_dec_chain (GstPad *pad, GstData *in);
-static GstElementStateReturn
- gst_xine_audio_dec_change_state (GstElement *element);
+ static void gst_xine_audio_dec_chain (GstPad * pad, GstData * in);
+ static GstElementStateReturn
+ gst_xine_audio_dec_change_state (GstElement * element);
/* this function handles the link with other plug-ins */
-static GstPadLinkReturn
-gst_xine_audio_dec_sink_link (GstPad *pad, const GstCaps *caps)
+ static GstPadLinkReturn
+ gst_xine_audio_dec_sink_link (GstPad * pad, const GstCaps * caps)
{
guint temp;
GstStructure *structure;
- GstXineAudioDec *xine = GST_XINE_AUDIO_DEC (gst_object_get_parent (GST_OBJECT (pad)));
+ GstXineAudioDec *xine =
+ GST_XINE_AUDIO_DEC (gst_object_get_parent (GST_OBJECT (pad)));
xine->format = gst_xine_get_format_for_caps (caps);
- if (xine->format == 0) return GST_PAD_LINK_REFUSED;
+ if (xine->format == 0)
+ return GST_PAD_LINK_REFUSED;
/* get setup data */
xine->setup = FALSE;
@@ -249,7 +255,7 @@ gst_xine_audio_dec_sink_link (GstPad *pad, const GstCaps *caps)
xine->wave.nChannels = temp;
if (gst_structure_get_int (structure, "rate", &temp))
xine->wave.nSamplesPerSec = temp;
- xine->wave.wBitsPerSample = 16; /* FIXME: how do we figure this thing out? */
+ xine->wave.wBitsPerSample = 16; /* FIXME: how do we figure this thing out? */
/* FIXME: fill wave header better */
return GST_PAD_LINK_OK;
@@ -261,7 +267,7 @@ gst_xine_audio_dec_base_init (gpointer g_class)
}
static void
-gst_xine_audio_dec_class_init (GstXineAudioDecClass *klass)
+gst_xine_audio_dec_class_init (GstXineAudioDecClass * klass)
{
GstXineClass *xine = GST_XINE_CLASS (klass);
GstElementClass *element = GST_ELEMENT_CLASS (klass);
@@ -272,22 +278,23 @@ gst_xine_audio_dec_class_init (GstXineAudioDecClass *klass)
}
static void
-gst_xine_audio_dec_init (GstXineAudioDec *xine)
+gst_xine_audio_dec_init (GstXineAudioDec * xine)
{
xine->setup = FALSE;
}
static void
-gst_xine_audio_dec_event (GstXineAudioDec *xine, GstEvent *event)
+gst_xine_audio_dec_event (GstXineAudioDec * xine, GstEvent * event)
{
gst_pad_event_default (xine->sinkpad, event);
}
static void
-gst_xine_audio_dec_chain (GstPad *pad, GstData *in)
+gst_xine_audio_dec_chain (GstPad * pad, GstData * in)
{
buf_element_t buffer = { 0, };
- GstXineAudioDec *xine = GST_XINE_AUDIO_DEC (gst_object_get_parent (GST_OBJECT (pad)));
+ GstXineAudioDec *xine =
+ GST_XINE_AUDIO_DEC (gst_object_get_parent (GST_OBJECT (pad)));
if (GST_IS_EVENT (in)) {
gst_xine_audio_dec_event (xine, GST_EVENT (in));
@@ -296,7 +303,8 @@ gst_xine_audio_dec_chain (GstPad *pad, GstData *in)
if (xine->format == 0) {
/* no caps yet */
- GST_ELEMENT_ERROR (xine, CORE, NEGOTIATION, (NULL), ("buffer sent before doing caps nego"));
+ GST_ELEMENT_ERROR (xine, CORE, NEGOTIATION, (NULL),
+ ("buffer sent before doing caps nego"));
gst_data_unref (in);
return;
}
@@ -306,6 +314,7 @@ gst_xine_audio_dec_chain (GstPad *pad, GstData *in)
guint8 stsd[150] = { 0, };
guint temp;
GstStructure *structure;
+
/* sent setup header */
element.type = xine->format;
element.decoder_flags = BUF_FLAG_HEADER;
@@ -313,45 +322,46 @@ gst_xine_audio_dec_chain (GstPad *pad, GstData *in)
element.decoder_info[1] = xine->wave.nSamplesPerSec;
element.decoder_info[2] = xine->wave.wBitsPerSample;
element.decoder_info[3] = xine->wave.nChannels;
- element.content = (guchar *) &xine->wave;
+ element.content = (guchar *) & xine->wave;
element.size = sizeof (xine_waveformatex);
xine->decoder->decode_data (xine->decoder, &element);
/* send stsd emulation to the decoder */
/* FIXME: qdm2 only right now */
g_assert (gst_pad_get_negotiated_caps (xine->sinkpad));
- structure = gst_caps_get_structure (gst_pad_get_negotiated_caps (xine->sinkpad), 0);
- *((guint32 *) &stsd[56]) = GUINT32_TO_BE (12);
+ structure =
+ gst_caps_get_structure (gst_pad_get_negotiated_caps (xine->sinkpad), 0);
+ *((guint32 *) & stsd[56]) = GUINT32_TO_BE (12);
memcpy (&stsd[60], "frmaQDM2", 8);
- *((guint32 *) &stsd[68]) = GUINT32_TO_BE (36);
+ *((guint32 *) & stsd[68]) = GUINT32_TO_BE (36);
memcpy (&stsd[72], "QDCA", 4);
- *((guint32 *) &stsd[76]) = GUINT32_TO_BE (1);
+ *((guint32 *) & stsd[76]) = GUINT32_TO_BE (1);
if (!gst_structure_get_int (structure, "channels", &temp))
temp = 0;
- *((guint32 *) &stsd[80]) = GUINT32_TO_BE (temp);
+ *((guint32 *) & stsd[80]) = GUINT32_TO_BE (temp);
if (!gst_structure_get_int (structure, "rate", &temp))
temp = 0;
- *((guint32 *) &stsd[84]) = GUINT32_TO_BE (temp);
+ *((guint32 *) & stsd[84]) = GUINT32_TO_BE (temp);
if (!gst_structure_get_int (structure, "bitrate", &temp))
temp = 0;
- *((guint32 *) &stsd[88]) = GUINT32_TO_BE (temp);
+ *((guint32 *) & stsd[88]) = GUINT32_TO_BE (temp);
if (!gst_structure_get_int (structure, "blocksize", &temp))
temp = 0;
- *((guint32 *) &stsd[92]) = GUINT32_TO_BE (temp);
- *((guint32 *) &stsd[96]) = GUINT32_TO_BE (256);
+ *((guint32 *) & stsd[92]) = GUINT32_TO_BE (temp);
+ *((guint32 *) & stsd[96]) = GUINT32_TO_BE (256);
if (!gst_structure_get_int (structure, "framesize", &temp))
temp = 0;
- *((guint32 *) &stsd[100]) = GUINT32_TO_BE (temp);
- *((guint32 *) &stsd[104]) = GUINT32_TO_BE (28);
+ *((guint32 *) & stsd[100]) = GUINT32_TO_BE (temp);
+ *((guint32 *) & stsd[104]) = GUINT32_TO_BE (28);
memcpy (&stsd[108], "QDCP", 4);
- *((guint32 *) &stsd[112]) = GUINT32_TO_BE (1065353216);
- *((guint32 *) &stsd[116]) = GUINT32_TO_BE (0);
- *((guint32 *) &stsd[120]) = GUINT32_TO_BE (1065353216);
- *((guint32 *) &stsd[124]) = GUINT32_TO_BE (1065353216);
- *((guint32 *) &stsd[128]) = GUINT32_TO_BE (27);
- *((guint32 *) &stsd[132]) = GUINT32_TO_BE (8);
- *((guint32 *) &stsd[136]) = GUINT32_TO_BE (0);
- *((guint32 *) &stsd[140]) = GUINT32_TO_BE (24);
- gst_util_dump_mem (stsd, 144);
+ *((guint32 *) & stsd[112]) = GUINT32_TO_BE (1065353216);
+ *((guint32 *) & stsd[116]) = GUINT32_TO_BE (0);
+ *((guint32 *) & stsd[120]) = GUINT32_TO_BE (1065353216);
+ *((guint32 *) & stsd[124]) = GUINT32_TO_BE (1065353216);
+ *((guint32 *) & stsd[128]) = GUINT32_TO_BE (27);
+ *((guint32 *) & stsd[132]) = GUINT32_TO_BE (8);
+ *((guint32 *) & stsd[136]) = GUINT32_TO_BE (0);
+ *((guint32 *) & stsd[140]) = GUINT32_TO_BE (24);
+ gst_util_dump_mem (stsd, 144);
element.decoder_flags = BUF_FLAG_SPECIAL;
element.decoder_info[1] = BUF_SPECIAL_STSD_ATOM;
element.decoder_info[2] = 144;
@@ -360,10 +370,10 @@ gst_xine_audio_dec_chain (GstPad *pad, GstData *in)
element.size = 0;
element.content = 0;
xine->decoder->decode_data (xine->decoder, &element);
-
+
xine->setup = TRUE;
}
-
+
gst_buffer_to_xine_buffer (&buffer, GST_BUFFER (in));
buffer.type = xine->format;
xine->decoder->decode_data (xine->decoder, &buffer);
@@ -371,13 +381,13 @@ gst_xine_audio_dec_chain (GstPad *pad, GstData *in)
}
static audio_decoder_t *
-_load_decoder (GstXineAudioDec* dec)
+_load_decoder (GstXineAudioDec * dec)
{
xine_stream_t *stream = gst_xine_get_stream (GST_XINE (dec));
plugin_catalog_t *catalog = stream->xine->plugin_catalog;
plugin_node_t *node = GST_XINE_AUDIO_DEC_GET_CLASS (dec)->plugin_node;
audio_decoder_t *ret;
-
+
/* FIXME: this is really hacky, but how to force xine to load a plugin? */
/* how it works: xine can load a plugin for a particular stream type.
* We just take one type, which should not have plugins attached to it,
@@ -391,10 +401,10 @@ _load_decoder (GstXineAudioDec* dec)
}
static GstElementStateReturn
-gst_xine_audio_dec_change_state (GstElement *element)
+gst_xine_audio_dec_change_state (GstElement * element)
{
GstXineAudioDec *xine = GST_XINE_AUDIO_DEC (element);
-
+
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
xine->decoder = _load_decoder (xine);
@@ -411,68 +421,69 @@ gst_xine_audio_dec_change_state (GstElement *element)
break;
case GST_STATE_READY_TO_NULL:
xine->setup = FALSE;
- _x_free_audio_decoder (gst_xine_get_stream (GST_XINE (xine)), xine->decoder);
+ _x_free_audio_decoder (gst_xine_get_stream (GST_XINE (xine)),
+ xine->decoder);
break;
default:
GST_ERROR_OBJECT (element, "invalid state change");
break;
}
-
- return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state, (element), GST_STATE_SUCCESS);
+
+ return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
+ (element), GST_STATE_SUCCESS);
}
/** GstXineAudioDec subclasses ************************************************/
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- "audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ]"
- )
-);
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
+ );
static void
gst_xine_audio_dec_subclass_init (gpointer g_class, gpointer class_data)
{
GstXineAudioDecClass *xine_class = GST_XINE_AUDIO_DEC_CLASS (g_class);
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstElementDetails details = GST_ELEMENT_DETAILS (
- NULL,
- "Filter/Decoder/Audio",
- NULL,
- "Benjamin Otte <otte@gnome.org>"
- );
+ GstElementDetails details = GST_ELEMENT_DETAILS (NULL,
+ "Filter/Decoder/Audio",
+ NULL,
+ "Benjamin Otte <otte@gnome.org>");
GstPadTemplate *template;
guint i = 0;
GstCaps *caps = gst_caps_new_empty ();
decoder_info_t *dec;
-
+
xine_class->plugin_node = class_data;
dec = xine_class->plugin_node->info->special_info;
- details.longname = g_strdup_printf ("%s xine audio decoder", xine_class->plugin_node->info->id);
- details.description = g_strdup_printf ("decodes audio using the xine '%s' plugin", xine_class->plugin_node->info->id);
+ details.longname =
+ g_strdup_printf ("%s xine audio decoder",
+ xine_class->plugin_node->info->id);
+ details.description =
+ g_strdup_printf ("decodes audio using the xine '%s' plugin",
+ xine_class->plugin_node->info->id);
gst_element_class_set_details (element_class, &details);
g_free (details.longname);
g_free (details.description);
-
- gst_element_class_add_pad_template (element_class,
+
+ gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template));
-
+
while (dec->supported_types[i] != 0) {
- const gchar *type_str = gst_xine_get_caps_for_format (dec->supported_types[i]);
+ const gchar *type_str =
+ gst_xine_get_caps_for_format (dec->supported_types[i]);
if (type_str) {
gst_caps_append (caps, gst_caps_from_string (type_str));
}
@@ -483,28 +494,29 @@ gst_xine_audio_dec_subclass_init (gpointer g_class, gpointer class_data)
}
static void
-gst_xine_audio_dec_sub_init (GTypeInstance *instance, gpointer g_class)
+gst_xine_audio_dec_sub_init (GTypeInstance * instance, gpointer g_class)
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (instance);
GstXineAudioDec *xine = GST_XINE_AUDIO_DEC (instance);
- xine->sinkpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "sink"), "sink");
+ xine->sinkpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
+ "sink"), "sink");
gst_pad_set_link_function (xine->sinkpad, gst_xine_audio_dec_sink_link);
gst_pad_set_chain_function (xine->sinkpad, gst_xine_audio_dec_chain);
gst_element_add_pad (GST_ELEMENT (xine), xine->sinkpad);
- xine->srcpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "src"), "src");
+ xine->srcpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
+ "src"), "src");
gst_pad_use_explicit_caps (xine->srcpad);
gst_element_add_pad (GST_ELEMENT (xine), xine->srcpad);
}
gboolean
-gst_xine_audio_dec_init_plugin (GstPlugin *plugin)
+gst_xine_audio_dec_init_plugin (GstPlugin * plugin)
{
- GTypeInfo plugin_info =
- {
+ GTypeInfo plugin_info = {
sizeof (GstXineAudioDecClass),
NULL,
NULL,
@@ -517,9 +529,9 @@ gst_xine_audio_dec_init_plugin (GstPlugin *plugin)
};
xine_node_t *list;
GstXineClass *klass;
-
+
klass = g_type_class_ref (GST_TYPE_XINE);
-
+
list = klass->xine->plugin_catalog->audio->first;
while (list) {
plugin_node_t *node = list->content;
@@ -527,20 +539,28 @@ gst_xine_audio_dec_init_plugin (GstPlugin *plugin)
guint format = 0;
list = list->next;
- if (!node) continue;
-
+ if (!node)
+ continue;
+
dec = node->info->special_info;
while (dec->supported_types[format] != 0) {
- const gchar *caps = gst_xine_get_caps_for_format (dec->supported_types[format]);
+ const gchar *caps =
+ gst_xine_get_caps_for_format (dec->supported_types[format]);
if (caps) {
- gchar *plugin_name = g_strdup_printf ("xineaudiodec_%s", node->info->id);
- gchar *type_name = g_strdup_printf ("GstXineAudioDec%s", node->info->id);
+ gchar *plugin_name =
+ g_strdup_printf ("xineaudiodec_%s", node->info->id);
+ gchar *type_name =
+ g_strdup_printf ("GstXineAudioDec%s", node->info->id);
GType type;
+
plugin_info.class_data = node;
- type = g_type_register_static (GST_TYPE_XINE_AUDIO_DEC, type_name, &plugin_info, 0);
+ type =
+ g_type_register_static (GST_TYPE_XINE_AUDIO_DEC, type_name,
+ &plugin_info, 0);
g_free (type_name);
- if (!gst_element_register (plugin, plugin_name,
- MAX (GST_RANK_MARGINAL, GST_RANK_MARGINAL * dec->priority / 10 + 1), type)) {
+ if (!gst_element_register (plugin, plugin_name,
+ MAX (GST_RANK_MARGINAL,
+ GST_RANK_MARGINAL * dec->priority / 10 + 1), type)) {
g_free (plugin_name);
return FALSE;
}
@@ -550,7 +570,6 @@ gst_xine_audio_dec_init_plugin (GstPlugin *plugin)
}
}
- g_type_class_unref (klass);
+ g_type_class_unref (klass);
return TRUE;
}
-
diff --git a/ext/xine/xineaudiosink.c b/ext/xine/xineaudiosink.c
index bdb947ca..4638526d 100644
--- a/ext/xine/xineaudiosink.c
+++ b/ext/xine/xineaudiosink.c
@@ -38,40 +38,39 @@
GType gst_xine_audio_sink_get_type (void);
-typedef struct _GstXineAudioSink GstXineAudioSink;
+typedef struct _GstXineAudioSink GstXineAudioSink;
typedef struct _GstXineAudioSinkClass GstXineAudioSinkClass;
struct _GstXineAudioSink
{
- GstXine parent;
+ GstXine parent;
- GstPad * sinkpad;
+ GstPad *sinkpad;
- ao_driver_t * driver;
- guint open; /* number of bytes per sample or 0 if driver not open */
+ ao_driver_t *driver;
+ guint open; /* number of bytes per sample or 0 if driver not open */
};
-struct _GstXineAudioSinkClass
+struct _GstXineAudioSinkClass
{
- GstXineClass parent_class;
+ GstXineClass parent_class;
- plugin_node_t * plugin_node;
+ plugin_node_t *plugin_node;
};
/** GstXineAudioSink ***********************************************************/
GST_BOILERPLATE (GstXineAudioSink, gst_xine_audio_sink, GstXine, GST_TYPE_XINE)
-static GstElementStateReturn
- gst_xine_audio_sink_change_state (GstElement *element);
+ static GstElementStateReturn
+ gst_xine_audio_sink_change_state (GstElement * element);
-static void
-gst_xine_audio_sink_base_init (gpointer g_class)
+ static void gst_xine_audio_sink_base_init (gpointer g_class)
{
}
static void
-gst_xine_audio_sink_class_init (GstXineAudioSinkClass *klass)
+gst_xine_audio_sink_class_init (GstXineAudioSinkClass * klass)
{
GstElementClass *element = GST_ELEMENT_CLASS (klass);
@@ -79,35 +78,43 @@ gst_xine_audio_sink_class_init (GstXineAudioSinkClass *klass)
}
static void
-gst_xine_audio_sink_init (GstXineAudioSink *xine)
+gst_xine_audio_sink_init (GstXineAudioSink * xine)
{
}
static void
-gst_xine_audio_sink_chain (GstPad *pad, GstData *data)
+gst_xine_audio_sink_chain (GstPad * pad, GstData * data)
{
- GstXineAudioSink *xine = GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
+ GstXineAudioSink *xine =
+ GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
- while (xine->driver->write (xine->driver, (guint16 *) GST_BUFFER_DATA (data), GST_BUFFER_SIZE (data) / xine->open) == 0);
+ while (xine->driver->write (xine->driver, (guint16 *) GST_BUFFER_DATA (data),
+ GST_BUFFER_SIZE (data) / xine->open) == 0);
gst_data_unref (GST_DATA (data));
}
static GstElementStateReturn
-gst_xine_audio_sink_change_state (GstElement *element)
+gst_xine_audio_sink_change_state (GstElement * element)
{
GstXineAudioSink *xine = GST_XINE_AUDIO_SINK (element);
- audio_driver_class_t *driver = (audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->plugin_class;
+ audio_driver_class_t *driver =
+ (audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)->
+ plugin_node->plugin_class;
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (driver == NULL) {
- xine_audio_port_t *port = xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine,
+ xine_audio_port_t *port =
+ xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine,
GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->info->id, NULL);
+
if (!port)
return GST_STATE_FAILURE;
port->exit (port);
- driver = (audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->plugin_class;
- if (driver == NULL)
+ driver =
+ (audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)->
+ plugin_node->plugin_class;
+ if (driver == NULL)
return GST_STATE_FAILURE;
}
xine->driver = driver->open_plugin (driver, NULL);
@@ -133,23 +140,25 @@ gst_xine_audio_sink_change_state (GstElement *element)
GST_ERROR_OBJECT (element, "invalid state change");
break;
}
-
- return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state, (element), GST_STATE_SUCCESS);
+
+ return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
+ (element), GST_STATE_SUCCESS);
}
static GstCaps *
-_xine_audio_sink_get_caps (GstPad *pad)
+_xine_audio_sink_get_caps (GstPad * pad)
{
- GstXineAudioSink *xine = GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
+ GstXineAudioSink *xine =
+ GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
GstCaps *caps, *ret = gst_caps_new_empty ();
guint32 capa, channels;
-
+
if (!xine->driver)
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
capa = xine->driver->get_capabilities (xine->driver);
channels = capa & (AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO);
-
+
if (channels == 0) {
/* neither mono nor stereo supported, die */
return ret;
@@ -162,16 +171,14 @@ _xine_audio_sink_get_caps (GstPad *pad)
caps = gst_caps_from_string ("audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 8000, 192000 ]");
+ "depth = (int) 8, " "rate = (int) [ 8000, 192000 ]");
capa &= ~AO_CAP_8BITS;
} else {
caps = gst_caps_from_string ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 8000, 192000 ]");
+ "depth = (int) 16, " "rate = (int) [ 8000, 192000 ]");
capa = -1;
}
switch (channels) {
@@ -190,18 +197,19 @@ _xine_audio_sink_get_caps (GstPad *pad)
}
gst_caps_append (ret, caps);
} while (capa != -1);
-
+
return ret;
}
static GstPadLinkReturn
-_xine_audio_sink_link (GstPad *pad, const GstCaps *caps)
+_xine_audio_sink_link (GstPad * pad, const GstCaps * caps)
{
GstStructure *structure = gst_caps_get_structure (caps, 0);
- GstXineAudioSink *xine = GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
+ GstXineAudioSink *xine =
+ GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
guint channels, temp, rate, width;
int mode;
-
+
if (!gst_structure_get_int (structure, "channels", &channels))
return GST_PAD_LINK_REFUSED;
mode = (channels == 1) ? AO_CAP_MODE_MONO : AO_CAP_MODE_STEREO;
@@ -209,77 +217,76 @@ _xine_audio_sink_link (GstPad *pad, const GstCaps *caps)
return GST_PAD_LINK_REFUSED;
if (!gst_structure_get_int (structure, "width", &width))
return GST_PAD_LINK_REFUSED;
-
+
if (xine->open != 0)
xine->driver->close (xine->driver);
xine->open = 0;
temp = xine->driver->open (xine->driver, width, rate, mode);
if (temp == 0)
return GST_PAD_LINK_REFUSED;
-
+
xine->open = channels * width / 8;
if (temp != rate) {
/* FIXME? */
- GST_WARNING_OBJECT (xine, "rates don't match (requested: %u, got %u)", rate, temp);
+ GST_WARNING_OBJECT (xine, "rates don't match (requested: %u, got %u)", rate,
+ temp);
}
-
+
return GST_PAD_LINK_OK;
}
/** GstXineAudioSink subclasses ************************************************/
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- "audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 8000, 192000 ], "
- "channels = (int) [1, 2]; "
- "audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 8000, 192000 ], "
- "channels = (int) [1, 2]"
- )
-);
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = (int) [ 8000, 192000 ], "
+ "channels = (int) [1, 2]; "
+ "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 192000 ], " "channels = (int) [1, 2]")
+ );
static void
gst_xine_audio_sink_subclass_init (gpointer g_class, gpointer class_data)
{
GstXineAudioSinkClass *xine_class = GST_XINE_AUDIO_SINK_CLASS (g_class);
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstElementDetails details = GST_ELEMENT_DETAILS (
- NULL,
- "Source",
- NULL,
- "Benjamin Otte <otte@gnome.org>"
- );
-
+ GstElementDetails details = GST_ELEMENT_DETAILS (NULL,
+ "Source",
+ NULL,
+ "Benjamin Otte <otte@gnome.org>");
+
xine_class->plugin_node = class_data;
- details.longname = g_strdup_printf ("%s xine audio sink", xine_class->plugin_node->info->id);
- details.description = g_strdup_printf ("%s audio output using Xine", xine_class->plugin_node->info->id);
+ details.longname =
+ g_strdup_printf ("%s xine audio sink", xine_class->plugin_node->info->id);
+ details.description =
+ g_strdup_printf ("%s audio output using Xine",
+ xine_class->plugin_node->info->id);
gst_element_class_set_details (element_class, &details);
g_free (details.longname);
g_free (details.description);
-
- gst_element_class_add_pad_template (element_class,
+
+ gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template));
}
static void
-gst_xine_audio_sink_sub_init (GTypeInstance *instance, gpointer g_class)
+gst_xine_audio_sink_sub_init (GTypeInstance * instance, gpointer g_class)
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (instance);
GstXineAudioSink *xine = GST_XINE_AUDIO_SINK (instance);
- xine->sinkpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "sink"), "sink");
+ xine->sinkpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
+ "sink"), "sink");
gst_pad_set_chain_function (xine->sinkpad, gst_xine_audio_sink_chain);
gst_pad_set_getcaps_function (xine->sinkpad, _xine_audio_sink_get_caps);
gst_pad_set_link_function (xine->sinkpad, _xine_audio_sink_link);
@@ -287,10 +294,9 @@ gst_xine_audio_sink_sub_init (GTypeInstance *instance, gpointer g_class)
}
gboolean
-gst_xine_audio_sink_init_plugin (GstPlugin *plugin)
+gst_xine_audio_sink_init_plugin (GstPlugin * plugin)
{
- GTypeInfo plugin_info =
- {
+ GTypeInfo plugin_info = {
sizeof (GstXineAudioSinkClass),
NULL,
NULL,
@@ -303,19 +309,21 @@ gst_xine_audio_sink_init_plugin (GstPlugin *plugin)
};
plugin_node_t *node;
GstXineClass *klass;
-
+
klass = g_type_class_ref (GST_TYPE_XINE);
-
+
node = xine_list_first_content (klass->xine->plugin_catalog->aout);
while (node) {
gchar *plugin_name = g_strdup_printf ("xineaudiosink_%s", node->info->id);
gchar *type_name = g_strdup_printf ("GstXineAudioSink%s", node->info->id);
GType type;
+
plugin_info.class_data = node;
- type = g_type_register_static (GST_TYPE_XINE_AUDIO_SINK, type_name, &plugin_info, 0);
+ type =
+ g_type_register_static (GST_TYPE_XINE_AUDIO_SINK, type_name,
+ &plugin_info, 0);
g_free (type_name);
- if (!gst_element_register (plugin, plugin_name,
- GST_RANK_MARGINAL, type)) {
+ if (!gst_element_register (plugin, plugin_name, GST_RANK_MARGINAL, type)) {
g_free (plugin_name);
return FALSE;
}
@@ -324,7 +332,6 @@ gst_xine_audio_sink_init_plugin (GstPlugin *plugin)
node = xine_list_next_content (klass->xine->plugin_catalog->aout);
}
- g_type_class_unref (klass);
+ g_type_class_unref (klass);
return TRUE;
}
-
diff --git a/ext/xine/xinecaps.c b/ext/xine/xinecaps.c
index d243f72f..1df3ab97 100644
--- a/ext/xine/xinecaps.c
+++ b/ext/xine/xinecaps.c
@@ -20,13 +20,14 @@
#include "gstxine.h"
#include <xine/buffer.h>
-typedef struct {
- guint32 xine;
- gchar * caps;
+typedef struct
+{
+ guint32 xine;
+ gchar *caps;
} GstXineCapsMap;
static GstXineCapsMap _gst_xine_caps_map[] = {
- { BUF_AUDIO_QDESIGN2, "audio/x-qdm2" },
+ {BUF_AUDIO_QDESIGN2, "audio/x-qdm2"},
/* FIXME:
#define BUF_AUDIO_A52 0x03000000
#define BUF_AUDIO_MPEG 0x03010000
@@ -79,29 +80,29 @@ static GstXineCapsMap _gst_xine_caps_map[] = {
#define BUF_AUDIO_RAWPCM 0x03300000
#define BUF_AUDIO_4X_ADPCM 0x03310000
*/
- { 0, NULL }
+ {0, NULL}
};
const gchar *
gst_xine_get_caps_for_format (guint32 format)
{
guint i = 0;
-
+
while (_gst_xine_caps_map[i].xine != 0) {
if (_gst_xine_caps_map[i].xine == format)
return _gst_xine_caps_map[i].caps;
i++;
}
-
+
return NULL;
}
guint32
-gst_xine_get_format_for_caps (const GstCaps *caps)
+gst_xine_get_format_for_caps (const GstCaps * caps)
{
guint i = 0;
GstCaps *compare, *intersect;
-
+
while (_gst_xine_caps_map[i].xine != 0) {
compare = gst_caps_from_string (_gst_xine_caps_map[i].caps);
intersect = gst_caps_intersect (caps, compare);
@@ -113,7 +114,6 @@ gst_xine_get_format_for_caps (const GstCaps *caps)
gst_caps_free (intersect);
i++;
}
-
- return 0;
-}
+ return 0;
+}
diff --git a/ext/xine/xineinput.c b/ext/xine/xineinput.c
index a44f8c16..19a4bbbe 100644
--- a/ext/xine/xineinput.c
+++ b/ext/xine/xineinput.c
@@ -38,51 +38,51 @@
GType gst_xine_input_get_type (void);
-typedef struct _GstXineInput GstXineInput;
+typedef struct _GstXineInput GstXineInput;
typedef struct _GstXineInputClass GstXineInputClass;
struct _GstXineInput
{
- GstXine parent;
+ GstXine parent;
- GstPad * srcpad;
+ GstPad *srcpad;
- input_plugin_t * input;
- gchar * location;
- guint blocksize;
+ input_plugin_t *input;
+ gchar *location;
+ guint blocksize;
};
-struct _GstXineInputClass
+struct _GstXineInputClass
{
- GstXineClass parent_class;
+ GstXineClass parent_class;
- plugin_node_t * plugin_node;
+ plugin_node_t *plugin_node;
};
/** GstXineInput ***********************************************************/
-enum {
+enum
+{
ARG_0,
ARG_LOCATION
};
GST_BOILERPLATE (GstXineInput, gst_xine_input, GstXine, GST_TYPE_XINE)
-static void gst_xine_input_dispose (GObject *object);
-static void gst_xine_input_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_xine_input_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
-static GstElementStateReturn
- gst_xine_input_change_state (GstElement *element);
+ static void gst_xine_input_dispose (GObject * object);
+ static void gst_xine_input_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+ static void gst_xine_input_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+ static GstElementStateReturn
+ gst_xine_input_change_state (GstElement * element);
-static void
-gst_xine_input_base_init (gpointer g_class)
+ static void gst_xine_input_base_init (gpointer g_class)
{
}
static void
-gst_xine_input_class_init (GstXineInputClass *klass)
+gst_xine_input_class_init (GstXineInputClass * klass)
{
GstElementClass *element = GST_ELEMENT_CLASS (klass);
GObjectClass *object = G_OBJECT_CLASS (klass);
@@ -92,19 +92,19 @@ gst_xine_input_class_init (GstXineInputClass *klass)
object->set_property = gst_xine_input_set_property;
object->get_property = gst_xine_input_get_property;
object->dispose = gst_xine_input_dispose;
-
- g_object_class_install_property (object, ARG_LOCATION,
- g_param_spec_string ("location", "location", "location",
- NULL, G_PARAM_READWRITE));
+
+ g_object_class_install_property (object, ARG_LOCATION,
+ g_param_spec_string ("location", "location", "location",
+ NULL, G_PARAM_READWRITE));
}
static void
-gst_xine_input_init (GstXineInput *xine)
+gst_xine_input_init (GstXineInput * xine)
{
}
static void
-gst_xine_input_dispose (GObject *object)
+gst_xine_input_dispose (GObject * object)
{
GstXineInput *xine = GST_XINE_INPUT (object);
@@ -115,7 +115,8 @@ gst_xine_input_dispose (GObject *object)
}
static void
-gst_xine_input_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_xine_input_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstXineInput *xine = GST_XINE_INPUT (object);
@@ -127,14 +128,15 @@ gst_xine_input_set_property (GObject *object, guint prop_id, const GValue *value
g_free (xine->location);
xine->location = g_strdup (g_value_get_string (value));
break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ return;
}
}
static void
-gst_xine_input_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_xine_input_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstXineInput *xine = GST_XINE_INPUT (object);
@@ -142,43 +144,52 @@ gst_xine_input_get_property (GObject *object, guint prop_id, GValue *value, GPar
case ARG_LOCATION:
g_value_set_string (value, xine->location);
break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ return;
}
}
-#define BUFFER_SIZE 4096 /* FIXME: what size? */
+#define BUFFER_SIZE 4096 /* FIXME: what size? */
static GstData *
-gst_xine_input_get (GstPad *pad)
+gst_xine_input_get (GstPad * pad)
{
- GstXineInput *xine = GST_XINE_INPUT (gst_object_get_parent (GST_OBJECT (pad)));
+ GstXineInput *xine =
+ GST_XINE_INPUT (gst_object_get_parent (GST_OBJECT (pad)));
GstBuffer *buf;
gint real_size, position;
-
+
/* FIXME: how does xine figure out EOS? */
position = xine->input->get_current_pos (xine->input);
if (position > 0 && position == xine->input->get_length (xine->input)) {
gst_element_set_eos (GST_ELEMENT (xine));
return GST_DATA (gst_event_new (GST_EVENT_EOS));
}
-
- buf = gst_pad_alloc_buffer (xine->srcpad, GST_BUFFER_OFFSET_NONE, xine->blocksize);
+
+ buf =
+ gst_pad_alloc_buffer (xine->srcpad, GST_BUFFER_OFFSET_NONE,
+ xine->blocksize);
GST_BUFFER_OFFSET (buf) = position;
- real_size = xine->input->read (xine->input, GST_BUFFER_DATA (buf), GST_BUFFER_MAXSIZE (buf));
+ real_size =
+ xine->input->read (xine->input, GST_BUFFER_DATA (buf),
+ GST_BUFFER_MAXSIZE (buf));
GST_BUFFER_SIZE (buf) = real_size;
if (real_size < 0) {
- GST_ELEMENT_ERROR (xine, RESOURCE, READ, (NULL), ("error %d reading data", real_size));
+ GST_ELEMENT_ERROR (xine, RESOURCE, READ, (NULL), ("error %d reading data",
+ real_size));
gst_data_unref (GST_DATA (buf));
return NULL;
} else if (real_size == 0) {
buf_element_t *element;
+
if (xine->input->get_capabilities (xine->input) & INPUT_CAP_BLOCK)
- element = xine->input->read_block (xine->input, gst_xine_get_stream (GST_XINE (xine))->audio_fifo, xine->blocksize);
+ element =
+ xine->input->read_block (xine->input,
+ gst_xine_get_stream (GST_XINE (xine))->audio_fifo, xine->blocksize);
if (element == NULL) {
/* FIXME: is this EOS? */
gst_element_set_eos (GST_ELEMENT (xine));
- return GST_DATA (gst_event_new (GST_EVENT_EOS));
+ return GST_DATA (gst_event_new (GST_EVENT_EOS));
} else {
GST_BUFFER_SIZE (buf) = element->size;
/* FIXME: put buf_element_t data in buffer */
@@ -187,19 +198,23 @@ gst_xine_input_get (GstPad *pad)
}
}
GST_BUFFER_OFFSET_END (buf) = xine->input->get_current_pos (xine->input);
-
+
return GST_DATA (buf);
}
static GstElementStateReturn
-gst_xine_input_change_state (GstElement *element)
+gst_xine_input_change_state (GstElement * element)
{
GstXineInput *xine = GST_XINE_INPUT (element);
- input_class_t *input = (input_class_t *) GST_XINE_INPUT_GET_CLASS (xine)->plugin_node->plugin_class;
-
+ input_class_t *input =
+ (input_class_t *) GST_XINE_INPUT_GET_CLASS (xine)->plugin_node->
+ plugin_class;
+
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
- xine->input = input->get_instance (input, gst_xine_get_stream (GST_XINE (xine)), xine->location);
+ xine->input =
+ input->get_instance (input, gst_xine_get_stream (GST_XINE (xine)),
+ xine->location);
if (!xine->input)
return GST_STATE_FAILURE;
if (xine->input->open (xine->input) == 0)
@@ -225,82 +240,75 @@ gst_xine_input_change_state (GstElement *element)
GST_ERROR_OBJECT (element, "invalid state change");
break;
}
-
- return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state, (element), GST_STATE_SUCCESS);
+
+ return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
+ (element), GST_STATE_SUCCESS);
}
/** GstXineInput subclasses ************************************************/
-static GstStaticPadTemplate any_template = GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY
-);
-
-static GstStaticPadTemplate cdda_template = GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- "audio/x-raw-int, "
- "endianness = (int) LITTLE_ENDIAN, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) 44100, "
- "channels = (int) 2"
- )
-);
+static GstStaticPadTemplate any_template = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate cdda_template = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, " "rate = (int) 44100, " "channels = (int) 2")
+ );
static void
gst_xine_input_subclass_init (gpointer g_class, gpointer class_data)
{
GstXineInputClass *xine_class = GST_XINE_INPUT_CLASS (g_class);
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstElementDetails details = GST_ELEMENT_DETAILS (
- NULL,
- "Source",
- NULL,
- "Benjamin Otte <otte@gnome.org>"
- );
+ GstElementDetails details = GST_ELEMENT_DETAILS (NULL,
+ "Source",
+ NULL,
+ "Benjamin Otte <otte@gnome.org>");
input_class_t *input;
-
+
xine_class->plugin_node = class_data;
input = (input_class_t *) xine_class->plugin_node->plugin_class;
- details.longname = g_strdup_printf ("%s xine input", input->get_identifier (input));
+ details.longname =
+ g_strdup_printf ("%s xine input", input->get_identifier (input));
details.description = g_strdup_printf ("%s", input->get_description (input));
gst_element_class_set_details (element_class, &details);
g_free (details.longname);
g_free (details.description);
-
+
/* FIXME: this is pretty hackish, anyone knows a better idea (xine doesn't) */
if (strcmp (input->get_identifier (input), "cdda") == 0) {
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&cdda_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&cdda_template));
} else {
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&any_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&any_template));
}
}
static void
-gst_xine_input_sub_init (GTypeInstance *instance, gpointer g_class)
+gst_xine_input_sub_init (GTypeInstance * instance, gpointer g_class)
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (instance);
GstXineInput *xine = GST_XINE_INPUT (instance);
- xine->srcpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "src"), "src");
+ xine->srcpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
+ "src"), "src");
gst_pad_set_get_function (xine->srcpad, gst_xine_input_get);
gst_element_add_pad (GST_ELEMENT (xine), xine->srcpad);
}
gboolean
-gst_xine_input_init_plugin (GstPlugin *plugin)
+gst_xine_input_init_plugin (GstPlugin * plugin)
{
- GTypeInfo plugin_info =
- {
+ GTypeInfo plugin_info = {
sizeof (GstXineInputClass),
NULL,
NULL,
@@ -313,19 +321,21 @@ gst_xine_input_init_plugin (GstPlugin *plugin)
};
plugin_node_t *node;
GstXineClass *klass;
-
+
klass = g_type_class_ref (GST_TYPE_XINE);
-
+
node = xine_list_first_content (klass->xine->plugin_catalog->input);
while (node) {
gchar *plugin_name = g_strdup_printf ("xinesrc_%s", node->info->id);
gchar *type_name = g_strdup_printf ("GstXineInput%s", node->info->id);
GType type;
+
plugin_info.class_data = node;
- type = g_type_register_static (GST_TYPE_XINE_INPUT, type_name, &plugin_info, 0);
+ type =
+ g_type_register_static (GST_TYPE_XINE_INPUT, type_name, &plugin_info,
+ 0);
g_free (type_name);
- if (!gst_element_register (plugin, plugin_name,
- GST_RANK_MARGINAL, type)) {
+ if (!gst_element_register (plugin, plugin_name, GST_RANK_MARGINAL, type)) {
g_free (plugin_name);
return FALSE;
}
@@ -334,7 +344,6 @@ gst_xine_input_init_plugin (GstPlugin *plugin)
node = xine_list_next_content (klass->xine->plugin_catalog->input);
}
- g_type_class_unref (klass);
+ g_type_class_unref (klass);
return TRUE;
}
-