[libdmapsharing] Modify visibility of symbols related to transcoding
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Modify visibility of symbols related to transcoding
- Date: Fri, 3 Jul 2020 15:39:05 +0000 (UTC)
commit c4f5365d9891e3d5876a1a59a6f8b48143a6ddf3
Author: W. Michael Petullo <mike flyn org>
Date: Fri Jul 3 10:35:10 2020 -0500
Modify visibility of symbols related to transcoding
1. Rename "dmap-gst-input*stream*" to "dmap-transcode-stream*"
2. Move declaration of ...new_buffer_cb to private header
3. Remove GStreamer headers from dmap-transcode-stream.h
4. Make GStreamer a private requirement in .pc file
libdmapsharing-4.0.pc.in | 3 +-
libdmapsharing/Makefile.am | 16 ++---
libdmapsharing/dmap-av-share.c | 4 +-
libdmapsharing/dmap-gst-input-stream.h | 78 ----------------------
...-input-stream.c => dmap-transcode-mp3-stream.c} | 37 +++++-----
...-input-stream.h => dmap-transcode-mp3-stream.h} | 38 +++++------
...t-input-stream.c => dmap-transcode-qt-stream.c} | 37 +++++-----
...t-input-stream.h => dmap-transcode-qt-stream.h} | 38 +++++------
libdmapsharing/dmap-transcode-stream-private.h | 25 +++++++
...-gst-input-stream.c => dmap-transcode-stream.c} | 50 +++++++-------
libdmapsharing/dmap-transcode-stream.h | 72 ++++++++++++++++++++
...-input-stream.c => dmap-transcode-wav-stream.c} | 37 +++++-----
...-input-stream.h => dmap-transcode-wav-stream.h} | 38 +++++------
libdmapsharing/dmap.h | 2 +-
libdmapsharing/gst-util.c | 2 +-
15 files changed, 250 insertions(+), 227 deletions(-)
---
diff --git a/libdmapsharing-4.0.pc.in b/libdmapsharing-4.0.pc.in
index 0aa1e33..cf93000 100644
--- a/libdmapsharing-4.0.pc.in
+++ b/libdmapsharing-4.0.pc.in
@@ -6,6 +6,7 @@ includedir=@includedir@
Name: libdmapsharing
Description: libdmapsharing
Version: @VERSION@
-Requires: glib-2.0 libsoup-2.4 @GSTLIB@
+Requires: glib-2.0 libsoup-2.4
+Requires.private: @GSTLIB@
Libs: -L${libdir} -ldmapsharing-@API_VERSION@
Cflags: -I${includedir}/libdmapsharing-@API_VERSION@
diff --git a/libdmapsharing/Makefile.am b/libdmapsharing/Makefile.am
index 60664d3..6956fc8 100644
--- a/libdmapsharing/Makefile.am
+++ b/libdmapsharing/Makefile.am
@@ -55,10 +55,10 @@ endif
if USE_GSTREAMERAPP
libdmapsharing_4_0_la_SOURCES += \
- dmap-gst-input-stream.c \
- dmap-gst-mp3-input-stream.c \
- dmap-gst-qt-input-stream.c \
- dmap-gst-wav-input-stream.c \
+ dmap-transcode-stream.c \
+ dmap-transcode-mp3-stream.c \
+ dmap-transcode-qt-stream.c \
+ dmap-transcode-wav-stream.c \
gst-util.c
endif
@@ -102,7 +102,7 @@ libdmapsharinginclude_HEADERS = \
dmap-db.h \
dmap-enums.h \
dmap-error.h \
- dmap-gst-input-stream.h \
+ dmap-transcode-stream.h \
dmap-md5.h \
dmap-mdns-browser.h \
dmap-mdns-publisher.h \
@@ -118,9 +118,9 @@ libdmapsharinginclude_HEADERS = \
noinst_HEADERS = \
dmap-config.h \
dmap-connection-private.h \
- dmap-gst-mp3-input-stream.h \
- dmap-gst-qt-input-stream.h \
- dmap-gst-wav-input-stream.h \
+ dmap-transcode-mp3-stream.h \
+ dmap-transcode-qt-stream.h \
+ dmap-transcode-wav-stream.h \
dmap-marshal.h \
dmap-mdns-avahi.h \
dmap-private-utils.h \
diff --git a/libdmapsharing/dmap-av-share.c b/libdmapsharing/dmap-av-share.c
index 69070f1..1f763cd 100644
--- a/libdmapsharing/dmap-av-share.c
+++ b/libdmapsharing/dmap-av-share.c
@@ -41,7 +41,7 @@
#include <libdmapsharing/dmap-utils.h>
#ifdef HAVE_GSTREAMERAPP
-#include <libdmapsharing/dmap-gst-input-stream.h>
+#include <libdmapsharing/dmap-transcode-stream.h>
#endif /* HAVE_GSTREAMERAPP */
static guint _get_desired_port (DmapShare * share);
@@ -372,7 +372,7 @@ _send_chunked_file (DmapAvShare *share, SoupServer * server, SoupMessage * messa
if (_should_transcode (share, format, has_video, transcode_mimetype)) {
#ifdef HAVE_GSTREAMERAPP
cd->original_stream = stream;
- cd->stream = dmap_gst_input_stream_new (transcode_mimetype, stream);
+ cd->stream = dmap_transcode_stream_new (transcode_mimetype, stream);
#else
dmap_share_emit_error(DMAP_SHARE(share), DMAP_STATUS_BAD_FORMAT,
"Transcode format %s not supported",
diff --git a/libdmapsharing/dmap-gst-mp3-input-stream.c b/libdmapsharing/dmap-transcode-mp3-stream.c
similarity index 83%
rename from libdmapsharing/dmap-gst-mp3-input-stream.c
rename to libdmapsharing/dmap-transcode-mp3-stream.c
index 1550172..244d830 100644
--- a/libdmapsharing/dmap-gst-mp3-input-stream.c
+++ b/libdmapsharing/dmap-transcode-mp3-stream.c
@@ -1,5 +1,5 @@
/*
- * DmapGstMP3InputStream class: Open a URI using dmap_gst_mp3_input_stream_new ().
+ * DmapTranscodeMp3Stream class: Open a URI using dmap_transcode_mp3_stream_new ().
* Data is decoded using GStreamer and is then reencoded as an MP3
* stream by the class's read operations.
*
@@ -23,12 +23,13 @@
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
-#include "dmap-gst-mp3-input-stream.h"
+#include "dmap-transcode-mp3-stream.h"
+#include "dmap-transcode-stream-private.h"
#include "gst-util.h"
#define GST_APP_MAX_BUFFERS 1024
-struct DmapGstMP3InputStreamPrivate
+struct DmapTranscodeMp3StreamPrivate
{
GstElement *pipeline;
GstElement *src;
@@ -61,11 +62,11 @@ _pad_added_cb (G_GNUC_UNUSED GstElement * element,
}
GInputStream *
-dmap_gst_mp3_input_stream_new (GInputStream * src_stream)
+dmap_transcode_mp3_stream_new (GInputStream * src_stream)
{
GstStateChangeReturn sret;
GstState state;
- DmapGstMP3InputStream *stream = NULL;
+ DmapTranscodeMp3Stream *stream = NULL;
GstElement *pipeline = NULL;
GstElement *src = NULL;
@@ -151,13 +152,13 @@ dmap_gst_mp3_input_stream_new (GInputStream * src_stream)
goto done;
}
- stream = DMAP_GST_MP3_INPUT_STREAM (g_object_new (DMAP_TYPE_GST_MP3_INPUT_STREAM, NULL));
+ stream = DMAP_TRANSCODE_MP3_STREAM (g_object_new (DMAP_TYPE_GST_MP3_INPUT_STREAM, NULL));
if (NULL == stream) {
goto done;
}
g_assert (G_IS_SEEKABLE (stream));
- g_signal_connect (sink, "new-sample", G_CALLBACK (dmap_gst_input_stream_new_buffer_cb), stream);
+ g_signal_connect (sink, "new-sample", G_CALLBACK (dmap_transcode_stream_new_buffer_cb), stream);
stream->priv->pipeline = gst_object_ref (pipeline);
stream->priv->src = gst_object_ref (src);
@@ -195,30 +196,30 @@ done:
}
static void
-_kill_pipeline (DmapGstInputStream * stream)
+_kill_pipeline (DmapTranscodeStream * stream)
{
- DmapGstMP3InputStream *mp3_stream =
- DMAP_GST_MP3_INPUT_STREAM (stream);
+ DmapTranscodeMp3Stream *mp3_stream =
+ DMAP_TRANSCODE_MP3_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_WITH_PRIVATE (DmapGstMP3InputStream,
- dmap_gst_mp3_input_stream,
- DMAP_TYPE_GST_INPUT_STREAM);
+G_DEFINE_TYPE_WITH_PRIVATE (DmapTranscodeMp3Stream,
+ dmap_transcode_mp3_stream,
+ DMAP_TYPE_TRANSCODE_STREAM);
static void
-dmap_gst_mp3_input_stream_class_init (DmapGstMP3InputStreamClass * klass)
+dmap_transcode_mp3_stream_class_init (DmapTranscodeMp3StreamClass * klass)
{
- DmapGstInputStreamClass *parent_class =
- DMAP_GST_INPUT_STREAM_CLASS (klass);
+ DmapTranscodeStreamClass *parent_class =
+ DMAP_TRANSCODE_STREAM_CLASS (klass);
parent_class->kill_pipeline = _kill_pipeline;
}
static void
-dmap_gst_mp3_input_stream_init (DmapGstMP3InputStream * stream)
+dmap_transcode_mp3_stream_init (DmapTranscodeMp3Stream * stream)
{
- stream->priv = dmap_gst_mp3_input_stream_get_instance_private(stream);
+ stream->priv = dmap_transcode_mp3_stream_get_instance_private(stream);
}
diff --git a/libdmapsharing/dmap-gst-mp3-input-stream.h b/libdmapsharing/dmap-transcode-mp3-stream.h
similarity index 61%
rename from libdmapsharing/dmap-gst-mp3-input-stream.h
rename to libdmapsharing/dmap-transcode-mp3-stream.h
index badf9fd..71f34d0 100644
--- a/libdmapsharing/dmap-gst-mp3-input-stream.h
+++ b/libdmapsharing/dmap-transcode-mp3-stream.h
@@ -1,5 +1,5 @@
/*
- * DmapGstMP3InputStream class: Open a URI using dmap_gst_mp3_input_stream_new ().
+ * DmapTranscodeMp3Stream class: Open a URI using dmap_transcode_mp3_stream_new ().
* Data is decoded using GStreamer and is then reencoded as an MP3
* stream by the class's read operations.
*
@@ -20,42 +20,42 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _DMAP_GST_MP3_INPUT_STREAM_H
-#define _DMAP_GST_MP3_INPUT_STREAM_H
+#ifndef _DMAP_TRANSCODE_MP3_STREAM_H
+#define _DMAP_TRANSCODE_MP3_STREAM_H
#include <gio/gio.h>
-#include "dmap-gst-input-stream.h"
+#include "dmap-transcode-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), \
+#define DMAP_TYPE_GST_MP3_INPUT_STREAM (dmap_transcode_mp3_stream_get_type ())
+#define DMAP_TRANSCODE_MP3_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), \
+ DmapTranscodeMp3Stream))
+#define DMAP_TRANSCODE_MP3_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
DMAP_TYPE_GST_MP3_INPUT_STREAM, \
- DmapGstMP3InputStreamClass))
+ DmapTranscodeMp3StreamClass))
#define DMAP_IS_GST_MP3_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
DMAP_TYPE_GST_MP3_INPUT_STREAM))
#define DMAP_IS_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), \
+#define DMAP_TRANSCODE_MP3_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
DMAP_TYPE_GST_MP3_INPUT_STREAM, \
- DmapGstMP3InputStreamClass))
-typedef struct DmapGstMP3InputStreamPrivate DmapGstMP3InputStreamPrivate;
+ DmapTranscodeMp3StreamClass))
+typedef struct DmapTranscodeMp3StreamPrivate DmapTranscodeMp3StreamPrivate;
typedef struct {
- DmapGstInputStream parent;
- DmapGstMP3InputStreamPrivate *priv;
-} DmapGstMP3InputStream;
+ DmapTranscodeStream parent;
+ DmapTranscodeMp3StreamPrivate *priv;
+} DmapTranscodeMp3Stream;
typedef struct {
- DmapGstInputStreamClass parent;
-} DmapGstMP3InputStreamClass;
+ DmapTranscodeStreamClass parent;
+} DmapTranscodeMp3StreamClass;
-GType dmap_gst_mp3_input_stream_get_type (void);
+GType dmap_transcode_mp3_stream_get_type (void);
-GInputStream *dmap_gst_mp3_input_stream_new (GInputStream * stream);
+GInputStream *dmap_transcode_mp3_stream_new (GInputStream * stream);
G_END_DECLS
#endif
diff --git a/libdmapsharing/dmap-gst-qt-input-stream.c b/libdmapsharing/dmap-transcode-qt-stream.c
similarity index 85%
rename from libdmapsharing/dmap-gst-qt-input-stream.c
rename to libdmapsharing/dmap-transcode-qt-stream.c
index 1850375..1910725 100644
--- a/libdmapsharing/dmap-gst-qt-input-stream.c
+++ b/libdmapsharing/dmap-transcode-qt-stream.c
@@ -1,5 +1,5 @@
/*
- * DmapGstQtInputStream class: Open a URI using dmap_gst_qt_input_stream_new ().
+ * DmapTranscodeQtStream class: Open a URI using dmap_transcode_qt_stream_new ().
* Data is decoded using GStreamer and is then reencoded as a QuickTime video
* stream by the class's read operations.
*
@@ -23,12 +23,13 @@
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
-#include "dmap-gst-qt-input-stream.h"
+#include "dmap-transcode-qt-stream.h"
+#include "dmap-transcode-stream-private.h"
#include "gst-util.h"
#define GST_APP_MAX_BUFFERS 1024
-struct DmapGstQtInputStreamPrivate
+struct DmapTranscodeQtStreamPrivate
{
GstElement *pipeline;
GstElement *src;
@@ -62,11 +63,11 @@ _pad_added_cb (G_GNUC_UNUSED GstElement * element,
}
GInputStream *
-dmap_gst_qt_input_stream_new (GInputStream * src_stream)
+dmap_transcode_qt_stream_new (GInputStream * src_stream)
{
GstStateChangeReturn sret;
GstState state;
- DmapGstQtInputStream *stream = NULL;
+ DmapTranscodeQtStream *stream = NULL;
GstElement *pipeline = NULL;
GstElement *src = NULL;
@@ -153,13 +154,13 @@ dmap_gst_qt_input_stream_new (GInputStream * src_stream)
goto done;
}
- stream = DMAP_GST_QT_INPUT_STREAM (g_object_new (DMAP_TYPE_GST_QT_INPUT_STREAM, NULL));
+ stream = DMAP_TRANSCODE_QT_STREAM (g_object_new (DMAP_TYPE_GST_QT_INPUT_STREAM, NULL));
if (NULL == stream) {
goto done;
}
g_assert (G_IS_SEEKABLE (stream));
- g_signal_connect (sink, "new-sample", G_CALLBACK (dmap_gst_input_stream_new_buffer_cb), stream);
+ g_signal_connect (sink, "new-sample", G_CALLBACK (dmap_transcode_stream_new_buffer_cb), stream);
stream->priv->pipeline = gst_object_ref (pipeline);
stream->priv->src = gst_object_ref (src);
@@ -202,10 +203,10 @@ done:
}
static void
-_kill_pipeline (DmapGstInputStream * stream)
+_kill_pipeline (DmapTranscodeStream * stream)
{
- DmapGstQtInputStream *qt_stream =
- DMAP_GST_QT_INPUT_STREAM (stream);
+ DmapTranscodeQtStream *qt_stream =
+ DMAP_TRANSCODE_QT_STREAM (stream);
// FIXME: It seems that I need to send an EOS, because QuickTime writes
// its headers after encoding the streams, but this does not yet work.
@@ -215,21 +216,21 @@ _kill_pipeline (DmapGstInputStream * stream)
gst_object_unref (GST_OBJECT (qt_stream->priv->pipeline));
}
-G_DEFINE_TYPE_WITH_PRIVATE (DmapGstQtInputStream,
- dmap_gst_qt_input_stream,
- DMAP_TYPE_GST_INPUT_STREAM);
+G_DEFINE_TYPE_WITH_PRIVATE (DmapTranscodeQtStream,
+ dmap_transcode_qt_stream,
+ DMAP_TYPE_TRANSCODE_STREAM);
static void
-dmap_gst_qt_input_stream_class_init (DmapGstQtInputStreamClass * klass)
+dmap_transcode_qt_stream_class_init (DmapTranscodeQtStreamClass * klass)
{
- DmapGstInputStreamClass *parent_class =
- DMAP_GST_INPUT_STREAM_CLASS (klass);
+ DmapTranscodeStreamClass *parent_class =
+ DMAP_TRANSCODE_STREAM_CLASS (klass);
parent_class->kill_pipeline = _kill_pipeline;
}
static void
-dmap_gst_qt_input_stream_init (DmapGstQtInputStream * stream)
+dmap_transcode_qt_stream_init (DmapTranscodeQtStream * stream)
{
- stream->priv = dmap_gst_qt_input_stream_get_instance_private(stream);
+ stream->priv = dmap_transcode_qt_stream_get_instance_private(stream);
}
diff --git a/libdmapsharing/dmap-gst-qt-input-stream.h b/libdmapsharing/dmap-transcode-qt-stream.h
similarity index 62%
rename from libdmapsharing/dmap-gst-qt-input-stream.h
rename to libdmapsharing/dmap-transcode-qt-stream.h
index 9b084ea..e9d4fba 100644
--- a/libdmapsharing/dmap-gst-qt-input-stream.h
+++ b/libdmapsharing/dmap-transcode-qt-stream.h
@@ -1,5 +1,5 @@
/*
- * DmapGstQtInputStream class: Open a URI using dmap_gst_qt_input_stream_new ().
+ * DmapTranscodeQtStream class: Open a URI using dmap_transcode_qt_stream_new ().
* Data is decoded using GStreamer and is then reencoded as a QuickTime video
* stream by the class's read operations.
*
@@ -20,42 +20,42 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _DMAP_GST_QT_INPUT_STREAM_H
-#define _DMAP_GST_QT_INPUT_STREAM_H
+#ifndef _DMAP_TRANSCODE_QT_STREAM_H
+#define _DMAP_TRANSCODE_QT_STREAM_H
#include <gio/gio.h>
-#include "dmap-gst-input-stream.h"
+#include "dmap-transcode-stream.h"
G_BEGIN_DECLS
-#define DMAP_TYPE_GST_QT_INPUT_STREAM (dmap_gst_qt_input_stream_get_type ())
-#define DMAP_GST_QT_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+#define DMAP_TYPE_GST_QT_INPUT_STREAM (dmap_transcode_qt_stream_get_type ())
+#define DMAP_TRANSCODE_QT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
DMAP_TYPE_GST_QT_INPUT_STREAM, \
- DmapGstQtInputStream))
-#define DMAP_GST_QT_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
+ DmapTranscodeQtStream))
+#define DMAP_TRANSCODE_QT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
DMAP_TYPE_GST_QT_INPUT_STREAM, \
- DmapGstQtInputStreamClass))
+ DmapTranscodeQtStreamClass))
#define DMAP_IS_GST_QT_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
DMAP_TYPE_GST_QT_INPUT_STREAM))
#define DMAP_IS_GST_QT_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
DMAP_TYPE_GST_QT_INPUT_STREAM_CLASS))
-#define DMAP_GST_QT_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+#define DMAP_TRANSCODE_QT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
DMAP_TYPE_GST_QT_INPUT_STREAM, \
- DmapGstQtInputStreamClass))
-typedef struct DmapGstQtInputStreamPrivate DmapGstQtInputStreamPrivate;
+ DmapTranscodeQtStreamClass))
+typedef struct DmapTranscodeQtStreamPrivate DmapTranscodeQtStreamPrivate;
typedef struct {
- DmapGstInputStream parent;
- DmapGstQtInputStreamPrivate *priv;
-} DmapGstQtInputStream;
+ DmapTranscodeStream parent;
+ DmapTranscodeQtStreamPrivate *priv;
+} DmapTranscodeQtStream;
typedef struct {
- DmapGstInputStreamClass parent;
-} DmapGstQtInputStreamClass;
+ DmapTranscodeStreamClass parent;
+} DmapTranscodeQtStreamClass;
-GType dmap_gst_qt_input_stream_get_type (void);
+GType dmap_transcode_qt_stream_get_type (void);
-GInputStream *dmap_gst_qt_input_stream_new (GInputStream * stream);
+GInputStream *dmap_transcode_qt_stream_new (GInputStream * stream);
G_END_DECLS
#endif
diff --git a/libdmapsharing/dmap-transcode-stream-private.h b/libdmapsharing/dmap-transcode-stream-private.h
new file mode 100644
index 0000000..19a3dea
--- /dev/null
+++ b/libdmapsharing/dmap-transcode-stream-private.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2020 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_TRANSCODE_STREAM_PRIVATE_H
+#define _DMAP_TRANSCODE_STREAM_PRIVATE_H
+
+void dmap_transcode_stream_new_buffer_cb(GstElement *element,
+ DmapTranscodeStream *stream);
+
+#endif
diff --git a/libdmapsharing/dmap-gst-input-stream.c b/libdmapsharing/dmap-transcode-stream.c
similarity index 89%
rename from libdmapsharing/dmap-gst-input-stream.c
rename to libdmapsharing/dmap-transcode-stream.c
index be36634..3d9ce6d 100644
--- a/libdmapsharing/dmap-gst-input-stream.c
+++ b/libdmapsharing/dmap-transcode-stream.c
@@ -1,5 +1,5 @@
/*
- * DmapGstInputStream class: Open a URI using dmap_gst_input_stream_new ().
+ * DmapTranscodeStream class: Open a URI using dmap_transcode_stream_new ().
* Data is decoded using GStreamer and is then made available by the class's
* read operations.
*
@@ -24,10 +24,10 @@
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
-#include "dmap-gst-input-stream.h"
-#include "dmap-gst-mp3-input-stream.h"
-#include "dmap-gst-wav-input-stream.h"
-#include "dmap-gst-qt-input-stream.h"
+#include "dmap-transcode-stream.h"
+#include "dmap-transcode-mp3-stream.h"
+#include "dmap-transcode-wav-stream.h"
+#include "dmap-transcode-qt-stream.h"
#include "gst-util.h"
#define GST_APP_MAX_BUFFERS 1024
@@ -35,7 +35,7 @@
#define QUEUE_PUSH_WAIT_SECONDS 10
#define QUEUE_POP_WAIT_SECONDS 1
-struct DmapGstInputStreamPrivate
+struct DmapTranscodeStreamPrivate
{
GQueue *buffer;
gsize read_request; /* Size of data asked for */
@@ -69,10 +69,10 @@ _seek (G_GNUC_UNUSED GSeekable * seekable,
GError ** error)
{
gboolean ok = FALSE;
- // FIXME: implement: DmapGstInputStream *stream;
+ // FIXME: implement: DmapTranscodeStream *stream;
// FIXME: implement: goffset absolute;
- // FIXME: implement: stream = DMAP_GST_INPUT_STREAM (seekable);
+ // FIXME: implement: stream = DMAP_TRANSCODE_STREAM (seekable);
switch (type) {
/* FIXME: implement:
@@ -108,7 +108,7 @@ _seek (G_GNUC_UNUSED GSeekable * seekable,
*/
/* FIXME:
- * if (! gst_element_seek_simple (DMAP_GST_INPUT_STREAM (seekable)->priv->pipeline,
+ * if (! gst_element_seek_simple (DMAP_TRANSCODE_STREAM (seekable)->priv->pipeline,
* GST_FORMAT_BYTES,
* GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
* absolute)) {
@@ -139,7 +139,7 @@ _truncate (G_GNUC_UNUSED GSeekable * seekable,
GError ** error)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "Cannot truncate DmapGstInputStream");
+ "Cannot truncate DmapTranscodeStream");
return FALSE;
}
@@ -154,8 +154,8 @@ _seekable_iface_init (GSeekableIface * iface)
}
void
-dmap_gst_input_stream_new_buffer_cb (GstElement * element,
- DmapGstInputStream * stream)
+dmap_transcode_stream_new_buffer_cb (GstElement * element,
+ DmapTranscodeStream * stream)
{
gsize i;
guint8 *ptr;
@@ -167,7 +167,7 @@ dmap_gst_input_stream_new_buffer_cb (GstElement * element,
/* FIXME: Is this necessary? I am trying to protect against this
* thread manipulating data after the pipeline has been destroyed.
- * see also dmap_gst_input_stream_close ().
+ * see also dmap_transcode_stream_close ().
*/
g_mutex_lock (&stream->priv->buffer_mutex);
@@ -245,7 +245,7 @@ dmap_gst_input_stream_new_buffer_cb (GstElement * element,
}
GInputStream *
-dmap_gst_input_stream_new (const gchar * transcode_mimetype,
+dmap_transcode_stream_new (const gchar * transcode_mimetype,
GInputStream * src_stream)
{
GInputStream *stream;
@@ -253,13 +253,13 @@ dmap_gst_input_stream_new (const gchar * transcode_mimetype,
if (!transcode_mimetype) {
stream = src_stream;
} else if (!strcmp (transcode_mimetype, "audio/mp3")) {
- stream = G_INPUT_STREAM (dmap_gst_mp3_input_stream_new
+ stream = G_INPUT_STREAM (dmap_transcode_mp3_stream_new
(src_stream));
} else if (!strcmp (transcode_mimetype, "audio/wav")) {
- stream = G_INPUT_STREAM (dmap_gst_wav_input_stream_new
+ stream = G_INPUT_STREAM (dmap_transcode_wav_stream_new
(src_stream));
} else if (!strcmp (transcode_mimetype, "video/quicktime")) {
- stream = G_INPUT_STREAM (dmap_gst_qt_input_stream_new
+ stream = G_INPUT_STREAM (dmap_transcode_qt_stream_new
(src_stream));
} else {
g_warning ("Transcode format %s not supported",
@@ -284,7 +284,7 @@ _read (GInputStream * stream,
G_GNUC_UNUSED GError ** error)
{
gsize i;
- DmapGstInputStream *gst_stream = DMAP_GST_INPUT_STREAM (stream);
+ DmapTranscodeStream *gst_stream = DMAP_TRANSCODE_STREAM (stream);
gint64 end_time;
end_time = g_get_monotonic_time () + QUEUE_POP_WAIT_SECONDS * G_TIME_SPAN_SECOND;
@@ -337,9 +337,9 @@ _skip (G_GNUC_UNUSED GInputStream * stream,
}
static void
-_kill_pipeline (DmapGstInputStream * stream)
+_kill_pipeline (DmapTranscodeStream * stream)
{
- DMAP_GST_INPUT_STREAM_GET_CLASS (stream)->kill_pipeline (stream);
+ DMAP_TRANSCODE_STREAM_GET_CLASS (stream)->kill_pipeline (stream);
}
static gboolean
@@ -347,7 +347,7 @@ _close (GInputStream * stream,
G_GNUC_UNUSED GCancellable * cancellable,
G_GNUC_UNUSED GError ** error)
{
- DmapGstInputStream *gst_stream = DMAP_GST_INPUT_STREAM (stream);
+ DmapTranscodeStream *gst_stream = DMAP_TRANSCODE_STREAM (stream);
_kill_pipeline (gst_stream);
@@ -422,7 +422,7 @@ _close_finish (G_GNUC_UNUSED GInputStream * stream,
}
static void
-dmap_gst_input_stream_class_init (DmapGstInputStreamClass * klass)
+dmap_transcode_stream_class_init (DmapTranscodeStreamClass * klass)
{
GInputStreamClass *istream_class;
@@ -439,7 +439,7 @@ dmap_gst_input_stream_class_init (DmapGstInputStreamClass * klass)
}
static void
-dmap_gst_input_stream_init (DmapGstInputStream * stream)
+dmap_transcode_stream_init (DmapTranscodeStream * stream)
{
stream->priv->buffer = g_queue_new ();
stream->priv->read_request = 0;
@@ -454,8 +454,8 @@ dmap_gst_input_stream_init (DmapGstInputStream * stream)
g_cond_init (&stream->priv->buffer_write_ready);
}
-G_DEFINE_TYPE_WITH_CODE (DmapGstInputStream, dmap_gst_input_stream,
+G_DEFINE_TYPE_WITH_CODE (DmapTranscodeStream, dmap_transcode_stream,
G_TYPE_INPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
_seekable_iface_init)
- G_ADD_PRIVATE (DmapGstInputStream));
+ G_ADD_PRIVATE (DmapTranscodeStream));
diff --git a/libdmapsharing/dmap-transcode-stream.h b/libdmapsharing/dmap-transcode-stream.h
new file mode 100644
index 0000000..10d6129
--- /dev/null
+++ b/libdmapsharing/dmap-transcode-stream.h
@@ -0,0 +1,72 @@
+/*
+ * DmapTranscodeStream class: Open a URI using dmap_transcode_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_TRANSCODE_STREAM_H
+#define _DMAP_TRANSCODE_STREAM_H
+
+#include <gio/gio.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+#define DMAP_TYPE_TRANSCODE_STREAM (dmap_transcode_stream_get_type ())
+#define DMAP_TRANSCODE_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ DMAP_TYPE_TRANSCODE_STREAM, \
+ DmapTranscodeStream))
+#define DMAP_TRANSCODE_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
+ DMAP_TYPE_TRANSCODE_STREAM, \
+ DmapTranscodeStreamClass))
+#define DMAP_IS_TRANSCODE_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ DMAP_TYPE_TRANSCODE_STREAM))
+#define DMAP_IS_TRANSCODE_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+ DMAP_TYPE_TRANSCODE_STREAM_CLASS))
+#define DMAP_TRANSCODE_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+ DMAP_TYPE_TRANSCODE_STREAM, \
+ DmapTranscodeStreamClass))
+typedef struct DmapTranscodeStreamPrivate DmapTranscodeStreamPrivate;
+
+typedef struct {
+ GInputStream parent;
+ DmapTranscodeStreamPrivate *priv;
+} DmapTranscodeStream;
+
+typedef struct {
+ GInputStreamClass parent;
+
+ void (*kill_pipeline) (DmapTranscodeStream *stream);
+} DmapTranscodeStreamClass;
+
+GType dmap_transcode_stream_get_type (void);
+
+/* Supported transcode target formats (data read from DmapTranscodeStream
+ * will be in one of these formats): */
+enum
+{
+ RAW, /* No transcoding performed. */
+ WAV16,
+ MP3
+};
+
+GInputStream *dmap_transcode_stream_new (const gchar * transcode_mimetype,
+ GInputStream * src_stream);
+
+G_END_DECLS
+#endif /* _DMAP_TRANSCODE_STREAM_H */
diff --git a/libdmapsharing/dmap-gst-wav-input-stream.c b/libdmapsharing/dmap-transcode-wav-stream.c
similarity index 86%
rename from libdmapsharing/dmap-gst-wav-input-stream.c
rename to libdmapsharing/dmap-transcode-wav-stream.c
index 47f8499..b6aba78 100644
--- a/libdmapsharing/dmap-gst-wav-input-stream.c
+++ b/libdmapsharing/dmap-transcode-wav-stream.c
@@ -1,5 +1,5 @@
/*
- * DmapGstWavInputStream class: Open a URI using dmap_gst_wav_input_stream_new ().
+ * DmapTranscodeWavStream class: Open a URI using dmap_transcode_wav_stream_new ().
* Data is decoded using GStreamer and is then reencoded as a WAV
* stream by the class's read operations.
*
@@ -23,12 +23,13 @@
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
+#include "dmap-transcode-wav-stream.h"
+#include "dmap-transcode-stream-private.h"
#include "gst-util.h"
-#include "dmap-gst-wav-input-stream.h"
#define GST_APP_MAX_BUFFERS 1024
-struct DmapGstWavInputStreamPrivate
+struct DmapTranscodeWavStreamPrivate
{
GstElement *pipeline;
GstElement *src;
@@ -62,11 +63,11 @@ _pad_added_cb (G_GNUC_UNUSED GstElement * element,
}
GInputStream *
-dmap_gst_wav_input_stream_new (GInputStream * src_stream)
+dmap_transcode_wav_stream_new (GInputStream * src_stream)
{
GstStateChangeReturn sret;
GstState state;
- DmapGstWavInputStream *stream = NULL;
+ DmapTranscodeWavStream *stream = NULL;
GstElement *pipeline = NULL;
GstElement *src = NULL;
@@ -162,13 +163,13 @@ dmap_gst_wav_input_stream_new (GInputStream * src_stream)
goto done;
}
- stream = DMAP_GST_WAV_INPUT_STREAM (g_object_new (DMAP_TYPE_GST_WAV_INPUT_STREAM, NULL));
+ stream = DMAP_TRANSCODE_WAV_STREAM (g_object_new (DMAP_TYPE_GST_WAV_INPUT_STREAM, NULL));
if (NULL == stream) {
goto done;
}
g_assert (G_IS_SEEKABLE (stream));
- g_signal_connect (sink, "new-sample", G_CALLBACK (dmap_gst_input_stream_new_buffer_cb), stream);
+ g_signal_connect (sink, "new-sample", G_CALLBACK (dmap_transcode_stream_new_buffer_cb), stream);
stream->priv->pipeline = gst_object_ref (pipeline);
stream->priv->src = gst_object_ref (src);
@@ -211,31 +212,31 @@ done:
}
static void
-_kill_pipeline (DmapGstInputStream * stream)
+_kill_pipeline (DmapTranscodeStream * stream)
{
- DmapGstWavInputStream *wav_stream =
- DMAP_GST_WAV_INPUT_STREAM (stream);
+ DmapTranscodeWavStream *wav_stream =
+ DMAP_TRANSCODE_WAV_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_WITH_PRIVATE (DmapGstWavInputStream,
- dmap_gst_wav_input_stream,
- DMAP_TYPE_GST_INPUT_STREAM);
+G_DEFINE_TYPE_WITH_PRIVATE (DmapTranscodeWavStream,
+ dmap_transcode_wav_stream,
+ DMAP_TYPE_TRANSCODE_STREAM);
static void
- dmap_gst_wav_input_stream_class_init (DmapGstWavInputStreamClass
+ dmap_transcode_wav_stream_class_init (DmapTranscodeWavStreamClass
* klass)
{
- DmapGstInputStreamClass *parent_class =
- DMAP_GST_INPUT_STREAM_CLASS (klass);
+ DmapTranscodeStreamClass *parent_class =
+ DMAP_TRANSCODE_STREAM_CLASS (klass);
parent_class->kill_pipeline = _kill_pipeline;
}
static void
-dmap_gst_wav_input_stream_init (DmapGstWavInputStream * stream)
+dmap_transcode_wav_stream_init (DmapTranscodeWavStream * stream)
{
- stream->priv = dmap_gst_wav_input_stream_get_instance_private(stream);
+ stream->priv = dmap_transcode_wav_stream_get_instance_private(stream);
}
diff --git a/libdmapsharing/dmap-gst-wav-input-stream.h b/libdmapsharing/dmap-transcode-wav-stream.h
similarity index 61%
rename from libdmapsharing/dmap-gst-wav-input-stream.h
rename to libdmapsharing/dmap-transcode-wav-stream.h
index 31cfba5..20d1224 100644
--- a/libdmapsharing/dmap-gst-wav-input-stream.h
+++ b/libdmapsharing/dmap-transcode-wav-stream.h
@@ -1,5 +1,5 @@
/*
- * DmapGstWavInputStream class: Open a URI using dmap_gst_wav_input_stream_new ().
+ * DmapTranscodeWavStream class: Open a URI using dmap_transcode_wav_stream_new ().
* Data is decoded using GStreamer and is then reencoded as a MP3
* stream by the class's read operations.
*
@@ -20,42 +20,42 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _DMAP_GST_WAV_INPUT_STREAM_H
-#define _DMAP_GST_WAV_INPUT_STREAM_H
+#ifndef _DMAP_TRANSCODE_WAV_STREAM_H
+#define _DMAP_TRANSCODE_WAV_STREAM_H
#include <gio/gio.h>
-#include "dmap-gst-input-stream.h"
+#include "dmap-transcode-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), \
+#define DMAP_TYPE_GST_WAV_INPUT_STREAM (dmap_transcode_wav_stream_get_type ())
+#define DMAP_TRANSCODE_WAV_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), \
+ DmapTranscodeWavStream))
+#define DMAP_TRANSCODE_WAV_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
DMAP_TYPE_GST_WAV_INPUT_STREAM, \
- DmapGstWavInputStreamClass))
+ DmapTranscodeWavStreamClass))
#define DMAP_IS_GST_WAV_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
DMAP_TYPE_GST_WAV_INPUT_STREAM))
#define DMAP_IS_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), \
+#define DMAP_TRANSCODE_WAV_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
DMAP_TYPE_GST_WAV_INPUT_STREAM, \
- DmapGstWavInputStreamClass))
-typedef struct DmapGstWavInputStreamPrivate DmapGstWavInputStreamPrivate;
+ DmapTranscodeWavStreamClass))
+typedef struct DmapTranscodeWavStreamPrivate DmapTranscodeWavStreamPrivate;
typedef struct {
- DmapGstInputStream parent;
- DmapGstWavInputStreamPrivate *priv;
-} DmapGstWavInputStream;
+ DmapTranscodeStream parent;
+ DmapTranscodeWavStreamPrivate *priv;
+} DmapTranscodeWavStream;
typedef struct {
- DmapGstInputStreamClass parent;
-} DmapGstWavInputStreamClass;
+ DmapTranscodeStreamClass parent;
+} DmapTranscodeWavStreamClass;
-GType dmap_gst_wav_input_stream_get_type (void);
+GType dmap_transcode_wav_stream_get_type (void);
-GInputStream *dmap_gst_wav_input_stream_new (GInputStream * stream);
+GInputStream *dmap_transcode_wav_stream_new (GInputStream * stream);
G_END_DECLS
#endif
diff --git a/libdmapsharing/dmap.h b/libdmapsharing/dmap.h
index d6e6876..51e127d 100644
--- a/libdmapsharing/dmap.h
+++ b/libdmapsharing/dmap.h
@@ -9,7 +9,7 @@
#include <libdmapsharing/dmap-container-record.h>
#include <libdmapsharing/dmap-db.h>
#include <libdmapsharing/dmap-enums.h>
-#include <libdmapsharing/dmap-gst-input-stream.h>
+#include <libdmapsharing/dmap-transcode-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 9cd911d..2f09928 100644
--- a/libdmapsharing/gst-util.c
+++ b/libdmapsharing/gst-util.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <gst/gst.h>
-#include "dmap-gst-input-stream.h"
+#include "dmap-transcode-stream.h"
gboolean
gst_util_pads_compatible (GstPad * pad1, GstPad * pad2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]