[libdmapsharing] Export dmap_mime_to_format



commit b984744dfadb2a395d8896eebea66cdea16d2e78
Author: W. Michael Petullo <mike flyn org>
Date:   Tue Jun 25 22:27:05 2013 -0500

    Export dmap_mime_to_format
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/Makefile.am                         |    4 +++-
 libdmapsharing/daap-share.c                        |   20 +++-----------------
 libdmapsharing/dmap-gst-input-stream.c             |    6 ++----
 libdmapsharing/dmap-gst-mp3-input-stream.c         |    9 +++------
 .../{dmap-utils.c => dmap-private-utils.c}         |    2 +-
 .../{dmap-utils.h => dmap-private-utils.h}         |    8 ++++----
 libdmapsharing/dmap-structure.c                    |    2 +-
 libdmapsharing/dpap-share.c                        |    2 +-
 8 files changed, 18 insertions(+), 35 deletions(-)
---
diff --git a/libdmapsharing/Makefile.am b/libdmapsharing/Makefile.am
index f461991..b2c5a08 100644
--- a/libdmapsharing/Makefile.am
+++ b/libdmapsharing/Makefile.am
@@ -15,6 +15,7 @@ libdmapsharing_3_0_la_SOURCES = \
        dmap-container-record.c \
        dmap-db.c \
        dmap-md5.c \
+       dmap-private-utils.c \
        dmap-record.c \
        dmap-record-factory.c \
        dmap-share.c \
@@ -91,6 +92,7 @@ libdmapsharinginclude_HEADERS = \
        dmap-record-factory.h \
        dmap-share.h \
        dmap-structure.h \
+       dmap-utils.h \
        dpap-connection.h \
        dpap-record.h \
        dpap-share.h
@@ -99,7 +101,7 @@ noinst_HEADERS = \
        dmap-marshal.h \
        dmap-config.h \
        dmap-mdns-avahi.h \
-       dmap-utils.h \
+       dmap-private-utils.h \
        dmap-gst-mp3-input-stream.h \
        dmap-gst-qt-input-stream.h \
        dmap-gst-wav-input-stream.h \
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index 9e9a8c9..877a2e0 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -36,6 +36,7 @@
 
 #include <libdmapsharing/dmap.h>
 #include <libdmapsharing/dmap-structure.h>
+#include <libdmapsharing/dmap-private-utils.h>
 #include <libdmapsharing/dmap-utils.h>
 
 #ifdef HAVE_GSTREAMERAPP
@@ -154,21 +155,6 @@ daap_share_dispose (GObject * object)
        /* FIXME: implement in parent */
 }
 
