[libdmapsharing] Move g-gst* to dmap-gst* and make DMAPGstInputStream public Signed-off-by: W. Michael Petullo <mike@
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Move g-gst* to dmap-gst* and make DMAPGstInputStream public Signed-off-by: W. Michael Petullo <mike@
- Date: Thu, 23 Dec 2010 17:39:10 +0000 (UTC)
commit c3adf7ce1bc91cf9c5c718c7ab5f59777f0e820d
Author: W. Michael Petullo <mike flyn org>
Date: Thu Dec 23 11:38:12 2010 -0600
Move g-gst* to dmap-gst* and make DMAPGstInputStream public
Signed-off-by: W. Michael Petullo <mike flyn org>
libdmapsharing/Makefile.am | 12 +-
libdmapsharing/daap-share.c | 30 ++---
...-gst-input-stream.c => dmap-gst-input-stream.c} | 127 ++++++++++---------
libdmapsharing/dmap-gst-input-stream.h | 81 +++++++++++++
...-input-stream.c => dmap-gst-mp3-input-stream.c} | 34 +++---
libdmapsharing/dmap-gst-mp3-input-stream.h | 67 ++++++++++
...-input-stream.c => dmap-gst-wav-input-stream.c} | 34 +++---
libdmapsharing/dmap-gst-wav-input-stream.h | 67 ++++++++++
libdmapsharing/dmap.h | 1 +
libdmapsharing/g-gst-input-stream.h | 81 -------------
libdmapsharing/g-gst-mp3-input-stream.h | 67 ----------
libdmapsharing/g-gst-wav-input-stream.h | 67 ----------
libdmapsharing/gst-util.c | 2 +-
13 files changed, 337 insertions(+), 333 deletions(-)
---
diff --git a/libdmapsharing/Makefile.am b/libdmapsharing/Makefile.am
index 09d4180..e57050f 100644
--- a/libdmapsharing/Makefile.am
+++ b/libdmapsharing/Makefile.am
@@ -41,9 +41,9 @@ endif
if USE_GSTREAMERAPP
libdmapsharing_3_0_la_SOURCES += \
- g-gst-input-stream.c \
- g-gst-mp3-input-stream.c \
- g-gst-wav-input-stream.c \
+ dmap-gst-input-stream.c \
+ dmap-gst-mp3-input-stream.c \
+ dmap-gst-wav-input-stream.c \
gst-util.c
endif
@@ -79,6 +79,7 @@ libdmapsharinginclude_HEADERS = \
dmap-container-db.h \
dmap-container-record.h \
dmap-db.h \
+ dmap-gst-input-stream.h \
dmap-md5.h \
dmap-mdns-browser.h \
dmap-mdns-publisher.h \
@@ -96,9 +97,8 @@ noinst_HEADERS = \
dmap-config.h \
dmap-mdns-avahi.h \
dmap-utils.h \
- g-gst-input-stream.h \
- g-gst-mp3-input-stream.h \
- g-gst-wav-input-stream.h \
+ dmap-gst-mp3-input-stream.h \
+ dmap-gst-wav-input-stream.h \
gst-util.h
dmap-marshal.c: dmap-marshal.list
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index 3077fcc..1da3837 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -41,8 +41,7 @@
#include <libdmapsharing/dmap-utils.h>
#ifdef HAVE_GSTREAMERAPP
-#include <libdmapsharing/g-gst-mp3-input-stream.h>
-#include <libdmapsharing/g-gst-wav-input-stream.h>
+#include <libdmapsharing/dmap-gst-input-stream.h>
#endif /* HAVE_GSTREAMERAPP */
static void daap_share_set_property (GObject *object,
@@ -96,9 +95,6 @@ enum {
G_DEFINE_TYPE (DAAPShare, daap_share, DMAP_TYPE_SHARE)
-/* FIXME: get rid of this global: */
-static gchar *transcode_format = NULL;
-
static void
daap_share_class_init (DAAPShareClass *klass)
{
@@ -199,8 +195,6 @@ daap_share_new (const char *name,
_dmap_share_server_start (DMAP_SHARE (share));
_dmap_share_publish_start (DMAP_SHARE (share));
- transcode_format = mime_to_format (transcode_mimetype);
-
return share;
}
@@ -422,19 +416,19 @@ send_chunked_file (SoupServer *server, SoupMessage *message, DAAPRecord *record,
}
g_object_get (record, "format", &format, NULL);
- if (transcode_format == NULL || ! strcmp (format, transcode_format)) {
+ if (transcode_mimetype == NULL || ! strcmp (format, mime_to_format (transcode_mimetype))) {
g_debug ("Not transcoding");
cd->stream = stream;
#ifdef HAVE_GSTREAMERAPP
- } else if (! strcmp ("mp3", transcode_format)) {
- cd->stream = G_INPUT_STREAM (g_gst_mp3_input_stream_new (stream));
- } else if (! strcmp ("wav", transcode_format)) {
- cd->stream = G_INPUT_STREAM (g_gst_wav_input_stream_new (stream));
-#endif /* HAVE_GSTREAMERAPP */
} else {
- g_warning ("Transcode format %s not supported", transcode_format);
+ cd->stream = dmap_gst_input_stream_new (transcode_mimetype, stream);
+ }
+#else
+ } else {
+ g_warning ("Transcode format %s not supported", transcode_mimetype);
cd->stream = stream;
}
+#endif /* HAVE_GSTREAMERAPP */
if (cd->stream == NULL) {
g_warning ("Could not set up input stream");
@@ -462,7 +456,7 @@ send_chunked_file (SoupServer *server, SoupMessage *message, DAAPRecord *record,
* video data after about 2.5MB. Perhaps this is so iTunes
* knows how much data to buffer.
*/
- || transcode_format == NULL) {
+ || transcode_mimetype == NULL) {
/* NOTE: iTunes 8 (and other versions?) will not seek
* properly without a Content-Length header.
*/
@@ -590,8 +584,10 @@ add_entry_to_mlcl (gpointer id,
dmap_structure_add (mlit, DMAP_CC_ASEQ, "");
if (_dmap_share_client_requested (mb->bits, SONG_FORMAT)) {
gchar *format = NULL;
- if (transcode_format)
- format = g_strdup (transcode_format);
+ gchar *transcode_mimetype = NULL;
+ g_object_get (record, "transcode-mimetype", &transcode_mimetype, NULL);
+ if (transcode_mimetype)
+ format = g_strdup (mime_to_format (transcode_mimetype));
else
g_object_get (record, "format", &format, NULL);
if (format) {
diff --git a/libdmapsharing/g-gst-input-stream.c b/libdmapsharing/dmap-gst-input-stream.c
similarity index 69%
rename from libdmapsharing/g-gst-input-stream.c
rename to libdmapsharing/dmap-gst-input-stream.c
index e45d894..84ae663 100644
--- a/libdmapsharing/g-gst-input-stream.c
+++ b/libdmapsharing/dmap-gst-input-stream.c
@@ -1,5 +1,5 @@
/*
- * GGstInputStream class: Open a URI using g_gst_input_stream_new ().
+ * DMAPGstInputStream class: Open a URI using dmap_gst_input_stream_new ().
* Data is decoded using GStreamer and is then made available by the class's
* read operations.
*
@@ -20,20 +20,20 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
#include <gst/app/gstappbuffer.h>
-#include "g-gst-input-stream.h"
+#include "dmap-gst-input-stream.h"
#include "gst-util.h"
-//#include "util.h"
#define GST_APP_MAX_BUFFERS 1024
#define DECODED_BUFFER_SIZE 1024 * 128
#define QUEUE_PUSH_WAIT_SECONDS 10
#define QUEUE_POP_WAIT_SECONDS 1
-struct g_gst_format {
+struct dmap_gst_format {
gchar *id; /* E.g., used as command line arguments. */
gchar *extension; /* E.g., iTunes uses URI extension to
* determine stream format.
@@ -41,14 +41,14 @@ struct g_gst_format {
};
/* NOTE: Roku clients require lower case extension. */
-static const struct g_gst_format g_gst_formats[] = {
+static const struct dmap_gst_format dmap_gst_formats[] = {
{ "raw", "raw" },
{ "wav16", "wav" },
{ "mp3", "mp3" },
{ NULL, NULL }
};
-struct GGstInputStreamPrivate {
+struct DMAPGstInputStreamPrivate {
GQueue *buffer;
gsize read_request; /* Size of data asked for */
gsize write_request; /* Number of bytes that must be read
@@ -60,7 +60,7 @@ struct GGstInputStreamPrivate {
};
static goffset
-g_gst_input_stream_tell (GSeekable *seekable)
+dmap_gst_input_stream_tell (GSeekable *seekable)
{
/* FIXME: implement return current position in stream. */
g_error ("Not implemented");
@@ -68,22 +68,22 @@ g_gst_input_stream_tell (GSeekable *seekable)
}
static gboolean
-g_gst_input_stream_can_seek (GSeekable *seekable)
+dmap_gst_input_stream_can_seek (GSeekable *seekable)
{
return TRUE;
}
static gboolean
-g_gst_input_stream_seek (GSeekable *seekable,
+dmap_gst_input_stream_seek (GSeekable *seekable,
goffset offset,
GSeekType type,
GCancellable *cacellable,
GError **error)
{
- GGstInputStream *stream;
+ DMAPGstInputStream *stream;
goffset absolute;
- stream = G_GST_INPUT_STREAM (seekable);
+ stream = DMAP_GST_INPUT_STREAM (seekable);
switch (type) {
/* FIXME: implement:
@@ -120,7 +120,7 @@ g_gst_input_stream_seek (GSeekable *seekable,
*/
/* FIXME:
- if (! gst_element_seek_simple (G_GST_INPUT_STREAM (seekable)->priv->pipeline,
+ if (! gst_element_seek_simple (DMAP_GST_INPUT_STREAM (seekable)->priv->pipeline,
GST_FORMAT_BYTES,
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
absolute)) {
@@ -136,34 +136,34 @@ g_gst_input_stream_seek (GSeekable *seekable,
}
static gboolean
-g_gst_input_stream_can_truncate (GSeekable *seekable)
+dmap_gst_input_stream_can_truncate (GSeekable *seekable)
{
return FALSE;
}
static gboolean
-g_gst_input_stream_truncate (GSeekable *seekable,
+dmap_gst_input_stream_truncate (GSeekable *seekable,
goffset offset,
GCancellable *cancellable,
GError **error)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "Cannot truncate GGstInputStream");
+ "Cannot truncate DMAPGstInputStream");
return FALSE;
}
static void
-g_gst_input_stream_seekable_iface_init (GSeekableIface *iface)
+dmap_gst_input_stream_seekable_iface_init (GSeekableIface *iface)
{
- iface->tell = g_gst_input_stream_tell;
- iface->can_seek = g_gst_input_stream_can_seek;
- iface->seek = g_gst_input_stream_seek;
- iface->can_truncate = g_gst_input_stream_can_truncate;
- iface->truncate_fn = g_gst_input_stream_truncate;
+ iface->tell = dmap_gst_input_stream_tell;
+ iface->can_seek = dmap_gst_input_stream_can_seek;
+ iface->seek = dmap_gst_input_stream_seek;
+ iface->can_truncate = dmap_gst_input_stream_can_truncate;
+ iface->truncate_fn = dmap_gst_input_stream_truncate;
}
void
-g_gst_input_stream_new_buffer_cb (GstElement *element, GGstInputStream *stream)
+dmap_gst_input_stream_new_buffer_cb (GstElement *element, DMAPGstInputStream *stream)
{
gsize i;
guint8 *ptr;
@@ -172,7 +172,7 @@ g_gst_input_stream_new_buffer_cb (GstElement *element, GGstInputStream *stream)
/* FIXME: Is this necessary? I am trying to protect against this
* thread manipulating data after the pipeline has been destroyed.
- * see also g_gst_input_stream_close ().
+ * see also dmap_gst_input_stream_close ().
*/
g_mutex_lock (stream->priv->buffer_mutex);
@@ -227,21 +227,28 @@ _return:
g_mutex_unlock (stream->priv->buffer_mutex);
}
-GInputStream* g_gst_input_stream_new (const gchar *uri)
+GInputStream* dmap_gst_input_stream_new (const gchar *transcode_mimetype, GInputStream *src_stream)
{
- GGstInputStream *stream;
-
- stream = G_GST_INPUT_STREAM (g_object_new (TYPE_G_GST_INPUT_STREAM,
- NULL));
+ GInputStream *stream;
+
+ if (! transcode_mimetype) {
+ stream = src_stream;
+ } else if (! strcmp (transcode_mimetype, "audio/mp3")) {
+ stream = G_INPUT_STREAM (dmap_gst_mp3_input_stream_new (src_stream));
+ } else if (! strcmp (transcode_mimetype, "audio/wav")) {
+ stream = G_INPUT_STREAM (dmap_gst_wav_input_stream_new (src_stream));
+ } else {
+ g_warning ("Transcode format %s not supported", transcode_mimetype);
+ stream = src_stream;
+ }
- g_assert (G_IS_SEEKABLE (stream));
- return G_INPUT_STREAM (stream);
+ return stream;
}
gchar *
dmapd_input_stream_strdup_format_extension (const gint format_code)
{
- return g_strdup (g_gst_formats[format_code].extension);
+ return g_strdup (dmap_gst_formats[format_code].extension);
}
static gssize
@@ -251,14 +258,14 @@ min (gssize a, gssize b)
}
static gssize
-g_gst_input_stream_read (GInputStream *stream,
+dmap_gst_input_stream_read (GInputStream *stream,
void *buffer,
gsize count,
GCancellable *cancellable,
GError **error)
{
int i;
- GGstInputStream *gst_stream = G_GST_INPUT_STREAM (stream);
+ DMAPGstInputStream *gst_stream = DMAP_GST_INPUT_STREAM (stream);
GTimeVal time;
g_get_current_time (&time);
@@ -303,7 +310,7 @@ g_gst_input_stream_read (GInputStream *stream,
}
static gssize
-g_gst_input_stream_skip (GInputStream *stream,
+dmap_gst_input_stream_skip (GInputStream *stream,
gsize count,
GCancellable *cancellable,
GError **error)
@@ -313,19 +320,19 @@ g_gst_input_stream_skip (GInputStream *stream,
}
static void
-g_gst_input_stream_kill_pipeline (GGstInputStream *stream)
+dmap_gst_input_stream_kill_pipeline (DMAPGstInputStream *stream)
{
- G_GST_INPUT_STREAM_GET_CLASS (stream)->kill_pipeline (stream);
+ DMAP_GST_INPUT_STREAM_GET_CLASS (stream)->kill_pipeline (stream);
}
static gboolean
-g_gst_input_stream_close (GInputStream *stream,
+dmap_gst_input_stream_close (GInputStream *stream,
GCancellable *cancellable,
GError **error)
{
- GGstInputStream *gst_stream = G_GST_INPUT_STREAM (stream);
+ DMAPGstInputStream *gst_stream = DMAP_GST_INPUT_STREAM (stream);
- g_gst_input_stream_kill_pipeline (gst_stream);
+ dmap_gst_input_stream_kill_pipeline (gst_stream);
g_mutex_lock (gst_stream->priv->buffer_mutex);
@@ -338,7 +345,7 @@ g_gst_input_stream_close (GInputStream *stream,
}
static gssize
-g_gst_input_stream_read_finish (GInputStream *stream,
+dmap_gst_input_stream_read_finish (GInputStream *stream,
GAsyncResult *result,
GError **error)
{
@@ -347,7 +354,7 @@ g_gst_input_stream_read_finish (GInputStream *stream,
}
static gssize
-g_gst_input_stream_skip_finish (GInputStream *stream,
+dmap_gst_input_stream_skip_finish (GInputStream *stream,
GAsyncResult *result,
GError **error)
{
@@ -356,7 +363,7 @@ g_gst_input_stream_skip_finish (GInputStream *stream,
}
static void
-g_gst_input_stream_close_async (GInputStream *stream,
+dmap_gst_input_stream_close_async (GInputStream *stream,
int io_priority,
GCancellable *cancellabl,
GAsyncReadyCallback callback,
@@ -365,7 +372,7 @@ g_gst_input_stream_close_async (GInputStream *stream,
}
static void
-g_gst_input_stream_read_async (GInputStream *stream,
+dmap_gst_input_stream_read_async (GInputStream *stream,
void *buffer,
gsize count,
int io_priority,
@@ -376,7 +383,7 @@ g_gst_input_stream_read_async (GInputStream *stream,
}
static void
-g_gst_input_stream_skip_async (GInputStream *stream,
+dmap_gst_input_stream_skip_async (GInputStream *stream,
gsize count,
int io_priority,
GCancellable *cancellabl,
@@ -386,7 +393,7 @@ g_gst_input_stream_skip_async (GInputStream *stream,
}
static gboolean
-g_gst_input_stream_close_finish (GInputStream *stream,
+dmap_gst_input_stream_close_finish (GInputStream *stream,
GAsyncResult *result,
GError **error)
{
@@ -395,28 +402,28 @@ g_gst_input_stream_close_finish (GInputStream *stream,
}
static void
-g_gst_input_stream_class_init (GGstInputStreamClass *klass)
+dmap_gst_input_stream_class_init (DMAPGstInputStreamClass *klass)
{
GInputStreamClass *istream_class;
- g_type_class_add_private (klass, sizeof (GGstInputStreamPrivate));
+ g_type_class_add_private (klass, sizeof (DMAPGstInputStreamPrivate));
istream_class = G_INPUT_STREAM_CLASS (klass);
- istream_class->read_fn = g_gst_input_stream_read;
- istream_class->skip = g_gst_input_stream_skip;
- istream_class->close_fn = g_gst_input_stream_close;
- istream_class->read_async = g_gst_input_stream_read_async;
- istream_class->read_finish = g_gst_input_stream_read_finish;
- istream_class->skip_async = g_gst_input_stream_skip_async;
- istream_class->skip_finish = g_gst_input_stream_skip_finish;
- istream_class->close_async = g_gst_input_stream_close_async;
- istream_class->close_finish = g_gst_input_stream_close_finish;
+ istream_class->read_fn = dmap_gst_input_stream_read;
+ istream_class->skip = dmap_gst_input_stream_skip;
+ istream_class->close_fn = dmap_gst_input_stream_close;
+ istream_class->read_async = dmap_gst_input_stream_read_async;
+ istream_class->read_finish = dmap_gst_input_stream_read_finish;
+ istream_class->skip_async = dmap_gst_input_stream_skip_async;
+ istream_class->skip_finish = dmap_gst_input_stream_skip_finish;
+ istream_class->close_async = dmap_gst_input_stream_close_async;
+ istream_class->close_finish = dmap_gst_input_stream_close_finish;
}
static void
-g_gst_input_stream_init (GGstInputStream *stream)
+dmap_gst_input_stream_init (DMAPGstInputStream *stream)
{
- stream->priv = G_GST_INPUT_STREAM_GET_PRIVATE (stream);
+ stream->priv = DMAP_GST_INPUT_STREAM_GET_PRIVATE (stream);
stream->priv->buffer = g_queue_new ();
stream->priv->read_request = 0;
@@ -427,7 +434,7 @@ g_gst_input_stream_init (GGstInputStream *stream)
stream->priv->buffer_closed = FALSE;
}
-G_DEFINE_TYPE_WITH_CODE (GGstInputStream, g_gst_input_stream,
+G_DEFINE_TYPE_WITH_CODE (DMAPGstInputStream, dmap_gst_input_stream,
G_TYPE_INPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
- g_gst_input_stream_seekable_iface_init))
+ dmap_gst_input_stream_seekable_iface_init))
diff --git a/libdmapsharing/dmap-gst-input-stream.h b/libdmapsharing/dmap-gst-input-stream.h
new file mode 100644
index 0000000..2303485
--- /dev/null
+++ b/libdmapsharing/dmap-gst-input-stream.h
@@ -0,0 +1,81 @@
+/*
+ * DMAPGstInputStream class: Open a URI using dmap_gst_input_stream_new ().
+ * Data is decoded using GStreamer and is then made available by the class's
+ * read operations.
+ *
+ * Copyright (C) 2008 W. Michael Petullo <mike flyn org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+#ifndef __DMAP_GST_INPUT_STREAM
+#define __DMAP_GST_INPUT_STREAM
+
+#include <gio/gio.h>
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define DMAP_TYPE_GST_INPUT_STREAM (dmap_gst_input_stream_get_type ())
+#define DMAP_GST_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ DMAP_TYPE_GST_INPUT_STREAM, \
+ DMAPGstInputStream))
+#define DMAP_GST_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
+ DMAP_TYPE_GST_INPUT_STREAM, \
+ DMAPGstInputStreamClass))
+#define IS_DMAP_GST_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ DMAP_TYPE_GST_INPUT_STREAM))
+#define IS_DMAP_GST_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+ DMAP_TYPE_GST_INPUT_STREAM_CLASS))
+#define DMAP_GST_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+ DMAP_TYPE_GST_INPUT_STREAM, \
+ DMAPGstInputStreamClass))
+#define DMAP_GST_INPUT_STREAM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+ DMAP_TYPE_GST_INPUT_STREAM, \
+ DMAPGstInputStreamPrivate))
+
+typedef struct DMAPGstInputStreamPrivate DMAPGstInputStreamPrivate;
+
+typedef struct {
+ GInputStream parent;
+ DMAPGstInputStreamPrivate *priv;
+} DMAPGstInputStream;
+
+typedef struct {
+ GInputStreamClass parent;
+
+ void (*kill_pipeline) (DMAPGstInputStream *);
+} DMAPGstInputStreamClass;
+
+GType dmap_gst_input_stream_get_type (void);
+
+/* Supported transcode target formats (data read from DMAPGstInputStream
+ * will be in one of these formats): */
+enum {
+ RAW, /* No transcoding performed. */
+ WAV16,
+ MP3
+};
+
+GInputStream* dmap_gst_input_stream_new (const gchar *transcode_mimetype, GInputStream *src_stream);
+
+void dmap_gst_input_stream_new_buffer_cb (GstElement *element,
+ DMAPGstInputStream *stream);
+
+gchar *dmapd_input_stream_strdup_format_extension (const gint format_code);
+
+G_END_DECLS
+
+#endif /* __DMAP_GST_INPUT_STREAM */
diff --git a/libdmapsharing/g-gst-mp3-input-stream.c b/libdmapsharing/dmap-gst-mp3-input-stream.c
similarity index 80%
rename from libdmapsharing/g-gst-mp3-input-stream.c
rename to libdmapsharing/dmap-gst-mp3-input-stream.c
index 8a2467f..6c0341b 100644
--- a/libdmapsharing/g-gst-mp3-input-stream.c
+++ b/libdmapsharing/dmap-gst-mp3-input-stream.c
@@ -1,5 +1,5 @@
/*
- * GGstMP3InputStream class: Open a URI using g_gst_mp3_input_stream_new ().
+ * DMAPGstMP3InputStream class: Open a URI using dmap_gst_mp3_input_stream_new ().
* Data is decoded using GStreamer and is then reencoded as an MP3
* stream by the class's read operations.
*
@@ -23,12 +23,12 @@
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
-#include "g-gst-mp3-input-stream.h"
+#include "dmap-gst-mp3-input-stream.h"
#include "gst-util.h"
#define GST_APP_MAX_BUFFERS 1024
-struct GGstMP3InputStreamPrivate {
+struct DMAPGstMP3InputStreamPrivate {
GstElement *pipeline;
GstElement *src;
GstElement *decode;
@@ -41,7 +41,7 @@ static void
new_decoded_pad_cb (GstElement *element,
GstPad *pad,
gboolean arg,
- GGstMP3InputStream *stream)
+ DMAPGstMP3InputStream *stream)
{
/* Link remaining pad after decodebin does its magic. */
GstPad *conv_pad;
@@ -66,13 +66,13 @@ new_decoded_pad_cb (GstElement *element,
}
}
-GInputStream* g_gst_mp3_input_stream_new (GInputStream *src_stream)
+GInputStream* dmap_gst_mp3_input_stream_new (GInputStream *src_stream)
{
GstStateChangeReturn sret;
GstState state;
- GGstMP3InputStream *stream;
+ DMAPGstMP3InputStream *stream;
- stream = G_GST_MP3_INPUT_STREAM (g_object_new (TYPE_G_GST_MP3_INPUT_STREAM,
+ stream = DMAP_GST_MP3_INPUT_STREAM (g_object_new (DMAP_TYPE_GST_MP3_INPUT_STREAM,
NULL));
stream->priv->pipeline = gst_pipeline_new ("pipeline");
@@ -118,7 +118,7 @@ GInputStream* g_gst_mp3_input_stream_new (GInputStream *src_stream)
GST_APP_MAX_BUFFERS);
gst_app_sink_set_drop (GST_APP_SINK (stream->priv->sink), FALSE);
- g_signal_connect (stream->priv->sink, "new-buffer", G_CALLBACK (g_gst_input_stream_new_buffer_cb), stream);
+ g_signal_connect (stream->priv->sink, "new-buffer", G_CALLBACK (dmap_gst_input_stream_new_buffer_cb), stream);
/* FIXME: this technique is shared with dmapd-daap-share.c */
sret = gst_element_set_state (stream->priv->pipeline, GST_STATE_PLAYING);
@@ -135,29 +135,29 @@ GInputStream* g_gst_mp3_input_stream_new (GInputStream *src_stream)
}
static void
-g_gst_mp3_input_stream_kill_pipeline (GGstInputStream *stream)
+dmap_gst_mp3_input_stream_kill_pipeline (DMAPGstInputStream *stream)
{
- GGstMP3InputStream *mp3_stream = G_GST_MP3_INPUT_STREAM (stream);
+ DMAPGstMP3InputStream *mp3_stream = DMAP_GST_MP3_INPUT_STREAM (stream);
gst_element_set_state (mp3_stream->priv->pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (mp3_stream->priv->pipeline));
}
-G_DEFINE_TYPE (GGstMP3InputStream, g_gst_mp3_input_stream, TYPE_G_GST_INPUT_STREAM)
+G_DEFINE_TYPE (DMAPGstMP3InputStream, dmap_gst_mp3_input_stream, DMAP_TYPE_GST_INPUT_STREAM)
static void
-g_gst_mp3_input_stream_class_init (GGstMP3InputStreamClass *klass)
+dmap_gst_mp3_input_stream_class_init (DMAPGstMP3InputStreamClass *klass)
{
- GGstInputStreamClass *parent_class = G_GST_INPUT_STREAM_CLASS (klass);
+ DMAPGstInputStreamClass *parent_class = DMAP_GST_INPUT_STREAM_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GGstMP3InputStreamPrivate));
+ g_type_class_add_private (klass, sizeof (DMAPGstMP3InputStreamPrivate));
- parent_class->kill_pipeline = g_gst_mp3_input_stream_kill_pipeline;
+ parent_class->kill_pipeline = dmap_gst_mp3_input_stream_kill_pipeline;
}
static void
-g_gst_mp3_input_stream_init (GGstMP3InputStream *stream)
+dmap_gst_mp3_input_stream_init (DMAPGstMP3InputStream *stream)
{
- stream->priv = G_GST_MP3_INPUT_STREAM_GET_PRIVATE (stream);
+ stream->priv = DMAP_GST_MP3_INPUT_STREAM_GET_PRIVATE (stream);
}
diff --git a/libdmapsharing/dmap-gst-mp3-input-stream.h b/libdmapsharing/dmap-gst-mp3-input-stream.h
new file mode 100644
index 0000000..87b0fd7
--- /dev/null
+++ b/libdmapsharing/dmap-gst-mp3-input-stream.h
@@ -0,0 +1,67 @@
+/*
+ * DMAPGstMP3InputStream class: Open a URI using dmap_gst_mp3_input_stream_new ().
+ * Data is decoded using GStreamer and is then reencoded as an MP3
+ * stream by the class's read operations.
+ *
+ * Copyright (C) 2008 W. Michael Petullo <mike flyn org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+#ifndef __DMAP_GST_MP3_INPUT_STREAM
+#define __DMAP_GST_MP3_INPUT_STREAM
+
+#include <gio/gio.h>
+
+#include "dmap-gst-input-stream.h"
+
+G_BEGIN_DECLS
+
+#define DMAP_TYPE_GST_MP3_INPUT_STREAM (dmap_gst_mp3_input_stream_get_type ())
+#define DMAP_GST_MP3_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ DMAP_TYPE_GST_MP3_INPUT_STREAM, \
+ DMAPGstMP3InputStream))
+#define DMAP_GST_MP3_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
+ DMAP_TYPE_GST_MP3_INPUT_STREAM, \
+ DMAPGstMP3InputStreamClass))
+#define IS_DMAP_GST_MP3_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ DMAP_TYPE_GST_MP3_INPUT_STREAM))
+#define IS_DMAP_GST_MP3_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+ DMAP_TYPE_GST_MP3_INPUT_STREAM_CLASS))
+#define DMAP_GST_MP3_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+ DMAP_TYPE_GST_MP3_INPUT_STREAM, \
+ DMAPGstMP3InputStreamClass))
+#define DMAP_GST_MP3_INPUT_STREAM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+ DMAP_TYPE_GST_MP3_INPUT_STREAM, \
+ DMAPGstMP3InputStreamPrivate))
+
+typedef struct DMAPGstMP3InputStreamPrivate DMAPGstMP3InputStreamPrivate;
+
+typedef struct {
+ DMAPGstInputStream parent;
+ DMAPGstMP3InputStreamPrivate *priv;
+} DMAPGstMP3InputStream;
+
+typedef struct {
+ DMAPGstInputStreamClass parent;
+} DMAPGstMP3InputStreamClass;
+
+GType dmap_gst_mp3_input_stream_get_type (void);
+
+GInputStream* dmap_gst_mp3_input_stream_new (GInputStream *stream);
+
+G_END_DECLS
+
+#endif /* __DMAP_GST_MP3_INPUT_STREAM */
diff --git a/libdmapsharing/g-gst-wav-input-stream.c b/libdmapsharing/dmap-gst-wav-input-stream.c
similarity index 80%
rename from libdmapsharing/g-gst-wav-input-stream.c
rename to libdmapsharing/dmap-gst-wav-input-stream.c
index fd6c567..feec585 100644
--- a/libdmapsharing/g-gst-wav-input-stream.c
+++ b/libdmapsharing/dmap-gst-wav-input-stream.c
@@ -1,5 +1,5 @@
/*
- * GGstWAVInputStream class: Open a URI using g_gst_wav_input_stream_new ().
+ * DMAPGstWAVInputStream class: Open a URI using dmap_gst_wav_input_stream_new ().
* Data is decoded using GStreamer and is then reencoded as a WAV
* stream by the class's read operations.
*
@@ -24,11 +24,11 @@
#include <gst/app/gstappsink.h>
#include "gst-util.h"
-#include "g-gst-wav-input-stream.h"
+#include "dmap-gst-wav-input-stream.h"
#define GST_APP_MAX_BUFFERS 1024
-struct GGstWAVInputStreamPrivate {
+struct DMAPGstWAVInputStreamPrivate {
GstElement *pipeline;
GstElement *src;
GstElement *decode;
@@ -42,7 +42,7 @@ static void
new_decoded_pad_cb (GstElement *element,
GstPad *pad,
gboolean arg,
- GGstWAVInputStream *stream)
+ DMAPGstWAVInputStream *stream)
{
/* Link remaining pad after decodebin does its magic. */
GstPad *conv_pad;
@@ -70,13 +70,13 @@ new_decoded_pad_cb (GstElement *element,
}
}
-GInputStream* g_gst_wav_input_stream_new (GInputStream *src_stream)
+GInputStream* dmap_gst_wav_input_stream_new (GInputStream *src_stream)
{
GstStateChangeReturn sret;
GstState state;
- GGstWAVInputStream *stream;
+ DMAPGstWAVInputStream *stream;
- stream = G_GST_WAV_INPUT_STREAM (g_object_new (TYPE_G_GST_WAV_INPUT_STREAM,
+ stream = DMAP_GST_WAV_INPUT_STREAM (g_object_new (DMAP_TYPE_GST_WAV_INPUT_STREAM,
NULL));
stream->priv->pipeline = gst_pipeline_new ("pipeline");
@@ -123,7 +123,7 @@ GInputStream* g_gst_wav_input_stream_new (GInputStream *src_stream)
GST_APP_MAX_BUFFERS);
gst_app_sink_set_drop (GST_APP_SINK (stream->priv->sink), FALSE);
- g_signal_connect (stream->priv->sink, "new-buffer", G_CALLBACK (g_gst_input_stream_new_buffer_cb), stream);
+ g_signal_connect (stream->priv->sink, "new-buffer", G_CALLBACK (dmap_gst_input_stream_new_buffer_cb), stream);
/* FIXME: this technique is shared with dmapd-daap-share.c */
sret = gst_element_set_state (stream->priv->pipeline, GST_STATE_PLAYING);
@@ -140,29 +140,29 @@ GInputStream* g_gst_wav_input_stream_new (GInputStream *src_stream)
}
static void
-g_gst_wav_input_stream_kill_pipeline (GGstInputStream *stream)
+dmap_gst_wav_input_stream_kill_pipeline (DMAPGstInputStream *stream)
{
- GGstWAVInputStream *wav_stream = G_GST_WAV_INPUT_STREAM (stream);
+ DMAPGstWAVInputStream *wav_stream = DMAP_GST_WAV_INPUT_STREAM (stream);
gst_element_set_state (wav_stream->priv->pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (wav_stream->priv->pipeline));
}
-G_DEFINE_TYPE (GGstWAVInputStream, g_gst_wav_input_stream, TYPE_G_GST_INPUT_STREAM)
+G_DEFINE_TYPE (DMAPGstWAVInputStream, dmap_gst_wav_input_stream, DMAP_TYPE_GST_INPUT_STREAM)
static void
-g_gst_wav_input_stream_class_init (GGstWAVInputStreamClass *klass)
+dmap_gst_wav_input_stream_class_init (DMAPGstWAVInputStreamClass *klass)
{
- GGstInputStreamClass *parent_class = G_GST_INPUT_STREAM_CLASS (klass);
+ DMAPGstInputStreamClass *parent_class = DMAP_GST_INPUT_STREAM_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GGstWAVInputStreamPrivate));
+ g_type_class_add_private (klass, sizeof (DMAPGstWAVInputStreamPrivate));
- parent_class->kill_pipeline = g_gst_wav_input_stream_kill_pipeline;
+ parent_class->kill_pipeline = dmap_gst_wav_input_stream_kill_pipeline;
}
static void
-g_gst_wav_input_stream_init (GGstWAVInputStream *stream)
+dmap_gst_wav_input_stream_init (DMAPGstWAVInputStream *stream)
{
- stream->priv = G_GST_WAV_INPUT_STREAM_GET_PRIVATE (stream);
+ stream->priv = DMAP_GST_WAV_INPUT_STREAM_GET_PRIVATE (stream);
}
diff --git a/libdmapsharing/dmap-gst-wav-input-stream.h b/libdmapsharing/dmap-gst-wav-input-stream.h
new file mode 100644
index 0000000..84440d0
--- /dev/null
+++ b/libdmapsharing/dmap-gst-wav-input-stream.h
@@ -0,0 +1,67 @@
+/*
+ * DMAPGstWAVInputStream class: Open a URI using dmap_gst_wav_input_stream_new ().
+ * Data is decoded using GStreamer and is then reencoded as a MP3
+ * stream by the class's read operations.
+ *
+ * Copyright (C) 2008 W. Michael Petullo <mike flyn org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+#ifndef __DMAP_GST_WAV_INPUT_STREAM
+#define __DMAP_GST_WAV_INPUT_STREAM
+
+#include <gio/gio.h>
+
+#include "dmap-gst-input-stream.h"
+
+G_BEGIN_DECLS
+
+#define DMAP_TYPE_GST_WAV_INPUT_STREAM (dmap_gst_wav_input_stream_get_type ())
+#define DMAP_GST_WAV_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ DMAP_TYPE_GST_WAV_INPUT_STREAM, \
+ DMAPGstWAVInputStream))
+#define DMAP_GST_WAV_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
+ DMAP_TYPE_GST_WAV_INPUT_STREAM, \
+ DMAPGstWAVInputStreamClass))
+#define IS_DMAP_GST_WAV_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ DMAP_TYPE_GST_WAV_INPUT_STREAM))
+#define IS_DMAP_GST_WAV_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+ DMAP_TYPE_GST_WAV_INPUT_STREAM_CLASS))
+#define DMAP_GST_WAV_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+ DMAP_TYPE_GST_WAV_INPUT_STREAM, \
+ DMAPGstWAVInputStreamClass))
+#define DMAP_GST_WAV_INPUT_STREAM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+ DMAP_TYPE_GST_WAV_INPUT_STREAM, \
+ DMAPGstWAVInputStreamPrivate))
+
+typedef struct DMAPGstWAVInputStreamPrivate DMAPGstWAVInputStreamPrivate;
+
+typedef struct {
+ DMAPGstInputStream parent;
+ DMAPGstWAVInputStreamPrivate *priv;
+} DMAPGstWAVInputStream;
+
+typedef struct {
+ DMAPGstInputStreamClass parent;
+} DMAPGstWAVInputStreamClass;
+
+GType dmap_gst_wav_input_stream_get_type (void);
+
+GInputStream* dmap_gst_wav_input_stream_new (GInputStream *stream);
+
+G_END_DECLS
+
+#endif /* __DMAP_GST_WAV_INPUT_STREAM */
diff --git a/libdmapsharing/dmap.h b/libdmapsharing/dmap.h
index 81fcfc0..3f794d4 100644
--- a/libdmapsharing/dmap.h
+++ b/libdmapsharing/dmap.h
@@ -7,6 +7,7 @@
#include <libdmapsharing/dmap-container-db.h>
#include <libdmapsharing/dmap-container-record.h>
#include <libdmapsharing/dmap-db.h>
+#include <libdmapsharing/dmap-gst-input-stream.h>
#include <libdmapsharing/dmap-md5.h>
#include <libdmapsharing/dmap-mdns-browser.h>
#include <libdmapsharing/dmap-mdns-publisher.h>
diff --git a/libdmapsharing/gst-util.c b/libdmapsharing/gst-util.c
index 7167398..b0efab1 100644
--- a/libdmapsharing/gst-util.c
+++ b/libdmapsharing/gst-util.c
@@ -20,7 +20,7 @@
#include <string.h>
-#include "g-gst-input-stream.h"
+#include "dmap-gst-input-stream.h"
gboolean
pads_compatible (GstPad *pad1, GstPad *pad2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]