[gupnp-dlna/wip/new-api: 36/48] Move info set to main source directory.
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-dlna/wip/new-api: 36/48] Move info set to main source directory.
- Date: Wed, 16 Jan 2013 10:43:41 +0000 (UTC)
commit 019e04fdfb58bfa64e35d00430fbcc5a1a8ac4ae
Author: Krzesimir Nowak <krnowak openismus com>
Date: Thu Jan 3 15:22:31 2013 +0100
Move info set to main source directory.
libgupnp-dlna/Makefile.am | 6 +-
...lna-native-info-set.c => gupnp-dlna-info-set.c} | 116 +++++++---------
libgupnp-dlna/gupnp-dlna-info-set.h | 87 ++++++++++++
libgupnp-dlna/gupnp-dlna-profile-guesser-impl.c | 120 ++++++++---------
.../native/sets/gupnp-dlna-native-info-set.h | 92 ------------
libgupnp-dlna/profile-backends/native/sets/sets.am | 4 +-
tests/sets.c | 146 +++++++++----------
7 files changed, 269 insertions(+), 302 deletions(-)
---
diff --git a/libgupnp-dlna/Makefile.am b/libgupnp-dlna/Makefile.am
index 54fcd69..ccbca07 100644
--- a/libgupnp-dlna/Makefile.am
+++ b/libgupnp-dlna/Makefile.am
@@ -123,7 +123,8 @@ libgupnp_dlna_2_0_la_SOURCES = \
gupnp-dlna-utils.c \
gupnp-dlna-value-type.c \
gupnp-dlna-info-value.c \
- gupnp-dlna-value.c
+ gupnp-dlna-value.c \
+ gupnp-dlna-info-set.c
libgupnp_dlna_2_0_la_LIBADD = \
$(gupnp_libadd) \
libloader.la \
@@ -166,7 +167,8 @@ dist_noinst_HEADERS += \
gupnp-dlna-value-union.h \
gupnp-dlna-value-type.h \
gupnp-dlna-info-value.h \
- gupnp-dlna-value.h
+ gupnp-dlna-value.h \
+ gupnp-dlna-info-set.h
# INTROSPECTION
diff --git a/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-info-set.c b/libgupnp-dlna/gupnp-dlna-info-set.c
similarity index 63%
rename from libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-info-set.c
rename to libgupnp-dlna/gupnp-dlna-info-set.c
index cbca254..6504623 100644
--- a/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-info-set.c
+++ b/libgupnp-dlna/gupnp-dlna-info-set.c
@@ -21,23 +21,23 @@
#include <glib.h>
-#include "gupnp-dlna-native-info-set.h"
+#include "gupnp-dlna-info-set.h"
#include "gupnp-dlna-info-value.h"
#include "gupnp-dlna-value-list-private.h"
-struct _GUPnPDLNANativeInfoSet {
+struct _GUPnPDLNAInfoSet {
gchar *mime;
GHashTable *entries; /* <gchar *, GUPnPDLNAInfoValue *> */
};
-GUPnPDLNANativeInfoSet *
-gupnp_dlna_native_info_set_new (const gchar *mime)
+GUPnPDLNAInfoSet *
+gupnp_dlna_info_set_new (const gchar *mime)
{
- GUPnPDLNANativeInfoSet *info_set;
+ GUPnPDLNAInfoSet *info_set;
g_return_val_if_fail (mime != NULL, NULL);
- info_set = g_slice_new (GUPnPDLNANativeInfoSet);
+ info_set = g_slice_new (GUPnPDLNAInfoSet);
info_set->mime = g_strdup (mime);
info_set->entries = g_hash_table_new_full
(g_str_hash,
@@ -49,18 +49,18 @@ gupnp_dlna_native_info_set_new (const gchar *mime)
}
void
-gupnp_dlna_native_info_set_free (GUPnPDLNANativeInfoSet *info_set)
+gupnp_dlna_info_set_free (GUPnPDLNAInfoSet *info_set)
{
if (info_set == NULL)
return;
g_free (info_set->mime);
g_hash_table_unref (info_set->entries);
- g_slice_free (GUPnPDLNANativeInfoSet, info_set);
+ g_slice_free (GUPnPDLNAInfoSet, info_set);
}
static gboolean
-insert_value (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
+insert_value (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
GUPnPDLNAInfoValue *value)
{
if (value == NULL) {
@@ -81,9 +81,9 @@ insert_value (GUPnPDLNANativeInfoSet *info_set,
}
gboolean
-gupnp_dlna_native_info_set_add_bool (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- gboolean value)
+gupnp_dlna_info_set_add_bool (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ gboolean value)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
@@ -94,53 +94,48 @@ gupnp_dlna_native_info_set_add_bool (GUPnPDLNANativeInfoSet *info_set,
}
gboolean
-gupnp_dlna_native_info_set_add_unsupported_bool
- (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name)
+gupnp_dlna_info_set_add_unsupported_bool (GUPnPDLNAInfoSet *info_set,
+ const gchar *name)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
- return insert_value
- (info_set,
- name,
- gupnp_dlna_info_value_new_unsupported_bool ());
+ return insert_value (info_set,
+ name,
+ gupnp_dlna_info_value_new_unsupported_bool ());
}
gboolean
-gupnp_dlna_native_info_set_add_fraction (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- gint numerator,
- gint denominator)
+gupnp_dlna_info_set_add_fraction (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ gint numerator,
+ gint denominator)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
return insert_value (info_set,
name,
- gupnp_dlna_info_value_new_fraction
- (numerator,
- denominator));
+ gupnp_dlna_info_value_new_fraction (numerator,
+ denominator));
}
gboolean
-gupnp_dlna_native_info_set_add_unsupported_fraction
- (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name)
+gupnp_dlna_info_set_add_unsupported_fraction (GUPnPDLNAInfoSet *info_set,
+ const gchar *name)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
- return insert_value
- (info_set,
- name,
- gupnp_dlna_info_value_new_unsupported_fraction ());
+ return insert_value (info_set,
+ name,
+ gupnp_dlna_info_value_new_unsupported_fraction ());
}
gboolean
-gupnp_dlna_native_info_set_add_int (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- gint value)
+gupnp_dlna_info_set_add_int (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ gint value)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
@@ -151,23 +146,21 @@ gupnp_dlna_native_info_set_add_int (GUPnPDLNANativeInfoSet *info_set,
}
gboolean
-gupnp_dlna_native_info_set_add_unsupported_int
- (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name)
+gupnp_dlna_info_set_add_unsupported_int (GUPnPDLNAInfoSet *info_set,
+ const gchar *name)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
- return insert_value
- (info_set,
- name,
- gupnp_dlna_info_value_new_unsupported_int ());
+ return insert_value (info_set,
+ name,
+ gupnp_dlna_info_value_new_unsupported_int ());
}
gboolean
-gupnp_dlna_native_info_set_add_string (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- const gchar *value)
+gupnp_dlna_info_set_add_string (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ const gchar *value)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
@@ -179,23 +172,20 @@ gupnp_dlna_native_info_set_add_string (GUPnPDLNANativeInfoSet *info_set,
}
gboolean
-gupnp_dlna_native_info_set_add_unsupported_string
- (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name)
+gupnp_dlna_info_set_add_unsupported_string (GUPnPDLNAInfoSet *info_set,
+ const gchar *name)
{
g_return_val_if_fail (info_set != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
- return insert_value
- (info_set,
- name,
- gupnp_dlna_info_value_new_unsupported_string ());
+ return insert_value (info_set,
+ name,
+ gupnp_dlna_info_value_new_unsupported_string ());
}
gboolean
-gupnp_dlna_native_info_set_fits_restriction
- (GUPnPDLNANativeInfoSet *info_set,
- GUPnPDLNARestriction *restriction)
+gupnp_dlna_info_set_fits_restriction (GUPnPDLNAInfoSet *info_set,
+ GUPnPDLNARestriction *restriction)
{
GHashTableIter iter;
gpointer key;
@@ -225,8 +215,8 @@ gupnp_dlna_native_info_set_fits_restriction
return FALSE;
value_list = (GUPnPDLNAValueList *) value;
if (!gupnp_dlna_value_list_is_superset (value_list,
- info_value,
- &unsupported))
+ info_value,
+ &unsupported))
return FALSE;
else if (unsupported)
unsupported_match = TRUE;
@@ -240,7 +230,7 @@ gupnp_dlna_native_info_set_fits_restriction
}
static gboolean
-gupnp_dlna_native_info_set_is_empty (GUPnPDLNANativeInfoSet *info_set)
+gupnp_dlna_info_set_is_empty (GUPnPDLNAInfoSet *info_set)
{
g_return_val_if_fail (info_set != NULL, TRUE);
@@ -249,7 +239,7 @@ gupnp_dlna_native_info_set_is_empty (GUPnPDLNANativeInfoSet *info_set)
}
gchar *
-gupnp_dlna_native_info_set_to_string (GUPnPDLNANativeInfoSet *info_set)
+gupnp_dlna_info_set_to_string (GUPnPDLNAInfoSet *info_set)
{
GString *str;
GHashTableIter iter;
@@ -258,7 +248,7 @@ gupnp_dlna_native_info_set_to_string (GUPnPDLNANativeInfoSet *info_set)
g_return_val_if_fail (info_set != NULL, NULL);
- if (gupnp_dlna_native_info_set_is_empty (info_set))
+ if (gupnp_dlna_info_set_is_empty (info_set))
return g_strdup ("EMPTY");
str = g_string_new (info_set->mime ? info_set->mime : "(null)");
@@ -274,7 +264,7 @@ gupnp_dlna_native_info_set_to_string (GUPnPDLNANativeInfoSet *info_set)
}
const gchar *
-gupnp_dlna_native_info_set_get_mime (GUPnPDLNANativeInfoSet *info_set)
+gupnp_dlna_info_set_get_mime (GUPnPDLNAInfoSet *info_set)
{
g_return_val_if_fail (info_set != NULL, NULL);
diff --git a/libgupnp-dlna/gupnp-dlna-info-set.h b/libgupnp-dlna/gupnp-dlna-info-set.h
new file mode 100644
index 0000000..3153116
--- /dev/null
+++ b/libgupnp-dlna/gupnp-dlna-info-set.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012, 2013 Intel Corporation.
+ *
+ * Authors: Krzesimir Nowak <krnowak openismus com>
+ *
+ * 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 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 Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GUPNP_DLNA_INFO_SET_H__
+#define __GUPNP_DLNA_INFO_SET_H__
+
+#include <glib.h>
+#include "gupnp-dlna-restriction.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GUPnPDLNAInfoSet GUPnPDLNAInfoSet;
+
+GUPnPDLNAInfoSet *
+gupnp_dlna_info_set_new (const gchar *mime);
+
+void
+gupnp_dlna_info_set_free (GUPnPDLNAInfoSet *info_set);
+
+gboolean
+gupnp_dlna_info_set_add_bool (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ gboolean value);
+
+gboolean
+gupnp_dlna_info_set_add_unsupported_bool (GUPnPDLNAInfoSet *info_set,
+ const gchar *name);
+
+gboolean
+gupnp_dlna_info_set_add_fraction (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ gint numerator,
+ gint denominator);
+
+gboolean
+gupnp_dlna_info_set_add_unsupported_fraction (GUPnPDLNAInfoSet *info_set,
+ const gchar *name);
+
+gboolean
+gupnp_dlna_info_set_add_int (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ gint value);
+
+gboolean
+gupnp_dlna_info_set_add_unsupported_int (GUPnPDLNAInfoSet *info_set,
+ const gchar *name);
+
+gboolean
+gupnp_dlna_info_set_add_string (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ const gchar *value);
+
+gboolean
+gupnp_dlna_info_set_add_unsupported_string (GUPnPDLNAInfoSet *info_set,
+ const gchar *name);
+
+gboolean
+gupnp_dlna_info_set_fits_restriction (GUPnPDLNAInfoSet *info_set,
+ GUPnPDLNARestriction *restriction);
+
+gchar *
+gupnp_dlna_info_set_to_string (GUPnPDLNAInfoSet *info_set);
+
+const gchar *
+gupnp_dlna_info_set_get_mime (GUPnPDLNAInfoSet *info_set);
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_INFO_SET_H__ */
diff --git a/libgupnp-dlna/gupnp-dlna-profile-guesser-impl.c b/libgupnp-dlna/gupnp-dlna-profile-guesser-impl.c
index 4707be3..8b6f26a 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-guesser-impl.c
+++ b/libgupnp-dlna/gupnp-dlna-profile-guesser-impl.c
@@ -31,7 +31,7 @@
#include "gupnp-dlna-image-information.h"
#include "gupnp-dlna-video-information.h"
#include "gupnp-dlna-utils.h"
-#include "gupnp-dlna-native-info-set.h"
+#include "gupnp-dlna-info-set.h"
static gboolean
is_video_profile (GUPnPDLNAProfile *profile)
@@ -45,9 +45,9 @@ is_video_profile (GUPnPDLNAProfile *profile)
}
static gboolean
-match_profile (GUPnPDLNAProfile *profile,
- GUPnPDLNANativeInfoSet *stream_info_set,
- GList *profile_restrictions)
+match_profile (GUPnPDLNAProfile *profile,
+ GUPnPDLNAInfoSet *stream_info_set,
+ GList *profile_restrictions)
{
const gchar *name = gupnp_dlna_profile_get_name (profile);
GList *iter;
@@ -64,7 +64,7 @@ match_profile (GUPnPDLNAProfile *profile,
return FALSE;
}
- stream_dump = gupnp_dlna_native_info_set_to_string (stream_info_set);
+ stream_dump = gupnp_dlna_info_set_to_string (stream_info_set);
restrictions_dump = gupnp_dlna_utils_restrictions_list_to_string
(profile_restrictions);
g_debug ("Stream: %s\nRestrictions: %s",
@@ -78,9 +78,8 @@ match_profile (GUPnPDLNAProfile *profile,
GUPNP_DLNA_RESTRICTION (iter->data);
if (restriction != NULL &&
- gupnp_dlna_native_info_set_fits_restriction
- (stream_info_set,
- restriction))
+ gupnp_dlna_info_set_fits_restriction (stream_info_set,
+ restriction))
return TRUE;
}
@@ -88,16 +87,14 @@ match_profile (GUPnPDLNAProfile *profile,
}
static void
-add_bool (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- GUPnPDLNABoolValue value,
- const gchar *type)
+add_bool (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ GUPnPDLNABoolValue value,
+ const gchar *type)
{
switch (value.state) {
case GUPNP_DLNA_VALUE_STATE_SET:
- if (!gupnp_dlna_native_info_set_add_bool (info_set,
- name,
- value.value))
+ if (!gupnp_dlna_info_set_add_bool (info_set, name, value.value))
g_warning ("Failed to add '%s' bool value (%s) to %s "
"info set.",
name,
@@ -108,8 +105,7 @@ add_bool (GUPnPDLNANativeInfoSet *info_set,
case GUPNP_DLNA_VALUE_STATE_UNSET:
break;
case GUPNP_DLNA_VALUE_STATE_UNSUPPORTED:
- if (!gupnp_dlna_native_info_set_add_unsupported_bool (info_set,
- name))
+ if (!gupnp_dlna_info_set_add_unsupported_bool (info_set, name))
g_warning ("Failed to add '%s' bool unsupported value"
" to %s info set.",
name,
@@ -122,18 +118,17 @@ add_bool (GUPnPDLNANativeInfoSet *info_set,
}
static void
-add_fraction (GUPnPDLNANativeInfoSet *info_set,
+add_fraction (GUPnPDLNAInfoSet *info_set,
const gchar *name,
GUPnPDLNAFractionValue value,
const gchar *type)
{
switch (value.state) {
case GUPNP_DLNA_VALUE_STATE_SET:
- if (!gupnp_dlna_native_info_set_add_fraction
- (info_set,
- name,
- value.numerator,
- value.denominator))
+ if (!gupnp_dlna_info_set_add_fraction (info_set,
+ name,
+ value.numerator,
+ value.denominator))
g_warning ("Failed to add '%s' fraction value (%d/%d)"
" to %s info set.",
name,
@@ -145,9 +140,8 @@ add_fraction (GUPnPDLNANativeInfoSet *info_set,
case GUPNP_DLNA_VALUE_STATE_UNSET:
break;
case GUPNP_DLNA_VALUE_STATE_UNSUPPORTED:
- if (!gupnp_dlna_native_info_set_add_unsupported_fraction
- (info_set,
- name))
+ if (!gupnp_dlna_info_set_add_unsupported_fraction (info_set,
+ name))
g_warning ("Failed to add '%s' fraction unsupported"
" value to %s info set.",
name,
@@ -160,16 +154,14 @@ add_fraction (GUPnPDLNANativeInfoSet *info_set,
}
static void
-add_int (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- GUPnPDLNAIntValue value,
- const gchar *type)
+add_int (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ GUPnPDLNAIntValue value,
+ const gchar *type)
{
switch (value.state) {
case GUPNP_DLNA_VALUE_STATE_SET:
- if (!gupnp_dlna_native_info_set_add_int (info_set,
- name,
- value.value))
+ if (!gupnp_dlna_info_set_add_int (info_set, name, value.value))
g_warning ("Failed to add '%s' int value (%d) to %s "
"info set.",
name,
@@ -180,8 +172,7 @@ add_int (GUPnPDLNANativeInfoSet *info_set,
case GUPNP_DLNA_VALUE_STATE_UNSET:
break;
case GUPNP_DLNA_VALUE_STATE_UNSUPPORTED:
- if (!gupnp_dlna_native_info_set_add_unsupported_int (info_set,
- name))
+ if (!gupnp_dlna_info_set_add_unsupported_int (info_set, name))
g_warning ("Failed to add '%s' int unsupported value"
" to %s info set.",
name,
@@ -194,16 +185,16 @@ add_int (GUPnPDLNANativeInfoSet *info_set,
}
static void
-add_string (GUPnPDLNANativeInfoSet *info_set,
- const gchar *name,
- GUPnPDLNAStringValue value,
- const gchar *type)
+add_string (GUPnPDLNAInfoSet *info_set,
+ const gchar *name,
+ GUPnPDLNAStringValue value,
+ const gchar *type)
{
switch (value.state) {
case GUPNP_DLNA_VALUE_STATE_SET:
- if (!gupnp_dlna_native_info_set_add_string (info_set,
- name,
- value.value))
+ if (!gupnp_dlna_info_set_add_string (info_set,
+ name,
+ value.value))
g_warning ("Failed to add '%s' int value (%s) to %s "
"info set.",
name,
@@ -215,9 +206,8 @@ add_string (GUPnPDLNANativeInfoSet *info_set,
case GUPNP_DLNA_VALUE_STATE_UNSET:
break;
case GUPNP_DLNA_VALUE_STATE_UNSUPPORTED:
- if (!gupnp_dlna_native_info_set_add_unsupported_string
- (info_set,
- name))
+ if (!gupnp_dlna_info_set_add_unsupported_string (info_set,
+ name))
g_warning ("Failed to add '%s' string unsupported value"
" to %s info set.",
name,
@@ -229,13 +219,13 @@ add_string (GUPnPDLNANativeInfoSet *info_set,
}
}
-static GUPnPDLNANativeInfoSet *
+static GUPnPDLNAInfoSet *
create_info_set (GUPnPDLNAStringValue value,
const gchar *type)
{
gchar *mime;
gchar *lctype;
- GUPnPDLNANativeInfoSet *info_set;
+ GUPnPDLNAInfoSet *info_set;
if (value.state == GUPNP_DLNA_VALUE_STATE_SET) {
mime = value.value;
@@ -248,7 +238,7 @@ create_info_set (GUPnPDLNAStringValue value,
lctype = g_strdup (mime);
}
- info_set = gupnp_dlna_native_info_set_new (mime);
+ info_set = gupnp_dlna_info_set_new (mime);
if (info_set == NULL)
g_warning ("Failed to create %s info set with mime '%s'.",
lctype,
@@ -259,11 +249,11 @@ create_info_set (GUPnPDLNAStringValue value,
return info_set;
}
-static GUPnPDLNANativeInfoSet *
+static GUPnPDLNAInfoSet *
info_set_from_container_information (GUPnPDLNAContainerInformation *info)
{
static const gchar *const type = "container";
- GUPnPDLNANativeInfoSet *info_set = create_info_set
+ GUPnPDLNAInfoSet *info_set = create_info_set
(gupnp_dlna_container_information_get_mime (info),
"Container");
@@ -309,7 +299,7 @@ check_container_profile (GUPnPDLNAInformation *info,
gupnp_dlna_profile_get_container_restrictions (profile);
if (profile_restrictions != NULL && container_info != NULL) {
- GUPnPDLNANativeInfoSet *stream_info_set =
+ GUPnPDLNAInfoSet *stream_info_set =
info_set_from_container_information (container_info);
if (match_profile (profile,
@@ -318,18 +308,18 @@ check_container_profile (GUPnPDLNAInformation *info,
matched = TRUE;
else
g_debug ("Container did not match.");
- gupnp_dlna_native_info_set_free (stream_info_set);
+ gupnp_dlna_info_set_free (stream_info_set);
} else if (profile_restrictions == NULL && container_info == NULL)
matched = TRUE;
return matched;
}
-static GUPnPDLNANativeInfoSet *
+static GUPnPDLNAInfoSet *
info_set_from_audio_information (GUPnPDLNAAudioInformation *info)
{
static const gchar *const type = "audio";
- GUPnPDLNANativeInfoSet *info_set = create_info_set
+ GUPnPDLNAInfoSet *info_set = create_info_set
(gupnp_dlna_audio_information_get_mime (info),
"Audio");
@@ -398,7 +388,7 @@ static gboolean
check_audio_profile (GUPnPDLNAInformation *info,
GUPnPDLNAProfile *profile)
{
- GUPnPDLNANativeInfoSet *info_set;
+ GUPnPDLNAInfoSet *info_set;
gboolean matched;
GUPnPDLNAAudioInformation *audio_info;
GList *restrictions;
@@ -414,16 +404,16 @@ check_audio_profile (GUPnPDLNAInformation *info,
matched = TRUE;
else
g_debug ("Audio did not match.");
- gupnp_dlna_native_info_set_free (info_set);
+ gupnp_dlna_info_set_free (info_set);
return matched;
}
-static GUPnPDLNANativeInfoSet *
+static GUPnPDLNAInfoSet *
info_set_from_video_information (GUPnPDLNAVideoInformation *info)
{
static const gchar *const type = "video";
- GUPnPDLNANativeInfoSet *info_set = create_info_set
+ GUPnPDLNAInfoSet *info_set = create_info_set
(gupnp_dlna_video_information_get_mime (info),
"Video");
@@ -492,7 +482,7 @@ check_video_profile (GUPnPDLNAInformation *info,
gupnp_dlna_information_get_video_information (info);
GUPnPDLNAAudioInformation *audio_info =
gupnp_dlna_information_get_audio_information (info);
- GUPnPDLNANativeInfoSet *info_set = NULL;
+ GUPnPDLNAInfoSet *info_set = NULL;
GList *restrictions;
gboolean result = FALSE;
@@ -506,7 +496,7 @@ check_video_profile (GUPnPDLNAInformation *info,
goto out;
}
- gupnp_dlna_native_info_set_free (info_set);
+ gupnp_dlna_info_set_free (info_set);
restrictions = gupnp_dlna_profile_get_audio_restrictions (profile);
info_set = info_set_from_audio_information (audio_info);
@@ -519,16 +509,16 @@ check_video_profile (GUPnPDLNAInformation *info,
if (check_container_profile (info, profile))
result = TRUE;
out:
- gupnp_dlna_native_info_set_free (info_set);
+ gupnp_dlna_info_set_free (info_set);
return result;
}
-static GUPnPDLNANativeInfoSet *
+static GUPnPDLNAInfoSet *
info_set_from_image_information (GUPnPDLNAImageInformation *info)
{
static const gchar *const type = "image";
- GUPnPDLNANativeInfoSet *info_set = create_info_set
+ GUPnPDLNAInfoSet *info_set = create_info_set
(gupnp_dlna_image_information_get_mime (info),
"Image");
@@ -561,7 +551,7 @@ gupnp_dlna_profile_guesser_impl_guess_image_profile
GList *iter;
GUPnPDLNAImageInformation *image_info =
gupnp_dlna_information_get_image_information (info);
- GUPnPDLNANativeInfoSet *info_set;
+ GUPnPDLNAInfoSet *info_set;
GUPnPDLNAProfile *found_profile;
if (!image_info)
@@ -586,7 +576,7 @@ gupnp_dlna_profile_guesser_impl_guess_image_profile
g_debug ("Image did not match");
}
- gupnp_dlna_native_info_set_free (info_set);
+ gupnp_dlna_info_set_free (info_set);
return found_profile;
}
diff --git a/libgupnp-dlna/profile-backends/native/sets/sets.am b/libgupnp-dlna/profile-backends/native/sets/sets.am
index c760c05..8d10a89 100644
--- a/libgupnp-dlna/profile-backends/native/sets/sets.am
+++ b/libgupnp-dlna/profile-backends/native/sets/sets.am
@@ -1,3 +1 @@
-sets_sources = \
- profile-backends/native/sets/gupnp-dlna-native-info-set.c \
- profile-backends/native/sets/gupnp-dlna-native-info-set.h
+sets_sources =
diff --git a/tests/sets.c b/tests/sets.c
index 9d2f7f4..5e208cf 100644
--- a/tests/sets.c
+++ b/tests/sets.c
@@ -24,7 +24,7 @@
#include "gupnp-dlna-value-type.h"
#include "gupnp-dlna-value-list-private.h"
#include "gupnp-dlna-restriction-private.h"
-#include "gupnp-dlna-native-info-set.h"
+#include "gupnp-dlna-info-set.h"
static void
value_type_not_null (void)
@@ -256,36 +256,28 @@ restriction_merge (void)
static void
info_set_adding_values (void)
{
- GUPnPDLNANativeInfoSet *info_set =
- gupnp_dlna_native_info_set_new ("mime");
+ GUPnPDLNAInfoSet *info_set = gupnp_dlna_info_set_new ("mime");
g_assert (info_set != NULL);
- g_assert (gupnp_dlna_native_info_set_add_bool (info_set, "b", TRUE));
+ g_assert (gupnp_dlna_info_set_add_bool (info_set, "b", TRUE));
/* invalid fraction */
- g_assert (!gupnp_dlna_native_info_set_add_fraction (info_set,
- "f",
- 1,
- 0));
- g_assert (gupnp_dlna_native_info_set_add_fraction (info_set,
- "f",
- 1,
- 2));
- g_assert (gupnp_dlna_native_info_set_add_int (info_set, "i", 42));
- g_assert (gupnp_dlna_native_info_set_add_string (info_set, "s", "str"));
+ g_assert (!gupnp_dlna_info_set_add_fraction (info_set, "f", 1, 0));
+ g_assert (gupnp_dlna_info_set_add_fraction (info_set, "f", 1, 2));
+ g_assert (gupnp_dlna_info_set_add_int (info_set, "i", 42));
+ g_assert (gupnp_dlna_info_set_add_string (info_set, "s", "str"));
/* that name already exists */
- g_assert (!gupnp_dlna_native_info_set_add_bool (info_set, "b", FALSE));
+ g_assert (!gupnp_dlna_info_set_add_bool (info_set, "b", FALSE));
- gupnp_dlna_native_info_set_free (info_set);
+ gupnp_dlna_info_set_free (info_set);
}
static void
info_set_fit (void)
{
- GUPnPDLNARestriction *r =
- gupnp_dlna_restriction_new ("mime");
+ GUPnPDLNARestriction *r = gupnp_dlna_restriction_new ("mime");
GUPnPDLNAValueList *v = gupnp_dlna_value_list_new
- (gupnp_dlna_value_type_bool());
- GUPnPDLNANativeInfoSet *s;
+ (gupnp_dlna_value_type_bool());
+ GUPnPDLNAInfoSet *s;
/* restriction */
g_assert (gupnp_dlna_value_list_add_single (v, "true"));
@@ -312,92 +304,92 @@ info_set_fit (void)
g_assert (gupnp_dlna_restriction_add_value_list (r, "s1", v));
/* info set with exactly fitting values and same mime*/
- s = gupnp_dlna_native_info_set_new ("mime");
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b1", TRUE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f1", 1, 2));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f2", 1, 3));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i1", 13));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i2", 50));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s1", "aaa"));
+ s = gupnp_dlna_info_set_new ("mime");
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b1", TRUE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f1", 1, 2));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f2", 1, 3));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i1", 13));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i2", 50));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s1", "aaa"));
- g_assert (gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (gupnp_dlna_info_set_fits_restriction (s, r));
/* add some more values not considered by restriction */
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b2", FALSE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f3", 4, 5));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i3", 7));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s2", "bbb"));
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b2", FALSE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f3", 4, 5));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i3", 7));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s2", "bbb"));
- g_assert (gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (gupnp_dlna_info_set_fits_restriction (s, r));
- gupnp_dlna_native_info_set_free (s);
+ gupnp_dlna_info_set_free (s);
/* info set with exactly fitting values but different mime */
- s = gupnp_dlna_native_info_set_new ("asdf");
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b1", TRUE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f1", 1, 2));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f2", 1, 3));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i1", 13));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i2", 50));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s1", "aaa"));
+ s = gupnp_dlna_info_set_new ("asdf");
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b1", TRUE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f1", 1, 2));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f2", 1, 3));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i1", 13));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i2", 50));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s1", "aaa"));
- g_assert (!gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (!gupnp_dlna_info_set_fits_restriction (s, r));
/* add some more values not considered by restriction */
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b2", FALSE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f3", 4, 5));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i3", 7));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s2", "bbb"));
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b2", FALSE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f3", 4, 5));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i3", 7));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s2", "bbb"));
- g_assert (!gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (!gupnp_dlna_info_set_fits_restriction (s, r));
- gupnp_dlna_native_info_set_free (s);
+ gupnp_dlna_info_set_free (s);
/* info set with same mime, exact fitting set but not fitting values */
- s = gupnp_dlna_native_info_set_new ("mime");
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b1", FALSE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f1", 3, 2));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f2", 3, 3));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i1", 17));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i2", 57));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s1", "aaaa"));
+ s = gupnp_dlna_info_set_new ("mime");
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b1", FALSE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f1", 3, 2));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f2", 3, 3));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i1", 17));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i2", 57));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s1", "aaaa"));
- g_assert (!gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (!gupnp_dlna_info_set_fits_restriction (s, r));
/* add some more values not considered by restriction */
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b2", FALSE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f3", 4, 5));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i3", 7));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s2", "bbb"));
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b2", FALSE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f3", 4, 5));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i3", 7));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s2", "bbb"));
- g_assert (!gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (!gupnp_dlna_info_set_fits_restriction (s, r));
- gupnp_dlna_native_info_set_free (s);
+ gupnp_dlna_info_set_free (s);
/* info set with same mime but with too few values */
- s = gupnp_dlna_native_info_set_new ("mime");
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f2", 1, 3));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i1", 13));
+ s = gupnp_dlna_info_set_new ("mime");
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f2", 1, 3));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i1", 13));
- g_assert (!gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (!gupnp_dlna_info_set_fits_restriction (s, r));
/* add some more values not considered by restriction */
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b2", FALSE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f3", 4, 5));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i3", 7));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s2", "bbb"));
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b2", FALSE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f3", 4, 5));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i3", 7));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s2", "bbb"));
- g_assert (!gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (!gupnp_dlna_info_set_fits_restriction (s, r));
/* add missing values */
- g_assert (gupnp_dlna_native_info_set_add_bool (s, "b1", TRUE));
- g_assert (gupnp_dlna_native_info_set_add_fraction (s, "f1", 1, 2));
- g_assert (gupnp_dlna_native_info_set_add_int (s, "i2", 50));
- g_assert (gupnp_dlna_native_info_set_add_string (s, "s1", "aaa"));
+ g_assert (gupnp_dlna_info_set_add_bool (s, "b1", TRUE));
+ g_assert (gupnp_dlna_info_set_add_fraction (s, "f1", 1, 2));
+ g_assert (gupnp_dlna_info_set_add_int (s, "i2", 50));
+ g_assert (gupnp_dlna_info_set_add_string (s, "s1", "aaa"));
- g_assert (gupnp_dlna_native_info_set_fits_restriction (s, r));
+ g_assert (gupnp_dlna_info_set_fits_restriction (s, r));
- gupnp_dlna_native_info_set_free (s);
+ gupnp_dlna_info_set_free (s);
gupnp_dlna_restriction_free (r);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]