-static gchar *
-mime_to_format (const gchar * transcode_mimetype)
-{
-       if (!transcode_mimetype) {
-               return NULL;
-       } else if (!strcmp (transcode_mimetype, "audio/wav")) {
-               return g_strdup ("wav");
-       } else if (!strcmp (transcode_mimetype, "audio/mp3")) {
-               return g_strdup ("mp3");
-       } else if (!strcmp (transcode_mimetype, "video/quicktime")) {
-               return g_strdup ("mp4");
-       } else
-               return NULL;
-}
-
 DAAPShare *
 daap_share_new (const char *name,
                const char *password,
@@ -423,7 +409,7 @@ send_chunked_file (SoupServer * server, SoupMessage * message,
        char *format2 = NULL;
        if (has_video 
            || transcode_mimetype == NULL
-           || (format2 = mime_to_format (transcode_mimetype)) && !strcmp (format, format2)) {
+           || (format2 = dmap_mime_to_format (transcode_mimetype)) && !strcmp (format, format2)) {
                g_debug ("Not transcoding");
                cd->stream = stream;
 #ifdef HAVE_GSTREAMERAPP
@@ -625,7 +611,7 @@ add_entry_to_mlcl (gpointer id, DMAPRecord * record, gpointer _mb)
                              &transcode_mimetype, NULL);
                // Not presently transcoding videos (see also same comments elsewhere).
                if (! has_video && transcode_mimetype) {
-                       format = g_strdup (mime_to_format
+                       format = g_strdup (dmap_mime_to_format
                                           (transcode_mimetype));
                        g_free (transcode_mimetype);
                } else {
diff --git a/libdmapsharing/dmap-gst-input-stream.c b/libdmapsharing/dmap-gst-input-stream.c
index ecb07af..91deec6 100644
--- a/libdmapsharing/dmap-gst-input-stream.c
+++ b/libdmapsharing/dmap-gst-input-stream.c
@@ -327,14 +327,12 @@ dmap_gst_input_stream_read (GInputStream * stream,
                /* Depending on timing, more data may have been written
                 * since check: do not pull more than count:
                 */
-               count = min (count,
-                            g_queue_get_length (gst_stream->priv->buffer));
+               count = min (count, g_queue_get_length (gst_stream->priv->buffer));
        }
 
        for (i = 0; i < count; i++) {
                ((guint8 *) buffer)[i] =
-                       GPOINTER_TO_INT (g_queue_pop_head
-                                        (gst_stream->priv->buffer));
+                       GPOINTER_TO_INT (g_queue_pop_head (gst_stream->priv->buffer));
        }
 
        if (gst_stream->priv->write_request > count)
diff --git a/libdmapsharing/dmap-gst-mp3-input-stream.c b/libdmapsharing/dmap-gst-mp3-input-stream.c
index dc60af2..234fa74 100644
--- a/libdmapsharing/dmap-gst-mp3-input-stream.c
+++ b/libdmapsharing/dmap-gst-mp3-input-stream.c
@@ -80,12 +80,10 @@ dmap_gst_mp3_input_stream_new (GInputStream * src_stream)
        stream->priv->src = gst_element_factory_make ("giostreamsrc", "src");
        g_assert (GST_IS_ELEMENT (stream->priv->src));
 
-       stream->priv->decode =
-               gst_element_factory_make ("decodebin", "decode");
+       stream->priv->decode = gst_element_factory_make ("decodebin", "decode");
        g_assert (GST_IS_ELEMENT (stream->priv->decode));
 
-       stream->priv->convert =
-               gst_element_factory_make ("audioconvert", "convert");
+       stream->priv->convert = gst_element_factory_make ("audioconvert", "convert");
        g_assert (GST_IS_ELEMENT (stream->priv->convert));
 
        stream->priv->audio_encode = gst_element_factory_make ("lamemp3enc", "audioencode");
@@ -128,8 +126,7 @@ dmap_gst_mp3_input_stream_new (GInputStream * src_stream)
 
        g_object_set (G_OBJECT (stream->priv->sink), "emit-signals", TRUE,
                      "sync", FALSE, NULL);
-       gst_app_sink_set_max_buffers (GST_APP_SINK (stream->priv->sink),
-                                     GST_APP_MAX_BUFFERS);
+       gst_app_sink_set_max_buffers (GST_APP_SINK (stream->priv->sink), GST_APP_MAX_BUFFERS);
        gst_app_sink_set_drop (GST_APP_SINK (stream->priv->sink), FALSE);
 
        g_signal_connect (stream->priv->sink, "new-sample",
diff --git a/libdmapsharing/dmap-utils.c b/libdmapsharing/dmap-private-utils.c
similarity index 98%
rename from libdmapsharing/dmap-utils.c
rename to libdmapsharing/dmap-private-utils.c
index 7323df4..ede3685 100644
--- a/libdmapsharing/dmap-utils.c
+++ b/libdmapsharing/dmap-private-utils.c
@@ -20,7 +20,7 @@
 
 #include <string.h>
 
-#include "dmap-utils.h"
+#include "dmap-private-utils.h"
 
 #define DMAP_SHARE_CHUNK_SIZE 16384
 
diff --git a/libdmapsharing/dmap-utils.h b/libdmapsharing/dmap-private-utils.h
similarity index 91%
rename from libdmapsharing/dmap-utils.h
rename to libdmapsharing/dmap-private-utils.h
index 72c6f93..b0a6acc 100644
--- a/libdmapsharing/dmap-utils.h
+++ b/libdmapsharing/dmap-private-utils.h
@@ -17,8 +17,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA*
  */
 
-#ifndef __DMAP_UTILS_H__
-#define __DMAP_UTILS_H__
+#ifndef __DMAP_PRIVATE_UTILS_H__
+#define __DMAP_PRIVATE_UTILS_H__
 
 #include <glib.h>
 #include <libsoup/soup.h>
@@ -61,8 +61,8 @@ G_BEGIN_DECLS
        GInputStream *stream;
 } ChunkData;
 
-void dmap_write_next_chunk (SoupMessage * message, ChunkData * cd);
-void dmap_chunked_message_finished (SoupMessage * message, ChunkData * cd);
+void   dmap_write_next_chunk (SoupMessage * message, ChunkData * cd);
+void   dmap_chunked_message_finished (SoupMessage * message, ChunkData * cd);
 
 G_END_DECLS
 #endif
diff --git a/libdmapsharing/dmap-structure.c b/libdmapsharing/dmap-structure.c
index 545d17d..c8e10c6 100644
--- a/libdmapsharing/dmap-structure.c
+++ b/libdmapsharing/dmap-structure.c
@@ -19,7 +19,7 @@
  */
 
 #include "dmap-structure.h"
-#include "dmap-utils.h"
+#include "dmap-private-utils.h"
 
 #include <glib.h>
 #include <glib-object.h>
diff --git a/libdmapsharing/dpap-share.c b/libdmapsharing/dpap-share.c
index 8ba19a3..72ef344 100644
--- a/libdmapsharing/dpap-share.c
+++ b/libdmapsharing/dpap-share.c
@@ -41,7 +41,7 @@
 #include <libsoup/soup-server.h>
 
 #include <libdmapsharing/dmap.h>
-#include <libdmapsharing/dmap-utils.h>
+#include <libdmapsharing/dmap-private-utils.h>
 #include <libdmapsharing/dmap-structure.h>
 
 static void dpap_share_set_property (GObject * object,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]