[rygel-gst-0-10-media-engine] Add a test and fix some linker errors.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel-gst-0-10-media-engine] Add a test and fix some linker errors.
- Date: Mon, 7 Jan 2013 13:20:05 +0000 (UTC)
commit ec3fbf2b4cf9b74b5e7c97dd423edc61fd8ec3d0
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jan 7 14:19:57 2013 +0100
Add a test and fix some linker errors.
.gitignore | 2 +-
Makefile.am | 2 +-
configure.ac | 1 +
src/rygel-gst-data-source.c | 11 ++++++--
src/rygel-gst-media-engine.c | 12 +++++++++-
src/rygel-gst-transcoder.c | 4 ++-
src/rygel-gst-transcoder.h | 2 +
src/rygel-gst-utils.c | 1 +
src/rygel-mp2ts-transcoder.c | 6 ++--
src/rygel-mp2ts-transcoder.h | 2 +-
src/rygel-video-transcoder.c | 2 +
tests/Makefile.am | 12 ++++++++++
tests/test_simple.c | 49 ++++++++++++++++++++++++++++++++++++++++++
13 files changed, 95 insertions(+), 11 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 68a1c87..9a455c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,4 +51,4 @@ po/Makefile.in.in
po/POTFILES
src/rygel-media-engine-gst-0-10.h
src/rygel-media-engine-gst-0-10.vapi
-
+tests/test_simple
diff --git a/Makefile.am b/Makefile.am
index 7b751b2..25f1f0a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src data po
+SUBDIRS = src data tests po
DISTCHECK_CONFIGURE_FLAGS =
diff --git a/configure.ac b/configure.ac
index b903479..f13c4f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ AC_CONFIG_FILES([
Makefile
data/Makefile
src/Makefile
+tests/Makefile
po/Makefile.in
])
AC_OUTPUT
diff --git a/src/rygel-gst-data-source.c b/src/rygel-gst-data-source.c
index cf40632..0e52c3f 100644
--- a/src/rygel-gst-data-source.c
+++ b/src/rygel-gst-data-source.c
@@ -23,6 +23,7 @@
#include "rygel-gst-data-source.h"
#include "rygel-gst-sink.h"
+#include <glib/gi18n-lib.h>
static void rygel_gst_data_source_rygel_data_source_interface_init (RygelDataSourceIface *iface);
@@ -45,7 +46,12 @@ struct _RygelGstDataSourcePrivate {
static RygelDataSourceIface* rygel_gst_data_source_rygel_data_source_parent_iface = NULL;
-GQuark rygel_gst_data_source_error_quark (void);
+GQuark
+rygel_gst_error_quark (void) {
+ return g_quark_from_static_string ("rygel_gst_error-quark");
+}
+
+
#define RYGEL_GST_DATA_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_GST_DATA_SOURCE, RygelGstDataSourcePrivate))
static void rygel_gst_data_source_real_start (RygelDataSource *base, RygelHTTPSeek* offsets, GError **error);
@@ -310,7 +316,7 @@ static void
rygel_gst_data_source_prepare_pipeline (RygelGstDataSource* self, const gchar *name, GstElement* src, GError **error) {
self->priv->sink = rygel_gst_sink_new (self, self->priv->seek);
- self->priv->pipeline = GST_PIPLINE (gst_pipeline_new (name));
+ self->priv->pipeline = GST_PIPELINE (gst_pipeline_new (name));
if(self->priv->pipeline == NULL) {
g_set_error (error,
RYGEL_DATA_SOURCE_ERROR,
@@ -444,7 +450,6 @@ rygel_gst_data_source_finalize (GObject* obj) {
* @self: A #RygelGstDataSource
*
* Retrieves the underyling GStreamer element, for use by
- * #RygelGstTranscoder's create_element() implementation.
*
* Return value: a #GstElement
*/
diff --git a/src/rygel-gst-media-engine.c b/src/rygel-gst-media-engine.c
index 2e173b4..93cf1df 100644
--- a/src/rygel-gst-media-engine.c
+++ b/src/rygel-gst-media-engine.c
@@ -35,6 +35,8 @@ struct _RygelGstMediaEnginePrivate {
GList *transcoders;
};
+#define RYGEL_GST_MEDIA_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_GST_MEDIA_ENGINE, RygelGstMediaEnginePrivate))
+
static void rygel_gst_media_engine_finalize (GObject *obj);
static RygelGstMediaEngine*
@@ -77,7 +79,7 @@ rygel_gst_media_engine_construct (GType object_type) {
self->priv->dlna_profiles = g_list_reverse (self->priv->dlna_profiles);
- /* All some transcoders to be disabled by the Rygel Server configuration.
+ /* Allow some transcoders to be disabled by the Rygel Server configuration.
* For instance, some DLNA Renderers might incorrectly prefer inferior transcoded formats,
* sometimes even preferring transcoded formats over the original data,
* so this forces them to use other formats.
@@ -98,6 +100,14 @@ rygel_gst_media_engine_construct (GType object_type) {
if (!transcoder_list) {
transcoder_list = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
+
+ /* Start with some defaults, at least for testing: */
+ gee_abstract_collection_add (transcoder_list, "lpcm");
+ gee_abstract_collection_add (transcoder_list, "mp3");
+ gee_abstract_collection_add (transcoder_list, "mp2ts");
+ gee_abstract_collection_add (transcoder_list, "wmv");
+ gee_abstract_collection_add (transcoder_list, "aac");
+ gee_abstract_collection_add (transcoder_list, "avc");
}
gint transcoder_size = gee_abstract_collection_get_size (transcoder_list);
diff --git a/src/rygel-gst-transcoder.c b/src/rygel-gst-transcoder.c
index d683596..eed1f24 100644
--- a/src/rygel-gst-transcoder.c
+++ b/src/rygel-gst-transcoder.c
@@ -40,11 +40,13 @@ struct _RygelGstTranscoderPrivate {
gboolean link_failed;
};
+#define RYGEL_GST_TRANSCODER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_GST_TRANSCODER, RygelGstTranscoderPrivate))
+
static void rygel_gst_transcoder_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void rygel_gst_transcoder_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
static void rygel_gst_transcoder_finalize (GObject* obj);
-static RygelGstTranscoder*
+RygelGstTranscoder*
rygel_gst_transcoder_construct (GType object_type, const gchar *mime_type, const gchar *dlna_profile, const gchar *extension) {
RygelGstTranscoder *self;
diff --git a/src/rygel-gst-transcoder.h b/src/rygel-gst-transcoder.h
index bcd415e..2786053 100644
--- a/src/rygel-gst-transcoder.h
+++ b/src/rygel-gst-transcoder.h
@@ -59,6 +59,8 @@ GType rygel_gst_transcoder_get_type (void) G_GNUC_CONST;
RygelGstTranscoder* rygel_gst_transcoder_new (void);
+RygelGstTranscoder* rygel_gst_transcoder_construct (GType object_type, const gchar *mime_type, const gchar *dlna_profile, const gchar *extension);
+
GstEncodingProfile* rygel_gst_transcoder_get_encoding_profile (RygelGstTranscoder *self);
const gchar *rygel_gst_transcoder_get_preset (RygelGstTranscoder *self);
void rygel_gst_transcoder_set_preset (RygelGstTranscoder *self, const gchar *value);
diff --git a/src/rygel-gst-utils.c b/src/rygel-gst-utils.c
index dee58ed..3b6cb7d 100644
--- a/src/rygel-gst-utils.c
+++ b/src/rygel-gst-utils.c
@@ -29,6 +29,7 @@
#include <gobject/gvaluecollector.h>
#include "rygel-gst-data-source.h"
#include "rygel-gst-utils.h"
+#include <glib/gi18n-lib.h>
static gboolean rygel_gst_utils_need_rtp_depayloader (GstCaps* caps);
diff --git a/src/rygel-mp2ts-transcoder.c b/src/rygel-mp2ts-transcoder.c
index a45c556..5e5f7ee 100644
--- a/src/rygel-mp2ts-transcoder.c
+++ b/src/rygel-mp2ts-transcoder.c
@@ -134,17 +134,17 @@ rygel_mp2_ts_transcoder_real_get_distance (RygelTranscoder *base, RygelMediaItem
video_item = RYGEL_VIDEO_ITEM (item);
distance = 0;
- bitrate = rygel_video_item_get_bits_per_sample (video_item);
+ bitrate = rygel_audio_item_get_bits_per_sample (RYGEL_AUDIO_ITEM (video_item));
if(bitrate > 0) {
distance += abs(bitrate - RYGEL_MP2_TS_TRANSCODER_VIDEO_BITRATE);
}
- width = rygel_video_item_get_width (video_item);
+ width = rygel_visual_item_get_width (RYGEL_VISUAL_ITEM (video_item));
if(width > 0) {
distance += abs(width - RYGEL_MP2_TS_TRANSCODER_WIDTH[self->priv->profile]);
}
- height = rygel_video_item_get_height (video_item);
+ height = rygel_visual_item_get_height (RYGEL_VISUAL_ITEM (video_item));
if(height > 0) {
distance += abs(height - RYGEL_MP2_TS_TRANSCODER_HEIGHT[self->priv->profile]);
}
diff --git a/src/rygel-mp2ts-transcoder.h b/src/rygel-mp2ts-transcoder.h
index 589f873..932b39b 100644
--- a/src/rygel-mp2ts-transcoder.h
+++ b/src/rygel-mp2ts-transcoder.h
@@ -34,7 +34,7 @@
G_BEGIN_DECLS
-#define RYGEL_TYPE_MP2_TS_TRANSCODER (rygel_gst_mp2_ts_transcoder_get_type ())
+#define RYGEL_TYPE_MP2_TS_TRANSCODER (rygel_mp2_ts_transcoder_get_type ())
#define RYGEL_MP2_TS_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MP2_TS_TRANSCODER, RygelMP2TSTranscoder))
#define RYGEL_MP2_TS_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MP2_TS_TRANSCODER, RygelMP2TSTranscoderClass))
#define RYGEL_IS_MP2_TS_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MP2_TS_TRANSCODER))
diff --git a/src/rygel-video-transcoder.c b/src/rygel-video-transcoder.c
index cba8be1..f7dedfc 100644
--- a/src/rygel-video-transcoder.c
+++ b/src/rygel-video-transcoder.c
@@ -35,6 +35,8 @@ struct _RygelVideoTranscoderPrivate {
GstCaps* video_restrictions;
};
+#define RYGEL_VIDEO_TRANSCODER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_VIDEO_TRANSCODER, RygelGstTranscoderPrivate))
+
static void rygel_video_transcoder_finalize (GObject* obj);
RygelVideoTranscoder*
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..87545cc
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,12 @@
+noinst_PROGRAMS = test_simple
+test_simple_SOURCES = test_simple.c
+test_simple_CFLAGS = \
+ $(DEPS_CFLAGS) \
+ -I$(top_builddir)/src -I$(top_srcdir)/src
+test_simple_LDADD = \
+ $(DEPS_LIBS) \
+ $(top_builddir)/src/librygel-media-engine-gst-0-10.la
+
+
+check_PROGRAMS = test_simple
+TESTS = test_simple
diff --git a/tests/test_simple.c b/tests/test_simple.c
new file mode 100644
index 0000000..5723728
--- /dev/null
+++ b/tests/test_simple.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Intel Corporation
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel 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 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel 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 program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "rygel-gst-media-engine.h"
+
+int main(int argc, char *argv[])
+{
+ g_type_init ();
+ gst_init (&argc, &argv);
+
+ /* Some very simple checks that the media engine can be instantiated
+ * and used in very simple ways.
+ */
+ RygelMediaEngine *media_engine = module_get_instance ();
+ g_assert (media_engine);
+
+ g_assert (RYGEL_GST_MEDIA_ENGINE (media_engine));
+
+ RygelDataSource *data_source = NULL; /* TODO: rygel_media_engine_create_data_source (media_engine, NULL);
+ g_assert (data_source); */
+
+ GList* dlna_profiles = rygel_media_engine_get_dlna_profiles (media_engine);
+ g_assert (dlna_profiles);
+
+ GList* transcoders = rygel_media_engine_get_transcoders (media_engine);
+ g_assert (transcoders);
+
+ g_object_unref (data_source);
+ g_object_unref (media_engine);
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]