[gupnp-dlna] All: Use new GObject type macros
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-dlna] All: Use new GObject type macros
- Date: Sun, 4 Jul 2021 06:29:32 +0000 (UTC)
commit 1b7be3c70417467c424d024dd569d07d441b5362
Author: Jens Georg <jensg openismus com>
Date: Sun Jul 4 08:28:17 2021 +0200
All: Use new GObject type macros
Bump ABI version since I canont guarantee ABI compatibility
configure.ac | 2 +-
libgupnp-dlna/gupnp-dlna-audio-information.c | 54 ++++++-------
libgupnp-dlna/gupnp-dlna-audio-information.h | 55 +++++--------
libgupnp-dlna/gupnp-dlna-container-information.c | 30 ++++---
libgupnp-dlna/gupnp-dlna-container-information.h | 53 ++++--------
libgupnp-dlna/gupnp-dlna-image-information.c | 22 +++--
libgupnp-dlna/gupnp-dlna-image-information.h | 54 +++++--------
libgupnp-dlna/gupnp-dlna-info-value.c | 3 +-
libgupnp-dlna/gupnp-dlna-information.c | 70 ++++++++--------
libgupnp-dlna/gupnp-dlna-information.h | 52 ++++--------
libgupnp-dlna/gupnp-dlna-profile-guesser.c | 46 +++++------
libgupnp-dlna/gupnp-dlna-profile-guesser.h | 51 ++++--------
libgupnp-dlna/gupnp-dlna-profile-loader.c | 94 +++++++++++++---------
libgupnp-dlna/gupnp-dlna-profile-loader.h | 50 ++++--------
libgupnp-dlna/gupnp-dlna-profile.c | 70 +++++++++-------
libgupnp-dlna/gupnp-dlna-profile.h | 54 ++++---------
libgupnp-dlna/gupnp-dlna-video-information.c | 51 ++++++------
libgupnp-dlna/gupnp-dlna-video-information.h | 54 +++++--------
.../gstreamer/gupnp-dlna-gst-audio-information.c | 44 ++++++----
.../gstreamer/gupnp-dlna-gst-audio-information.h | 51 +++++-------
.../gupnp-dlna-gst-container-information.c | 46 ++++++++---
.../gupnp-dlna-gst-container-information.h | 53 +++++-------
.../gstreamer/gupnp-dlna-gst-image-information.c | 24 ++++--
.../gstreamer/gupnp-dlna-gst-image-information.h | 52 ++++--------
.../gstreamer/gupnp-dlna-gst-information.c | 61 +++++++++-----
.../gstreamer/gupnp-dlna-gst-information.h | 51 ++++--------
.../gstreamer/gupnp-dlna-gst-metadata-extractor.c | 33 ++++++--
.../gstreamer/gupnp-dlna-gst-metadata-extractor.h | 47 ++---------
.../gstreamer/gupnp-dlna-gst-video-information.c | 8 ++
.../gstreamer/gupnp-dlna-gst-video-information.h | 47 ++++-------
.../metadata/gupnp-dlna-metadata-extractor.c | 19 +++--
.../metadata/gupnp-dlna-metadata-extractor.h | 52 ++++--------
meson.build | 2 +-
33 files changed, 632 insertions(+), 823 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7a61616..91c8a76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ AX_CHECK_ENABLE_DEBUG([yes])
dnl library versioning
dnl Increase when changing the API
-GUPNP_DLNA_CURRENT=3
+GUPNP_DLNA_CURRENT=4
dnl Update when changing implementation of current API,
dnl reset to 0 when changing CURRENT. This is the revision of
diff --git a/libgupnp-dlna/gupnp-dlna-audio-information.c b/libgupnp-dlna/gupnp-dlna-audio-information.c
index 1e646fa..9b0426e 100644
--- a/libgupnp-dlna/gupnp-dlna-audio-information.c
+++ b/libgupnp-dlna/gupnp-dlna-audio-information.c
@@ -50,6 +50,8 @@
struct _GUPnPDLNAAudioInformationPrivate {
gpointer placeholder;
};
+typedef struct _GUPnPDLNAAudioInformationPrivate
+ GUPnPDLNAAudioInformationPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GUPnPDLNAAudioInformation,
gupnp_dlna_audio_information,
@@ -76,10 +78,6 @@ gupnp_dlna_audio_information_class_init
static void
gupnp_dlna_audio_information_init (GUPnPDLNAAudioInformation *info)
{
- GUPnPDLNAAudioInformationPrivate *priv =
- gupnp_dlna_audio_information_get_instance_private (info);
-
- info->priv = priv;
}
/**
@@ -93,13 +91,13 @@ gupnp_dlna_audio_information_get_bitrate (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_bitrate != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -118,13 +116,13 @@ gupnp_dlna_audio_information_get_channels (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_channels != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -143,13 +141,13 @@ gupnp_dlna_audio_information_get_depth (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_depth != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -168,13 +166,13 @@ gupnp_dlna_audio_information_get_layer (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_layer != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -193,13 +191,13 @@ gupnp_dlna_audio_information_get_level (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_level != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -219,13 +217,13 @@ gupnp_dlna_audio_information_get_mpeg_audio_version
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mpeg_audio_version != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -244,13 +242,13 @@ gupnp_dlna_audio_information_get_mpeg_version (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mpeg_version != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -269,13 +267,13 @@ gupnp_dlna_audio_information_get_profile (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_profile != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -294,13 +292,13 @@ gupnp_dlna_audio_information_get_rate (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_rate != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -319,13 +317,13 @@ gupnp_dlna_audio_information_get_stream_format (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_stream_format != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -344,13 +342,13 @@ gupnp_dlna_audio_information_get_wma_version (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_wma_version != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -369,13 +367,13 @@ gupnp_dlna_audio_information_get_mime (GUPnPDLNAAudioInformation *info)
{
GUPnPDLNAAudioInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_AUDIO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_AUDIO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mime != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
diff --git a/libgupnp-dlna/gupnp-dlna-audio-information.h b/libgupnp-dlna/gupnp-dlna-audio-information.h
index 7662249..624c33e 100644
--- a/libgupnp-dlna/gupnp-dlna-audio-information.h
+++ b/libgupnp-dlna/gupnp-dlna-audio-information.h
@@ -27,40 +27,24 @@
G_BEGIN_DECLS
-#define GUPNP_TYPE_DLNA_AUDIO_INFORMATION \
- (gupnp_dlna_audio_information_get_type())
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAAudioInformation,
+ gupnp_dlna_audio_information,
+ GUPNP_DLNA,
+ AUDIO_INFORMATION,
+ GObject)
-#define GUPNP_DLNA_AUDIO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_AUDIO_INFORMATION, \
- GUPnPDLNAAudioInformation))
+#define GUPNP_TYPE_DLNA_AUDIO_INFORMATION \
+ (gupnp_dlna_audio_information_get_type ())
-#define GUPNP_DLNA_AUDIO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_AUDIO_INFORMATION, \
- GUPnPDLNAAudioInformationClass))
-
-#define GUPNP_IS_DLNA_AUDIO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_AUDIO_INFORMATION))
-
-#define GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_AUDIO_INFORMATION))
-
-#define GUPNP_DLNA_AUDIO_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_AUDIO_INFORMATION, \
- GUPnPDLNAAudioInformationClass))
-
-typedef struct _GUPnPDLNAAudioInformationPrivate
- GUPnPDLNAAudioInformationPrivate;
-
-typedef struct {
- GObject parent;
-
- GUPnPDLNAAudioInformationPrivate *priv;
-} GUPnPDLNAAudioInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_AUDIO_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_AUDIO_INFORMATION GUPNP_DLNA_IS_AUDIO_INFORMATION
+/**
+ * GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_AUDIO_INFORMATION_CLASS GUPNP_DLNA_IS_AUDIO_INFORMATION_CLASS
/**
* GUPnPDLNAAudioInformationClass:
@@ -91,7 +75,7 @@ typedef struct {
* type.
* @_reserved: Padding. Ignore it.
*/
-typedef struct {
+struct _GUPnPDLNAAudioInformationClass {
GObjectClass parent_class;
GUPnPDLNAIntValue
@@ -131,10 +115,7 @@ typedef struct {
(* get_mime) (GUPnPDLNAAudioInformation *info);
gpointer _reserved[12];
-} GUPnPDLNAAudioInformationClass;
-
-GType
-gupnp_dlna_audio_information_get_type (void);
+};
GUPnPDLNAIntValue
gupnp_dlna_audio_information_get_bitrate (GUPnPDLNAAudioInformation *info);
diff --git a/libgupnp-dlna/gupnp-dlna-container-information.c
b/libgupnp-dlna/gupnp-dlna-container-information.c
index 26aaa85..742449e 100644
--- a/libgupnp-dlna/gupnp-dlna-container-information.c
+++ b/libgupnp-dlna/gupnp-dlna-container-information.c
@@ -51,6 +51,8 @@
struct _GUPnPDLNAContainerInformationPrivate {
gpointer placeholder;
};
+typedef struct _GUPnPDLNAContainerInformationPrivate
+ GUPnPDLNAContainerInformationPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GUPnPDLNAContainerInformation,
gupnp_dlna_container_information,
@@ -71,10 +73,6 @@ gupnp_dlna_container_information_class_init
static void
gupnp_dlna_container_information_init (GUPnPDLNAContainerInformation *info)
{
- GUPnPDLNAContainerInformationPrivate *priv =
- gupnp_dlna_container_information_get_instance_private (info);
-
- info->priv = priv;
}
/**
@@ -89,13 +87,13 @@ gupnp_dlna_container_information_get_mpeg_version
{
GUPnPDLNAContainerInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_CONTAINER_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_CONTAINER_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mpeg_version != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -115,13 +113,13 @@ gupnp_dlna_container_information_get_packet_size
{
GUPnPDLNAContainerInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_CONTAINER_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_CONTAINER_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_packet_size != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -141,13 +139,13 @@ gupnp_dlna_container_information_get_profile
{
GUPnPDLNAContainerInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_CONTAINER_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_CONTAINER_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_profile != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -167,13 +165,13 @@ gupnp_dlna_container_information_is_system_stream
{
GUPnPDLNAContainerInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_CONTAINER_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_CONTAINER_INFORMATION (info),
GUPNP_DLNA_BOOL_VALUE_UNSET);
info_class = GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS (info_class),
GUPNP_DLNA_BOOL_VALUE_UNSET);
g_return_val_if_fail (info_class->is_system_stream != NULL,
GUPNP_DLNA_BOOL_VALUE_UNSET);
@@ -193,13 +191,13 @@ gupnp_dlna_container_information_get_variant
{
GUPnPDLNAContainerInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_CONTAINER_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_CONTAINER_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_variant != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -218,13 +216,13 @@ gupnp_dlna_container_information_get_mime (GUPnPDLNAContainerInformation *info)
{
GUPnPDLNAContainerInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_CONTAINER_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_CONTAINER_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mime != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
diff --git a/libgupnp-dlna/gupnp-dlna-container-information.h
b/libgupnp-dlna/gupnp-dlna-container-information.h
index 156bfd9..8ada6f1 100644
--- a/libgupnp-dlna/gupnp-dlna-container-information.h
+++ b/libgupnp-dlna/gupnp-dlna-container-information.h
@@ -27,40 +27,24 @@
G_BEGIN_DECLS
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAContainerInformation,
+ gupnp_dlna_container_information,
+ GUPNP_DLNA,
+ CONTAINER_INFORMATION,
+ GObject)
+
#define GUPNP_TYPE_DLNA_CONTAINER_INFORMATION \
(gupnp_dlna_container_information_get_type())
-#define GUPNP_DLNA_CONTAINER_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_CONTAINER_INFORMATION, \
- GUPnPDLNAContainerInformation))
-
-#define GUPNP_DLNA_CONTAINER_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_CONTAINER_INFORMATION, \
- GUPnPDLNAContainerInformationClass))
-
-#define GUPNP_IS_DLNA_CONTAINER_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_CONTAINER_INFORMATION))
-
-#define GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_CONTAINER_INFORMATION))
-
-#define GUPNP_DLNA_CONTAINER_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_CONTAINER_INFORMATION, \
- GUPnPDLNAContainerInformationClass))
-
-typedef struct _GUPnPDLNAContainerInformationPrivate
- GUPnPDLNAContainerInformationPrivate;
-
-typedef struct {
- GObject parent;
-
- GUPnPDLNAContainerInformationPrivate *priv;
-} GUPnPDLNAContainerInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_CONTAINER_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_CONTAINER_INFORMATION GUPNP_DLNA_IS_CONTAINER_INFORMATION
+/**
+ * GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_CONTAINER_INFORMATION_CLASS GUPNP_DLNA_IS_CONTAINER_INFORMATION_CLASS
/**
* GUPnPDLNAContainerInformationClass:
@@ -79,7 +63,7 @@ typedef struct {
* type.
* @_reserved: Padding. Ignore it.
*/
-typedef struct {
+struct _GUPnPDLNAContainerInformationClass {
GObjectClass parent_class;
GUPnPDLNAIntValue
@@ -101,10 +85,7 @@ typedef struct {
(* get_mime) (GUPnPDLNAContainerInformation *info);
gpointer _reserved[12];
-} GUPnPDLNAContainerInformationClass;
-
-GType
-gupnp_dlna_container_information_get_type (void);
+};
GUPnPDLNAIntValue
gupnp_dlna_container_information_get_mpeg_version
diff --git a/libgupnp-dlna/gupnp-dlna-image-information.c b/libgupnp-dlna/gupnp-dlna-image-information.c
index aa36e14..999db40 100644
--- a/libgupnp-dlna/gupnp-dlna-image-information.c
+++ b/libgupnp-dlna/gupnp-dlna-image-information.c
@@ -50,6 +50,8 @@
struct _GUPnPDLNAImageInformationPrivate {
gpointer placeholder;
};
+typedef struct _GUPnPDLNAImageInformationPrivate
+ GUPnPDLNAImageInformationPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GUPnPDLNAImageInformation,
gupnp_dlna_image_information,
@@ -68,10 +70,6 @@ gupnp_dlna_image_information_class_init
static void
gupnp_dlna_image_information_init (GUPnPDLNAImageInformation *info)
{
- GUPnPDLNAImageInformationPrivate *priv =
- gupnp_dlna_image_information_get_instance_private (info);
-
- info->priv = priv;
}
/**
@@ -85,13 +83,13 @@ gupnp_dlna_image_information_get_depth (GUPnPDLNAImageInformation *info)
{
GUPnPDLNAImageInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_IMAGE_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_IMAGE_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_IMAGE_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_IMAGE_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_depth != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -110,13 +108,13 @@ gupnp_dlna_image_information_get_height (GUPnPDLNAImageInformation *info)
{
GUPnPDLNAImageInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_IMAGE_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_IMAGE_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_IMAGE_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_IMAGE_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_height != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -135,13 +133,13 @@ gupnp_dlna_image_information_get_width (GUPnPDLNAImageInformation *info)
{
GUPnPDLNAImageInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_IMAGE_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_IMAGE_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_IMAGE_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_IMAGE_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_width != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -160,13 +158,13 @@ gupnp_dlna_image_information_get_mime (GUPnPDLNAImageInformation *info)
{
GUPnPDLNAImageInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_IMAGE_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_IMAGE_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_IMAGE_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_IMAGE_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mime != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
diff --git a/libgupnp-dlna/gupnp-dlna-image-information.h b/libgupnp-dlna/gupnp-dlna-image-information.h
index 56b39c3..4608dc8 100644
--- a/libgupnp-dlna/gupnp-dlna-image-information.h
+++ b/libgupnp-dlna/gupnp-dlna-image-information.h
@@ -27,40 +27,25 @@
G_BEGIN_DECLS
-#define GUPNP_TYPE_DLNA_IMAGE_INFORMATION \
- (gupnp_dlna_image_information_get_type())
-
-#define GUPNP_DLNA_IMAGE_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_IMAGE_INFORMATION, \
- GUPnPDLNAImageInformation))
-
-#define GUPNP_DLNA_IMAGE_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_IMAGE_INFORMATION, \
- GUPnPDLNAImageInformationClass))
-
-#define GUPNP_IS_DLNA_IMAGE_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_IMAGE_INFORMATION))
-
-#define GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_IMAGE_INFORMATION))
-
-#define GUPNP_DLNA_IMAGE_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_IMAGE_INFORMATION, \
- GUPnPDLNAImageInformationClass))
+G_DECLARE_DERIVABLE_TYPE(GUPnPDLNAImageInformation,
+ gupnp_dlna_image_information,
+ GUPNP_DLNA,
+ IMAGE_INFORMATION,
+ GObject)
-typedef struct _GUPnPDLNAImageInformationPrivate
- GUPnPDLNAImageInformationPrivate;
-typedef struct {
- GObject parent;
+#define GUPNP_TYPE_DLNA_IMAGE_INFORMATION \
+ (gupnp_dlna_image_information_get_type())
- GUPnPDLNAImageInformationPrivate *priv;
-} GUPnPDLNAImageInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_IMAGE_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_IMAGE_INFORMATION GUPNP_DLNA_IS_IMAGE_INFORMATION
+/**
+ * GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_IMAGE_INFORMATION_CLASS GUPNP_DLNA_IS_IMAGE_INFORMATION_CLASS
/**
* GUPnPDLNAImageInformationClass:
@@ -75,7 +60,7 @@ typedef struct {
* type.
* @_reserved: Padding. Ignore it.
*/
-typedef struct {
+struct _GUPnPDLNAImageInformationClass {
GObjectClass parent_class;
GUPnPDLNAIntValue
@@ -91,10 +76,7 @@ typedef struct {
(* get_mime) (GUPnPDLNAImageInformation *info);
gpointer _reserved[12];
-} GUPnPDLNAImageInformationClass;
-
-GType
-gupnp_dlna_image_information_get_type (void);
+};
GUPnPDLNAIntValue
gupnp_dlna_image_information_get_depth (GUPnPDLNAImageInformation *info);
diff --git a/libgupnp-dlna/gupnp-dlna-info-value.c b/libgupnp-dlna/gupnp-dlna-info-value.c
index 10cc487..25e50a1 100644
--- a/libgupnp-dlna/gupnp-dlna-info-value.c
+++ b/libgupnp-dlna/gupnp-dlna-info-value.c
@@ -51,10 +51,9 @@ value_new (GUPnPDLNAValueType *type,
static GUPnPDLNAInfoValue *
value_unsupported (GUPnPDLNAValueType *type)
{
- GUPnPDLNAInfoValue *info_value = g_slice_new (GUPnPDLNAInfoValue);
+ GUPnPDLNAInfoValue *info_value = g_slice_new0 (GUPnPDLNAInfoValue);
info_value->type = type;
- memset (&info_value->value, 0, sizeof (GUPnPDLNAValueUnion));
info_value->unsupported = TRUE;
return info_value;
diff --git a/libgupnp-dlna/gupnp-dlna-information.c b/libgupnp-dlna/gupnp-dlna-information.c
index 0334464..dfe613c 100644
--- a/libgupnp-dlna/gupnp-dlna-information.c
+++ b/libgupnp-dlna/gupnp-dlna-information.c
@@ -45,6 +45,7 @@ struct _GUPnPDLNAInformationPrivate {
GUPnPDLNAImageInformation *image_info;
GUPnPDLNAVideoInformation *video_info;
};
+typedef struct _GUPnPDLNAInformationPrivate GUPnPDLNAInformationPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GUPnPDLNAInformation,
gupnp_dlna_information,
@@ -70,7 +71,8 @@ static void
gupnp_dlna_information_dispose (GObject *object)
{
GUPnPDLNAInformation *info = GUPNP_DLNA_INFORMATION (object);
- GUPnPDLNAInformationPrivate *priv = info->priv;
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
g_clear_object (&priv->audio_info);
g_clear_object (&priv->container_info);
@@ -83,8 +85,10 @@ static void
gupnp_dlna_information_finalize (GObject *object)
{
GUPnPDLNAInformation *info = GUPNP_DLNA_INFORMATION (object);
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
- g_free (info->priv->uri);
+ g_free (priv->uri);
G_OBJECT_CLASS (gupnp_dlna_information_parent_class)->finalize (object);
}
@@ -95,7 +99,8 @@ gupnp_dlna_information_set_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAInformation *info = GUPNP_DLNA_INFORMATION (object);
- GUPnPDLNAInformationPrivate *priv = info->priv;
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
switch (property_id) {
case PROP_URI:
@@ -116,7 +121,8 @@ gupnp_dlna_information_get_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAInformation *info = GUPNP_DLNA_INFORMATION (object);
- GUPnPDLNAInformationPrivate *priv = info->priv;
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
switch (property_id) {
case PROP_URI:
@@ -238,19 +244,6 @@ gupnp_dlna_information_class_init (GUPnPDLNAInformationClass *info_class)
static void
gupnp_dlna_information_init (GUPnPDLNAInformation *info)
{
- GUPnPDLNAInformationPrivate *priv =
- gupnp_dlna_information_get_instance_private (info);
-
- priv->uri = NULL;
- priv->got_audio_info = FALSE;
- priv->got_container_info = FALSE;
- priv->got_image_info = FALSE;
- priv->got_video_info = FALSE;
- priv->audio_info = NULL;
- priv->container_info = NULL;
- priv->image_info = NULL;
- priv->video_info = NULL;
- info->priv = priv;
}
/**
@@ -265,18 +258,17 @@ gupnp_dlna_information_init (GUPnPDLNAInformation *info)
GUPnPDLNAAudioInformation *
gupnp_dlna_information_get_audio_information (GUPnPDLNAInformation *info)
{
- GUPnPDLNAInformationPrivate *priv;
-
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
- priv = info->priv;
if (!priv->got_audio_info) {
GUPnPDLNAInformationClass *info_class;
info_class = GUPNP_DLNA_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_INFORMATION_CLASS (info_class),
NULL);
g_return_val_if_fail (info_class->get_audio_information != NULL,
NULL);
@@ -300,18 +292,17 @@ gupnp_dlna_information_get_audio_information (GUPnPDLNAInformation *info)
GUPnPDLNAContainerInformation *
gupnp_dlna_information_get_container_information (GUPnPDLNAInformation *info)
{
- GUPnPDLNAInformationPrivate *priv;
-
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
- priv = info->priv;
if (!priv->got_container_info) {
GUPnPDLNAInformationClass *info_class;
info_class = GUPNP_DLNA_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_INFORMATION_CLASS (info_class),
NULL);
g_return_val_if_fail
(info_class->get_container_information != NULL,
@@ -337,18 +328,18 @@ gupnp_dlna_information_get_container_information (GUPnPDLNAInformation *info)
GUPnPDLNAImageInformation *
gupnp_dlna_information_get_image_information (GUPnPDLNAInformation *info)
{
- GUPnPDLNAInformationPrivate *priv;
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
- priv = info->priv;
if (!priv->got_image_info) {
GUPnPDLNAInformationClass *info_class;
info_class = GUPNP_DLNA_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_INFORMATION_CLASS (info_class),
NULL);
g_return_val_if_fail (info_class->get_image_information != NULL,
NULL);
@@ -372,18 +363,18 @@ gupnp_dlna_information_get_image_information (GUPnPDLNAInformation *info)
GUPnPDLNAVideoInformation *
gupnp_dlna_information_get_video_information (GUPnPDLNAInformation *info)
{
- GUPnPDLNAInformationPrivate *priv;
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
- priv = info->priv;
if (!priv->got_video_info) {
GUPnPDLNAInformationClass *info_class;
info_class = GUPNP_DLNA_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_INFORMATION_CLASS (info_class),
NULL);
g_return_val_if_fail (info_class->get_video_information != NULL,
NULL);
@@ -404,7 +395,7 @@ gupnp_dlna_information_get_video_information (GUPnPDLNAInformation *info)
const gchar *
gupnp_dlna_information_get_profile_name (GUPnPDLNAInformation *info)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
return GUPNP_DLNA_INFORMATION_GET_CLASS (info)->get_profile_name (info);
}
@@ -419,7 +410,10 @@ gupnp_dlna_information_get_profile_name (GUPnPDLNAInformation *info)
const gchar *
gupnp_dlna_information_get_uri (GUPnPDLNAInformation *info)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
+
+ GUPnPDLNAInformationPrivate *priv =
+ gupnp_dlna_information_get_instance_private (info);
- return info->priv->uri;
+ return priv->uri;
}
diff --git a/libgupnp-dlna/gupnp-dlna-information.h b/libgupnp-dlna/gupnp-dlna-information.h
index e9c6bf3..335c1cd 100644
--- a/libgupnp-dlna/gupnp-dlna-information.h
+++ b/libgupnp-dlna/gupnp-dlna-information.h
@@ -30,38 +30,23 @@
G_BEGIN_DECLS
-#define GUPNP_TYPE_DLNA_INFORMATION (gupnp_dlna_information_get_type())
-
-#define GUPNP_DLNA_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_INFORMATION, \
- GUPnPDLNAInformation))
-
-#define GUPNP_DLNA_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_INFORMATION, \
- GUPnPDLNAInformationClass))
-
-#define GUPNP_IS_DLNA_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_INFORMATION))
-
-#define GUPNP_IS_DLNA_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_INFORMATION))
-
-#define GUPNP_DLNA_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_INFORMATION, \
- GUPnPDLNAInformationClass))
-
-typedef struct _GUPnPDLNAInformationPrivate GUPnPDLNAInformationPrivate;
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAInformation,
+ gupnp_dlna_information,
+ GUPNP_DLNA,
+ INFORMATION,
+ GObject)
-typedef struct {
- GObject parent;
+#define GUPNP_TYPE_DLNA_INFORMATION (gupnp_dlna_information_get_type())
- GUPnPDLNAInformationPrivate *priv;
-} GUPnPDLNAInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_INFORMATION GUPNP_DLNA_IS_INFORMATION
+/**
+ * GUPNP_IS_DLNA_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_INFORMATION_CLASS GUPNP_DLNA_IS_INFORMATION_CLASS
/**
* GUPnPDLNAInformationClass:
@@ -78,7 +63,7 @@ typedef struct {
* get the name of the DLNA profile assigned with this information.
* @_reserved: Padding. Ignore it.
*/
-typedef struct {
+struct _GUPnPDLNAInformationClass{
GObjectClass parent_class;
GUPnPDLNAAudioInformation *
@@ -97,10 +82,7 @@ typedef struct {
(* get_profile_name) (GUPnPDLNAInformation *info);
gpointer _reserved[11];
-} GUPnPDLNAInformationClass;
-
-GType
-gupnp_dlna_information_get_type (void);
+};
GUPnPDLNAAudioInformation*
gupnp_dlna_information_get_audio_information (GUPnPDLNAInformation *info);
diff --git a/libgupnp-dlna/gupnp-dlna-profile-guesser.c b/libgupnp-dlna/gupnp-dlna-profile-guesser.c
index 757802b..c9d815a 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-guesser.c
+++ b/libgupnp-dlna/gupnp-dlna-profile-guesser.c
@@ -47,6 +47,7 @@ struct _GUPnPDLNAProfileGuesserPrivate {
gboolean relaxed_mode;
gboolean extended_mode;
};
+typedef struct _GUPnPDLNAProfileGuesserPrivate GUPnPDLNAProfileGuesserPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAProfileGuesser,
gupnp_dlna_profile_guesser,
@@ -67,7 +68,8 @@ gupnp_dlna_profile_guesser_set_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAProfileGuesser *self = GUPNP_DLNA_PROFILE_GUESSER (object);
- GUPnPDLNAProfileGuesserPrivate *priv = self->priv;
+ GUPnPDLNAProfileGuesserPrivate *priv =
+ gupnp_dlna_profile_guesser_get_instance_private (self);
switch (property_id) {
case PROP_DLNA_RELAXED_MODE:
@@ -93,7 +95,8 @@ gupnp_dlna_profile_guesser_get_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAProfileGuesser *self = GUPNP_DLNA_PROFILE_GUESSER (object);
- GUPnPDLNAProfileGuesserPrivate *priv = self->priv;
+ GUPnPDLNAProfileGuesserPrivate *priv =
+ gupnp_dlna_profile_guesser_get_instance_private (self);
switch (property_id) {
case PROP_DLNA_RELAXED_MODE:
@@ -202,12 +205,6 @@ gupnp_dlna_profile_guesser_class_init
static void
gupnp_dlna_profile_guesser_init (GUPnPDLNAProfileGuesser *self)
{
- GUPnPDLNAProfileGuesserPrivate *priv =
- gupnp_dlna_profile_guesser_get_instance_private (self);
-
- priv->relaxed_mode = FALSE;
- priv->extended_mode = FALSE;
- self->priv = priv;
}
/**
@@ -285,7 +282,7 @@ gupnp_dlna_profile_guesser_guess_profile_async
GError *extractor_error;
guint id;
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), FALSE);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -338,7 +335,7 @@ gupnp_dlna_profile_guesser_guess_profile_sync
GUPnPDLNAInformation *info;
GUPnPDLNAProfile *profile;
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), NULL);
g_return_val_if_fail (uri != NULL, NULL);
g_return_val_if_fail (dlna_info == NULL || *dlna_info == NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -402,8 +399,8 @@ gupnp_dlna_profile_guesser_guess_profile_from_info
GUPnPDLNAProfile *profile;
const gchar *profile_name;
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), NULL);
- g_return_val_if_fail (GUPNP_IS_DLNA_INFORMATION (info), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_INFORMATION (info), NULL);
profiles = gupnp_dlna_profile_guesser_list_profiles (guesser);
video_info = gupnp_dlna_information_get_video_information (info);
@@ -457,12 +454,12 @@ gupnp_dlna_profile_guesser_get_profile (GUPnPDLNAProfileGuesser *guesser,
{
// TODO: use a GHashTable for this.
GList *iter;
- GUPnPDLNAProfileGuesserPrivate *priv;
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), NULL);
g_return_val_if_fail (name != NULL, NULL);
- priv = guesser->priv;
+ GUPnPDLNAProfileGuesserPrivate *priv =
+ gupnp_dlna_profile_guesser_get_instance_private (guesser);
for (iter = profiles_list[priv->relaxed_mode][priv->extended_mode];
iter;
@@ -489,11 +486,10 @@ gupnp_dlna_profile_guesser_get_profile (GUPnPDLNAProfileGuesser *guesser,
GList *
gupnp_dlna_profile_guesser_list_profiles (GUPnPDLNAProfileGuesser *guesser)
{
- GUPnPDLNAProfileGuesserPrivate *priv;
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), NULL);
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), NULL);
-
- priv = guesser->priv;
+ GUPnPDLNAProfileGuesserPrivate *priv =
+ gupnp_dlna_profile_guesser_get_instance_private (guesser);
return profiles_list[priv->relaxed_mode][priv->extended_mode];
}
@@ -507,9 +503,11 @@ gupnp_dlna_profile_guesser_list_profiles (GUPnPDLNAProfileGuesser *guesser)
gboolean
gupnp_dlna_profile_guesser_get_relaxed_mode (GUPnPDLNAProfileGuesser *guesser)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), FALSE);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), FALSE);
+ GUPnPDLNAProfileGuesserPrivate *priv =
+ gupnp_dlna_profile_guesser_get_instance_private (guesser);
- return guesser->priv->relaxed_mode;
+ return priv->relaxed_mode;
}
/**
@@ -521,9 +519,11 @@ gupnp_dlna_profile_guesser_get_relaxed_mode (GUPnPDLNAProfileGuesser *guesser)
gboolean
gupnp_dlna_profile_guesser_get_extended_mode (GUPnPDLNAProfileGuesser *guesser)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), FALSE);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_GUESSER (guesser), FALSE);
+ GUPnPDLNAProfileGuesserPrivate *priv =
+ gupnp_dlna_profile_guesser_get_instance_private (guesser);
- return guesser->priv->extended_mode;
+ return priv->extended_mode;
}
/**
diff --git a/libgupnp-dlna/gupnp-dlna-profile-guesser.h b/libgupnp-dlna/gupnp-dlna-profile-guesser.h
index a9a4907..d6ee189 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-guesser.h
+++ b/libgupnp-dlna/gupnp-dlna-profile-guesser.h
@@ -32,52 +32,29 @@ G_BEGIN_DECLS
#define GUPNP_TYPE_DLNA_PROFILE_GUESSER (gupnp_dlna_profile_guesser_get_type())
-#define GUPNP_DLNA_PROFILE_GUESSER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_PROFILE_GUESSER, \
- GUPnPDLNAProfileGuesser))
-
-#define GUPNP_DLNA_PROFILE_GUESSER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_PROFILE_GUESSER, \
- GUPnPDLNAProfileGuesserClass))
-
-#define GUPNP_IS_DLNA_PROFILE_GUESSER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_PROFILE_GUESSER))
-
-#define GUPNP_IS_DLNA_PROFILE_GUESSER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_PROFILE_GUESSER))
-
-#define GUPNP_DLNA_PROFILE_GUESSER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_PROFILE_GUESSER, \
- GUPnPDLNAProfileGuesserClass))
-
-typedef struct _GUPnPDLNAProfileGuesserPrivate GUPnPDLNAProfileGuesserPrivate;
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAProfileGuesser,
+ gupnp_dlna_profile_guesser,
+ GUPNP_DLNA,
+ PROFILE_GUESSER,
+ GObject)
+// Backwards-compatible defines
/**
- * GUPnPDLNAProfileGuesser:
- *
- * The top-level object used to for DLNA profile guessing.
+ * GUPNP_IS_DLNA_PROFILE_GUESSER: (skip)
*/
-typedef struct {
- GObject parent;
-
- GUPnPDLNAProfileGuesserPrivate *priv;
-} GUPnPDLNAProfileGuesser;
+#define GUPNP_IS_DLNA_PROFILE_GUESSER GUPNP_DLNA_IS_PROFILE_GUESSER
+/**
+ * GUPNP_IS_DLNA_PROFILE_GUESSER_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_PROFILE_GUESSER_CLASS GUPNP_DLNA_IS_PROFILE_GUESSER_CLASS
/**
* GUPnPDLNAProfileGuesserClass:
* @parent_class: A #GObjectClass - parent of this class.
*/
-typedef struct {
+struct _GUPnPDLNAProfileGuesserClass {
GObjectClass parent_class;
-} GUPnPDLNAProfileGuesserClass;
-
-GType
-gupnp_dlna_profile_guesser_get_type (void) G_GNUC_CONST;
+};
GUPnPDLNAProfileGuesser *
gupnp_dlna_profile_guesser_new (gboolean relaxed_mode,
diff --git a/libgupnp-dlna/gupnp-dlna-profile-loader.c b/libgupnp-dlna/gupnp-dlna-profile-loader.c
index f4d7a0f..fae7c09 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-loader.c
+++ b/libgupnp-dlna/gupnp-dlna-profile-loader.c
@@ -48,6 +48,7 @@ struct _GUPnPDLNAProfileLoaderPrivate {
GList *restriction_data_stack;
char *dlna_profile_dir;
};
+typedef struct _GUPnPDLNAProfileLoaderPrivate GUPnPDLNAProfileLoaderPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAProfileLoader,
gupnp_dlna_profile_loader,
@@ -220,7 +221,9 @@ static void
push_tag (GUPnPDLNAProfileLoader *loader,
GUPnPDLNAParsedElement element)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
+
gint raw_element = (gint) element;
priv->tags_stack = g_list_prepend (priv->tags_stack,
@@ -230,7 +233,8 @@ push_tag (GUPnPDLNAProfileLoader *loader,
static void
pop_tag (GUPnPDLNAProfileLoader *loader)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
priv->tags_stack = g_list_delete_link (priv->tags_stack,
priv->tags_stack);
@@ -239,7 +243,8 @@ pop_tag (GUPnPDLNAProfileLoader *loader)
static GUPnPDLNAParsedElement
top_tag (GUPnPDLNAProfileLoader *loader)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
if (priv->tags_stack != NULL) {
gint top_raw = GPOINTER_TO_INT (priv->tags_stack->data);
@@ -314,7 +319,6 @@ post_field (GUPnPDLNAProfileLoader *loader,
const gchar *type,
GList *values)
{
- GUPnPDLNAProfileLoaderPrivate *priv;
GUPnPDLNARestrictionData *restriction_data;
GUPnPDLNANameValueListPair *pair;
GUPnPDLNAValueList *value_list;
@@ -331,7 +335,8 @@ post_field (GUPnPDLNAProfileLoader *loader,
if (value_type == NULL)
return;
- priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
restriction_data =
(GUPnPDLNARestrictionData *) priv->restriction_data_stack->data;
value_list = gupnp_dlna_value_list_new (value_type);
@@ -353,7 +358,8 @@ static void
merge_restrictions (GUPnPDLNAProfileLoader *loader,
GUPnPDLNADescription *description)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNAProfileData* data =
(GUPnPDLNAProfileData *) priv->dlna_profile_data_stack->data;
GList **target_list;
@@ -402,7 +408,8 @@ static void
collect_parents (GUPnPDLNAProfileLoader *loader,
GUPnPDLNADescription *description)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNARestrictionData *data =
(GUPnPDLNARestrictionData *) priv->restriction_data_stack->data;
@@ -436,7 +443,8 @@ static void
post_parent (GUPnPDLNAProfileLoader *loader,
const gchar *parent)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
pop_tag (loader);
@@ -453,7 +461,8 @@ post_parent (GUPnPDLNAProfileLoader *loader,
static void
pre_restriction (GUPnPDLNAProfileLoader *loader)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNARestrictionData *data = gupnp_dlna_restriction_data_new ();
push_tag (loader, GUPNP_DLNA_PARSED_ELEMENT_RESTRICTION);
@@ -484,7 +493,8 @@ post_restriction (GUPnPDLNAProfileLoader *loader,
const gchar *id,
const gchar *name)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNARestrictionData *data =
(GUPnPDLNARestrictionData *) priv->restriction_data_stack->data;
GUPnPDLNARestriction *restriction;
@@ -563,7 +573,8 @@ post_restrictions (GUPnPDLNAProfileLoader *loader)
static void
pre_dlna_profile (GUPnPDLNAProfileLoader *loader)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNAProfileData* data = gupnp_dlna_profile_data_new ();
push_tag (loader, GUPNP_DLNA_PARSED_ELEMENT_DLNA_PROFILE);
@@ -650,7 +661,8 @@ create_profile (GUPnPDLNAProfileLoader *loader,
const gchar *mime,
gboolean extended)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNAProfileData *data =
(GUPnPDLNAProfileData *) priv->dlna_profile_data_stack->data;
GList *audio_restrictions = NULL;
@@ -692,7 +704,8 @@ create_profile (GUPnPDLNAProfileLoader *loader,
static void
post_dlna_profile (GUPnPDLNAProfileLoader *loader)
{
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
GUPnPDLNAProfileData *data =
(GUPnPDLNAProfileData *) priv->dlna_profile_data_stack->data;
@@ -764,7 +777,8 @@ gupnp_dlna_profile_loader_get_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAProfileLoader *loader = GUPNP_DLNA_PROFILE_LOADER (object);
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
switch (prop_id) {
case PROP_RELAXED_MODE:
@@ -787,7 +801,8 @@ gupnp_dlna_profile_loader_set_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAProfileLoader *loader = GUPNP_DLNA_PROFILE_LOADER (object);
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
switch (prop_id) {
case PROP_RELAXED_MODE:
@@ -807,7 +822,8 @@ static void
gupnp_dlna_profile_loader_dispose (GObject *object)
{
GUPnPDLNAProfileLoader *loader = GUPNP_DLNA_PROFILE_LOADER (object);
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
g_clear_pointer (&priv->restrictions, g_hash_table_unref);
g_clear_pointer (&priv->profile_ids, g_hash_table_unref);
@@ -884,11 +900,6 @@ gupnp_dlna_profile_loader_init (GUPnPDLNAProfileLoader *self)
g_str_equal,
g_free,
(GDestroyNotify) gupnp_dlna_description_free);
- priv->tags_stack = NULL;
- priv->dlna_profile_data_stack = NULL;
- priv->restriction_data_stack = NULL;
-
- self->priv = priv;
}
static GUPnPDLNAFieldValue *
@@ -981,7 +992,8 @@ process_field (GUPnPDLNAProfileLoader *loader,
gboolean done = FALSE;
gboolean skip = FALSE;
GUPnPDLNAFieldValue *value = NULL;
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
pre_field (loader);
@@ -1066,7 +1078,8 @@ process_parent (GUPnPDLNAProfileLoader *loader,
{
xmlChar *parent = NULL;
xmlChar *used = NULL;
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
pre_parent (loader);
@@ -1112,7 +1125,8 @@ process_restriction (GUPnPDLNAProfileLoader *loader,
xmlChar *id = NULL;
xmlChar *type = NULL;
gchar *name = NULL;
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
pre_restriction (loader);
/*
@@ -1258,7 +1272,8 @@ process_dlna_profile (GUPnPDLNAProfileLoader *loader,
xmlChar *extended;
gboolean done = FALSE;
gboolean is_extended = FALSE;
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
pre_dlna_profile (loader);
@@ -1368,9 +1383,10 @@ process_include (GUPnPDLNAProfileLoader *loader,
xmlFree (path);
if (!g_path_is_absolute (g_path)) {
- gchar *tmp = g_build_filename (loader->priv->dlna_profile_dir,
- g_path,
- NULL);
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
+ gchar *tmp =
+ g_build_filename (priv->dlna_profile_dir, g_path, NULL);
g_free (g_path);
g_path = tmp;
}
@@ -1431,7 +1447,9 @@ gupnp_dlna_profile_loader_get_from_file (GUPnPDLNAProfileLoader *loader,
xmlTextReaderPtr reader = NULL;
xmlRelaxNGParserCtxtPtr rngp = NULL;
xmlRelaxNGPtr rngs = NULL;
- GUPnPDLNAProfileLoaderPrivate *priv = loader->priv;
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
+
char *rng_path = NULL;
if (g_hash_table_contains (priv->files_hash, path))
@@ -1444,7 +1462,7 @@ gupnp_dlna_profile_loader_get_from_file (GUPnPDLNAProfileLoader *loader,
goto out;
/* Load the schema for validation */
- rng_path = g_build_filename (loader->priv->dlna_profile_dir,
+ rng_path = g_build_filename (priv->dlna_profile_dir,
"dlna-profiles.rng",
NULL);
rngp = xmlRelaxNGNewParserCtxt (rng_path);
@@ -1552,27 +1570,29 @@ gupnp_dlna_profile_loader_get_from_disk (GUPnPDLNAProfileLoader *loader)
{
GList *profiles;
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_LOADER (loader), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE_LOADER (loader), NULL);
+ GUPnPDLNAProfileLoaderPrivate *priv =
+ gupnp_dlna_profile_loader_get_instance_private (loader);
- if (loader->priv->dlna_profile_dir == NULL) {
+ if (priv->dlna_profile_dir == NULL) {
char **env = NULL;
const char *profile_dir = NULL;
env = g_get_environ ();
profile_dir = g_environ_getenv (env, "GUPNP_DLNA_PROFILE_DIR");
if (profile_dir != NULL && g_path_is_absolute (profile_dir)) {
- loader->priv->dlna_profile_dir = g_strdup (profile_dir);
+ priv->dlna_profile_dir = g_strdup (profile_dir);
} else {
- loader->priv->dlna_profile_dir = g_strdup (DLNA_DATA_DIR);
+ priv->dlna_profile_dir = g_strdup (DLNA_DATA_DIR);
}
g_strfreev (env);
}
- profiles = gupnp_dlna_profile_loader_get_from_dir
- (loader,
- loader->priv->dlna_profile_dir);
+ profiles =
+ gupnp_dlna_profile_loader_get_from_dir (loader,
+ priv->dlna_profile_dir);
profiles = g_list_reverse (profiles);
diff --git a/libgupnp-dlna/gupnp-dlna-profile-loader.h b/libgupnp-dlna/gupnp-dlna-profile-loader.h
index 68e72d1..635e6d3 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-loader.h
+++ b/libgupnp-dlna/gupnp-dlna-profile-loader.h
@@ -31,45 +31,29 @@
G_BEGIN_DECLS
-#define GUPNP_TYPE_DLNA_PROFILE_LOADER (gupnp_dlna_profile_loader_get_type ())
-
-#define GUPNP_DLNA_PROFILE_LOADER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_PROFILE_LOADER, \
- GUPnPDLNAProfileLoader))
-
-#define GUPNP_DLNA_PROFILE_LOADER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_PROFILE_LOADER, \
- GUPnPDLNAProfileLoaderClass))
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAProfileLoader,
+ gupnp_dlna_profile_loader,
+ GUPNP_DLNA,
+ PROFILE_LOADER,
+ GObject)
-#define GUPNP_IS_DLNA_PROFILE_LOADER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_PROFILE_LOADER))
-#define GUPNP_IS_DLNA_PROFILE_LOADER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_PROFILE_LOADER))
-
-#define GUPNP_DLNA_PROFILE_LOADER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_PROFILE_LOADER, \
- GUPnPDLNAProfileLoaderClass))
+#define GUPNP_TYPE_DLNA_PROFILE_LOADER (gupnp_dlna_profile_loader_get_type ())
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_PROFILE_LOADER: (skip)
+ */
+#define GUPNP_IS_DLNA_PROFILE_LOADER GUPNP_DLNA_IS_PROFILE_LOADER
+/**
+ * GUPNP_IS_DLNA_PROFILE_LOADER_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_PROFILE_LOADER_CLASS GUPNP_DLNA_IS_PROFILE_LOADER_CLASS
typedef struct _GUPnPDLNAProfileLoaderPrivate GUPnPDLNAProfileLoaderPrivate;
-typedef struct {
- GObject parent;
-
- GUPnPDLNAProfileLoaderPrivate *priv;
-} GUPnPDLNAProfileLoader;
-
-typedef struct {
+struct _GUPnPDLNAProfileLoaderClass {
GObjectClass parent_class;
-} GUPnPDLNAProfileLoaderClass;
-
-GType
-gupnp_dlna_profile_loader_get_type (void);
+};
GUPnPDLNAProfileLoader *
gupnp_dlna_profile_loader_new (gboolean relaxed_mode,
diff --git a/libgupnp-dlna/gupnp-dlna-profile.c b/libgupnp-dlna/gupnp-dlna-profile.c
index eb190a9..8f215a7 100644
--- a/libgupnp-dlna/gupnp-dlna-profile.c
+++ b/libgupnp-dlna/gupnp-dlna-profile.c
@@ -37,6 +37,13 @@
* restrictions specified for that DLNA profile is to be added.
*/
+/**
+ * GUPnPDLNAProfile:
+ *
+ * The top-level object used for the in-memory representation of the
+ * DLNA Profiles.
+ */
+
struct _GUPnPDLNAProfilePrivate {
gchar *name;
gchar *mime;
@@ -46,6 +53,7 @@ struct _GUPnPDLNAProfilePrivate {
GList *image_restrictions;
GList *video_restrictions;
};
+typedef struct _GUPnPDLNAProfilePrivate GUPnPDLNAProfilePrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAProfile, gupnp_dlna_profile, G_TYPE_OBJECT)
@@ -67,7 +75,8 @@ gupnp_dlna_profile_get_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAProfile *profile = GUPNP_DLNA_PROFILE (object);
- GUPnPDLNAProfilePrivate *priv = profile->priv;
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
switch (property_id) {
case PROP_DLNA_NAME:
@@ -122,7 +131,8 @@ gupnp_dlna_profile_set_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAProfile *profile = GUPNP_DLNA_PROFILE (object);
- GUPnPDLNAProfilePrivate *priv = profile->priv;
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
switch (property_id) {
case PROP_DLNA_NAME:
@@ -170,7 +180,8 @@ static void
gupnp_dlna_profile_finalize (GObject *object)
{
GUPnPDLNAProfile *profile = GUPNP_DLNA_PROFILE (object);
- GUPnPDLNAProfilePrivate *priv = profile->priv;
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
g_free (priv->name);
g_free (priv->mime);
@@ -271,17 +282,6 @@ gupnp_dlna_profile_class_init (GUPnPDLNAProfileClass *klass)
static void
gupnp_dlna_profile_init (GUPnPDLNAProfile *profile)
{
- GUPnPDLNAProfilePrivate *priv =
- gupnp_dlna_profile_get_instance_private (profile);
-
- priv->name = NULL;
- priv->mime = NULL;
- priv->extended = FALSE;
- priv->audio_restrictions = NULL;
- priv->container_restrictions = NULL;
- priv->image_restrictions = NULL;
- priv->video_restrictions = NULL;
- profile->priv = priv;
}
/**
@@ -293,9 +293,11 @@ gupnp_dlna_profile_init (GUPnPDLNAProfile *profile)
const gchar *
gupnp_dlna_profile_get_name (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), NULL);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->name;
+ return priv->name;
}
/**
@@ -307,9 +309,11 @@ gupnp_dlna_profile_get_name (GUPnPDLNAProfile *profile)
const gchar *
gupnp_dlna_profile_get_mime (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), NULL);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->mime;
+ return priv->mime;
}
/**
@@ -321,9 +325,11 @@ gupnp_dlna_profile_get_mime (GUPnPDLNAProfile *profile)
gboolean
gupnp_dlna_profile_get_extended (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), FALSE);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), FALSE);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->extended;
+ return priv->extended;
}
/**
@@ -338,9 +344,11 @@ gupnp_dlna_profile_get_extended (GUPnPDLNAProfile *profile)
GList *
gupnp_dlna_profile_get_audio_restrictions (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), NULL);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->audio_restrictions;
+ return priv->audio_restrictions;
}
/**
@@ -355,9 +363,11 @@ gupnp_dlna_profile_get_audio_restrictions (GUPnPDLNAProfile *profile)
GList *
gupnp_dlna_profile_get_container_restrictions (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), NULL);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->container_restrictions;
+ return priv->container_restrictions;
}
/**
@@ -372,9 +382,11 @@ gupnp_dlna_profile_get_container_restrictions (GUPnPDLNAProfile *profile)
GList *
gupnp_dlna_profile_get_image_restrictions (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), NULL);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->image_restrictions;
+ return priv->image_restrictions;
}
/**
@@ -389,9 +401,11 @@ gupnp_dlna_profile_get_image_restrictions (GUPnPDLNAProfile *profile)
GList *
gupnp_dlna_profile_get_video_restrictions (GUPnPDLNAProfile *profile)
{
- g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE (profile), NULL);
+ g_return_val_if_fail (GUPNP_DLNA_IS_PROFILE (profile), NULL);
+ GUPnPDLNAProfilePrivate *priv =
+ gupnp_dlna_profile_get_instance_private (profile);
- return profile->priv->video_restrictions;
+ return priv->video_restrictions;
}
GUPnPDLNAProfile *
diff --git a/libgupnp-dlna/gupnp-dlna-profile.h b/libgupnp-dlna/gupnp-dlna-profile.h
index 7f400ed..5a649cf 100644
--- a/libgupnp-dlna/gupnp-dlna-profile.h
+++ b/libgupnp-dlna/gupnp-dlna-profile.h
@@ -29,55 +29,31 @@
G_BEGIN_DECLS
-#define GUPNP_TYPE_DLNA_PROFILE gupnp_dlna_profile_get_type()
-
-#define GUPNP_DLNA_PROFILE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_PROFILE, \
- GUPnPDLNAProfile))
-
-#define GUPNP_DLNA_PROFILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_PROFILE, \
- GUPnPDLNAProfileClass))
-
-#define GUPNP_IS_DLNA_PROFILE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_PROFILE))
-
-#define GUPNP_IS_DLNA_PROFILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_PROFILE))
-
-#define GUPNP_DLNA_PROFILE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_PROFILE, \
- GUPnPDLNAProfileClass))
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAProfile,
+ gupnp_dlna_profile,
+ GUPNP_DLNA,
+ PROFILE,
+ GObject)
-typedef struct _GUPnPDLNAProfilePrivate GUPnPDLNAProfilePrivate;
+#define GUPNP_TYPE_DLNA_PROFILE gupnp_dlna_profile_get_type()
+// Backwards-compatible defines
/**
- * GUPnPDLNAProfile:
- *
- * The top-level object used for the in-memory representation of the
- * DLNA Profiles.
+ * GUPNP_IS_DLNA_PROFILE: (skip)
*/
-typedef struct {
- GObject parent;
-
- GUPnPDLNAProfilePrivate *priv;
-} GUPnPDLNAProfile;
+#define GUPNP_IS_DLNA_PROFILE GUPNP_DLNA_IS_PROFILE
+/**
+ * GUPNP_IS_DLNA_PROFILE_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_PROFILE_CLASS GUPNP_DLNA_IS_PROFILE_CLASS
/**
* GUPnPDLNAProfileClass:
* @parent_class: A #GObjectClass - parent of this class.
*/
-typedef struct {
+struct _GUPnPDLNAProfileClass {
GObjectClass parent_class;
-} GUPnPDLNAProfileClass;
-
-GType
-gupnp_dlna_profile_get_type (void);
+};
const gchar *
gupnp_dlna_profile_get_name (GUPnPDLNAProfile *profile);
diff --git a/libgupnp-dlna/gupnp-dlna-video-information.c b/libgupnp-dlna/gupnp-dlna-video-information.c
index 6a0df92..08a4373 100644
--- a/libgupnp-dlna/gupnp-dlna-video-information.c
+++ b/libgupnp-dlna/gupnp-dlna-video-information.c
@@ -52,6 +52,9 @@ struct _GUPnPDLNAVideoInformationPrivate {
gpointer placeholder;
};
+typedef struct _GUPnPDLNAVideoInformationPrivate
+ GUPnPDLNAVideoInformationPrivate;
+
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GUPnPDLNAVideoInformation,
gupnp_dlna_video_information,
G_TYPE_OBJECT)
@@ -76,10 +79,6 @@ gupnp_dlna_video_information_class_init
static void
gupnp_dlna_video_information_init (GUPnPDLNAVideoInformation *info)
{
- GUPnPDLNAVideoInformationPrivate *priv =
- gupnp_dlna_video_information_get_instance_private (info);
-
- info->priv = priv;
}
/**
@@ -93,13 +92,13 @@ gupnp_dlna_video_information_get_bitrate (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_bitrate != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -118,13 +117,13 @@ gupnp_dlna_video_information_get_framerate (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_FRACTION_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_FRACTION_VALUE_UNSET);
g_return_val_if_fail (info_class->get_framerate != NULL,
GUPNP_DLNA_FRACTION_VALUE_UNSET);
@@ -143,13 +142,13 @@ gupnp_dlna_video_information_get_height (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_height != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -168,13 +167,13 @@ gupnp_dlna_video_information_is_interlaced (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_BOOL_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_BOOL_VALUE_UNSET);
g_return_val_if_fail (info_class->is_interlaced != NULL,
GUPNP_DLNA_BOOL_VALUE_UNSET);
@@ -193,13 +192,13 @@ gupnp_dlna_video_information_get_level (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_level != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -218,13 +217,13 @@ gupnp_dlna_video_information_get_mpeg_version (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mpeg_version != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -244,13 +243,13 @@ gupnp_dlna_video_information_get_pixel_aspect_ratio
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_FRACTION_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_FRACTION_VALUE_UNSET);
g_return_val_if_fail (info_class->get_pixel_aspect_ratio != NULL,
GUPNP_DLNA_FRACTION_VALUE_UNSET);
@@ -269,13 +268,13 @@ gupnp_dlna_video_information_get_profile (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_profile != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
@@ -294,13 +293,13 @@ gupnp_dlna_video_information_is_system_stream (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_BOOL_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_BOOL_VALUE_UNSET);
g_return_val_if_fail (info_class->is_system_stream != NULL,
GUPNP_DLNA_BOOL_VALUE_UNSET);
@@ -319,13 +318,13 @@ gupnp_dlna_video_information_get_width (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_INT_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_INT_VALUE_UNSET);
g_return_val_if_fail (info_class->get_width != NULL,
GUPNP_DLNA_INT_VALUE_UNSET);
@@ -344,13 +343,13 @@ gupnp_dlna_video_information_get_mime (GUPnPDLNAVideoInformation *info)
{
GUPnPDLNAVideoInformationClass *info_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_VIDEO_INFORMATION (info),
+ g_return_val_if_fail (GUPNP_DLNA_IS_VIDEO_INFORMATION (info),
GUPNP_DLNA_STRING_VALUE_UNSET);
info_class = GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS (info);
g_return_val_if_fail
- (GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS (info_class),
+ (GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS (info_class),
GUPNP_DLNA_STRING_VALUE_UNSET);
g_return_val_if_fail (info_class->get_mime != NULL,
GUPNP_DLNA_STRING_VALUE_UNSET);
diff --git a/libgupnp-dlna/gupnp-dlna-video-information.h b/libgupnp-dlna/gupnp-dlna-video-information.h
index 778d631..c91d352 100644
--- a/libgupnp-dlna/gupnp-dlna-video-information.h
+++ b/libgupnp-dlna/gupnp-dlna-video-information.h
@@ -27,40 +27,25 @@
G_BEGIN_DECLS
-#define GUPNP_TYPE_DLNA_VIDEO_INFORMATION \
- (gupnp_dlna_video_information_get_type())
-
-#define GUPNP_DLNA_VIDEO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_VIDEO_INFORMATION, \
- GUPnPDLNAVideoInformation))
-
-#define GUPNP_DLNA_VIDEO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_VIDEO_INFORMATION, \
- GUPnPDLNAVideoInformationClass))
-
-#define GUPNP_IS_DLNA_VIDEO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_VIDEO_INFORMATION))
-
-#define GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_VIDEO_INFORMATION))
-
-#define GUPNP_DLNA_VIDEO_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_VIDEO_INFORMATION, \
- GUPnPDLNAVideoInformationClass))
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAVideoInformation,
+ gupnp_dlna_video_information,
+ GUPNP_DLNA,
+ VIDEO_INFORMATION,
+ GObject)
-typedef struct _GUPnPDLNAVideoInformationPrivate
- GUPnPDLNAVideoInformationPrivate;
-typedef struct {
- GObject parent;
+#define GUPNP_TYPE_DLNA_VIDEO_INFORMATION \
+ (gupnp_dlna_video_information_get_type())
- GUPnPDLNAVideoInformationPrivate *priv;
-} GUPnPDLNAVideoInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_VIDEO_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_VIDEO_INFORMATION GUPNP_DLNA_IS_VIDEO_INFORMATION
+/**
+ * GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS GUPNP_DLNA_IS_VIDEO_INFORMATION_CLASS
/**
* GUPnPDLNAVideoInformationClass:
@@ -89,7 +74,7 @@ typedef struct {
* type.
* @_reserved: Padding. Ignore it.
*/
-typedef struct {
+struct _GUPnPDLNAVideoInformationClass {
GObjectClass parent_class;
GUPnPDLNAIntValue
@@ -126,10 +111,7 @@ typedef struct {
(* get_mime) (GUPnPDLNAVideoInformation *info);
gpointer _reserved[12];
-} GUPnPDLNAVideoInformationClass;
-
-GType
-gupnp_dlna_video_information_get_type (void);
+};
GUPnPDLNAIntValue
gupnp_dlna_video_information_get_bitrate (GUPnPDLNAVideoInformation *info);
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
index 0f8a5a0..512d3e1 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.c
@@ -25,12 +25,19 @@
#include "gupnp-dlna-gst-audio-information.h"
#include "gupnp-dlna-gst-info-utils.h"
+
struct _GUPnPDLNAGstAudioInformationPrivate {
GstDiscovererInfo *info;
GList *stream_list;
GstDiscovererAudioInfo *audio_info;
GstCaps *caps;
};
+typedef struct _GUPnPDLNAGstAudioInformationPrivate
+ GUPnPDLNAGstAudioInformationPrivate;
+
+struct _GUPnPDLNAGstAudioInformation {
+ GObject parent;
+};
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAGstAudioInformation,
gupnp_dlna_gst_audio_information,
@@ -46,7 +53,9 @@ enum
static GstDiscovererAudioInfo *
get_audio_info (GUPnPDLNAGstAudioInformation *gst_info)
{
- GUPnPDLNAGstAudioInformationPrivate *priv = gst_info->priv;
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (
+ gst_info);
if (!priv->audio_info) {
GList *iter;
@@ -103,8 +112,10 @@ get_audio_info (GUPnPDLNAGstAudioInformation *gst_info)
static GstCaps *
get_caps (GUPnPDLNAGstAudioInformation *gst_info)
{
- GUPnPDLNAGstAudioInformationPrivate *priv = gst_info->priv;
GstDiscovererStreamInfo *info = GST_DISCOVERER_STREAM_INFO (get_audio_info (gst_info));
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (
+ gst_info);
if (!priv->caps)
priv->caps = gst_discoverer_stream_info_get_caps (info);
@@ -119,9 +130,11 @@ get_int_value (GUPnPDLNAGstAudioInformation *gst_info,
GstCaps *caps = get_caps (gst_info);
GstDiscovererStreamInfo *stream =
GST_DISCOVERER_STREAM_INFO (get_audio_info (gst_info));
- GstDiscovererInfo *info = gst_info->priv->info;
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (
+ gst_info);
- return gupnp_dlna_gst_get_int_value (caps, stream, info, name);
+ return gupnp_dlna_gst_get_int_value (caps, stream, priv->info, name);
}
static GUPnPDLNAStringValue
@@ -131,9 +144,11 @@ get_string_value (GUPnPDLNAGstAudioInformation *gst_info,
GstCaps *caps = get_caps (gst_info);
GstDiscovererStreamInfo *stream =
GST_DISCOVERER_STREAM_INFO (get_audio_info (gst_info));
- GstDiscovererInfo *info = gst_info->priv->info;
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (
+ gst_info);
- return gupnp_dlna_gst_get_string_value (caps, stream, info, name);
+ return gupnp_dlna_gst_get_string_value (caps, stream, priv->info, name);
}
static GUPnPDLNAIntValue
@@ -282,7 +297,8 @@ gupnp_dlna_gst_audio_information_dispose (GObject *object)
{
GUPnPDLNAGstAudioInformation *info =
GUPNP_DLNA_GST_AUDIO_INFORMATION (object);
- GUPnPDLNAGstAudioInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (info);
GObjectClass *parent_class =
G_OBJECT_CLASS (gupnp_dlna_gst_audio_information_parent_class);
@@ -303,7 +319,8 @@ gupnp_dlna_gst_audio_information_set_property (GObject *object,
{
GUPnPDLNAGstAudioInformation *info =
GUPNP_DLNA_GST_AUDIO_INFORMATION (object);
- GUPnPDLNAGstAudioInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (info);
switch (property_id) {
case PROP_INFO:
@@ -327,7 +344,8 @@ gupnp_dlna_gst_audio_information_get_property (GObject *object,
{
GUPnPDLNAGstAudioInformation *info =
GUPNP_DLNA_GST_AUDIO_INFORMATION (object);
- GUPnPDLNAGstAudioInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstAudioInformationPrivate *priv =
+ gupnp_dlna_gst_audio_information_get_instance_private (info);
switch (property_id) {
case PROP_INFO:
@@ -382,14 +400,6 @@ gupnp_dlna_gst_audio_information_class_init
static void
gupnp_dlna_gst_audio_information_init (GUPnPDLNAGstAudioInformation *self)
{
- GUPnPDLNAGstAudioInformationPrivate *priv =
- gupnp_dlna_gst_audio_information_get_instance_private (self);
-
- priv->info = NULL;
- priv->stream_list = NULL;
- priv->audio_info = NULL;
- priv->caps = NULL;
- self->priv = priv;
}
GUPnPDLNAGstAudioInformation *
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.h
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.h
index 4e8f8e1..d092314 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.h
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-audio-information.h
@@ -28,44 +28,29 @@
G_BEGIN_DECLS
+G_DECLARE_FINAL_TYPE (GUPnPDLNAGstAudioInformation,
+ gupnp_dlna_gst_audio_information,
+ GUPNP_DLNA,
+ GST_AUDIO_INFORMATION,
+ GUPnPDLNAAudioInformation)
+
#define GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION \
(gupnp_dlna_gst_audio_information_get_type())
-#define GUPNP_DLNA_GST_AUDIO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION, \
- GUPnPDLNAGstAudioInformation))
-
-#define GUPNP_DLNA_GST_AUDIO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION, \
- GUPnPDLNAGstAudioInformationClass))
-
-#define GUPNP_IS_DLNA_GST_AUDIO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION))
-
-#define GUPNP_IS_DLNA_GST_AUDIO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION))
-
-#define GUPNP_DLNA_GST_AUDIO_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_GST_AUDIO_INFORMATION, \
- GUPnPDLNAGstAudioInformationClass))
-
-typedef struct _GUPnPDLNAGstAudioInformationPrivate
- GUPnPDLNAGstAudioInformationPrivate;
-
-typedef struct {
- GUPnPDLNAAudioInformation parent;
-
- GUPnPDLNAGstAudioInformationPrivate *priv;
-} GUPnPDLNAGstAudioInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_GST_AUDIO_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_GST_AUDIO_INFORMATION GUPNP_DLNA_IS_GST_AUDIO_INFORMATION
+/**
+ * GUPNP_IS_DLNA_GST_AUDIO_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_GST_AUDIO_INFORMATION_CLASS \
+ GUPNP_DLNA_IS_GST_AUDIO_INFORMATION_CLASS
-typedef struct {
+struct _GUPnPDLNAGstAudioInformationClass {
GUPnPDLNAAudioInformationClass parent_class;
-} GUPnPDLNAGstAudioInformationClass;
+};
GType
gupnp_dlna_gst_audio_information_get_type (void);
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
index 22faa26..f245836 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.c
@@ -30,6 +30,12 @@ struct _GUPnPDLNAGstContainerInformationPrivate {
GstDiscovererStreamInfo *container_info;
GstCaps *caps;
};
+typedef struct _GUPnPDLNAGstContainerInformationPrivate
+ GUPnPDLNAGstContainerInformationPrivate;
+
+struct _GUPnPDLNAGstContainerInformation{
+ GUPnPDLNAContainerInformation parent;
+};
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAGstContainerInformation,
gupnp_dlna_gst_container_information,
@@ -45,7 +51,9 @@ enum
static GstDiscovererStreamInfo *
get_container_info (GUPnPDLNAGstContainerInformation *gst_info)
{
- GUPnPDLNAGstContainerInformationPrivate *priv = gst_info->priv;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ gst_info);
if (!priv->container_info) {
priv->container_info =
@@ -58,7 +66,9 @@ get_container_info (GUPnPDLNAGstContainerInformation *gst_info)
static GstCaps *
get_caps (GUPnPDLNAGstContainerInformation *gst_info)
{
- GUPnPDLNAGstContainerInformationPrivate *priv = gst_info->priv;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ gst_info);
if (!priv->caps) {
priv->caps = gst_discoverer_stream_info_get_caps
@@ -74,9 +84,11 @@ get_int_value (GUPnPDLNAGstContainerInformation *gst_info,
{
GstCaps *caps = get_caps (gst_info);
GstDiscovererStreamInfo *stream = get_container_info (gst_info);
- GstDiscovererInfo *info = gst_info->priv->info;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ gst_info);
- return gupnp_dlna_gst_get_int_value (caps, stream, info, name);
+ return gupnp_dlna_gst_get_int_value (caps, stream, priv->info, name);
}
static GUPnPDLNAStringValue
@@ -85,9 +97,11 @@ get_string_value (GUPnPDLNAGstContainerInformation *gst_info,
{
GstCaps *caps = get_caps (gst_info);
GstDiscovererStreamInfo *stream = get_container_info (gst_info);
- GstDiscovererInfo *info = gst_info->priv->info;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ gst_info);
- return gupnp_dlna_gst_get_string_value (caps, stream, info, name);
+ return gupnp_dlna_gst_get_string_value (caps, stream, priv->info, name);
}
static GUPnPDLNABoolValue
@@ -96,9 +110,11 @@ get_bool_value (GUPnPDLNAGstContainerInformation *gst_info,
{
GstCaps *caps = get_caps (gst_info);
GstDiscovererStreamInfo *stream = get_container_info (gst_info);
- GstDiscovererInfo *info = gst_info->priv->info;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ gst_info);
- return gupnp_dlna_gst_get_bool_value (caps, stream, info, name);
+ return gupnp_dlna_gst_get_bool_value (caps, stream, priv->info, name);
}
static GUPnPDLNAIntValue
@@ -160,7 +176,9 @@ gupnp_dlna_gst_container_information_dispose (GObject *object)
{
GUPnPDLNAGstContainerInformation *info =
GUPNP_DLNA_GST_CONTAINER_INFORMATION (object);
- GUPnPDLNAGstContainerInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ info);
GObjectClass *parent_class =
G_OBJECT_CLASS (gupnp_dlna_gst_container_information_parent_class);
@@ -179,7 +197,9 @@ gupnp_dlna_gst_container_information_set_property (GObject *object,
{
GUPnPDLNAGstContainerInformation *info =
GUPNP_DLNA_GST_CONTAINER_INFORMATION (object);
- GUPnPDLNAGstContainerInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ info);
switch (property_id) {
case PROP_INFO:
@@ -203,7 +223,9 @@ gupnp_dlna_gst_container_information_get_property (GObject *object,
{
GUPnPDLNAGstContainerInformation *info =
GUPNP_DLNA_GST_CONTAINER_INFORMATION (object);
- GUPnPDLNAGstContainerInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstContainerInformationPrivate *priv =
+ gupnp_dlna_gst_container_information_get_instance_private (
+ info);
switch (property_id) {
case PROP_INFO:
@@ -253,8 +275,6 @@ static void
gupnp_dlna_gst_container_information_init
(GUPnPDLNAGstContainerInformation *self)
{
- self->priv = gupnp_dlna_gst_container_information_get_instance_private
- (self);
}
GUPnPDLNAGstContainerInformation *
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.h
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.h
index c480ca6..2f827bb 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.h
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-container-information.h
@@ -28,45 +28,28 @@
G_BEGIN_DECLS
+G_DECLARE_FINAL_TYPE (GUPnPDLNAGstContainerInformation,
+ gupnp_dlna_gst_container_information,
+ GUPNP_DLNA,
+ GST_CONTAINER_INFORMATION,
+ GUPnPDLNAContainerInformation)
+
#define GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION \
(gupnp_dlna_gst_container_information_get_type())
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_GST_DLNA_CONTAINER_INFORMATION: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_CONTAINER_INFORMATION GUPNP_DLNA_IS_GST_CONTAINER_INFORMATION
+/**
+ * GUPNP_IS_GST_DLNA_CONTAINER_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_CONTAINER_INFORMATION_CLASS \
+ GUPNP_DLNA_IS_GST_CONTAINER_INFORMATION_CLASS
-#define GUPNP_DLNA_GST_CONTAINER_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), \
- GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION, \
- GUPnPDLNAGstContainerInformation))
-
-#define GUPNP_DLNA_GST_CONTAINER_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION, \
- GUPnPDLNAGstContainerInformationClass))
-
-#define GUPNP_IS_DLNA_GST_CONTAINER_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION))
-
-#define GUPNP_IS_DLNA_GST_CONTAINER_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION))
-
-#define GUPNP_DLNA_GST_CONTAINER_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_GST_CONTAINER_INFORMATION, \
- GUPnPDLNAGstContainerInformationClass))
-
-typedef struct _GUPnPDLNAGstContainerInformationPrivate
- GUPnPDLNAGstContainerInformationPrivate;
-
-typedef struct {
- GUPnPDLNAContainerInformation parent;
-
- GUPnPDLNAGstContainerInformationPrivate *priv;
-} GUPnPDLNAGstContainerInformation;
-
-typedef struct {
+struct _GUPnPDLNAGstContainerInformationClass {
GUPnPDLNAContainerInformationClass parent_class;
-} GUPnPDLNAGstContainerInformationClass;
+};
GType
gupnp_dlna_gst_container_information_get_type (void);
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
index e594fff..733e7c1 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.c
@@ -31,6 +31,12 @@ struct _GUPnPDLNAGstImageInformationPrivate {
GstDiscovererVideoInfo *image_info;
GstCaps *caps;
};
+typedef struct _GUPnPDLNAGstImageInformationPrivate
+ GUPnPDLNAGstImageInformationPrivate;
+
+struct _GUPnPDLNAGstImageInformation {
+ GUPnPDLNAImageInformation parent;
+};
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAGstImageInformation,
gupnp_dlna_gst_image_information,
@@ -46,7 +52,9 @@ enum
static GstDiscovererVideoInfo *
get_image_info (GUPnPDLNAGstImageInformation *gst_info)
{
- GUPnPDLNAGstImageInformationPrivate *priv = gst_info->priv;
+ GUPnPDLNAGstImageInformationPrivate *priv =
+ gupnp_dlna_gst_image_information_get_instance_private (
+ gst_info);
if (!priv->image_info) {
GList *iter;
@@ -78,7 +86,9 @@ get_image_info (GUPnPDLNAGstImageInformation *gst_info)
static GstCaps *
get_caps (GUPnPDLNAGstImageInformation *gst_info)
{
- GUPnPDLNAGstImageInformationPrivate *priv = gst_info->priv;
+ GUPnPDLNAGstImageInformationPrivate *priv =
+ gupnp_dlna_gst_image_information_get_instance_private (
+ gst_info);
if (!priv->caps)
priv->caps = gst_discoverer_stream_info_get_caps
@@ -153,7 +163,8 @@ gupnp_dlna_gst_image_information_dispose (GObject *object)
{
GUPnPDLNAGstImageInformation *info =
GUPNP_DLNA_GST_IMAGE_INFORMATION (object);
- GUPnPDLNAGstImageInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstImageInformationPrivate *priv =
+ gupnp_dlna_gst_image_information_get_instance_private (info);
GObjectClass *parent_class =
G_OBJECT_CLASS (gupnp_dlna_gst_image_information_parent_class);
g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
@@ -173,7 +184,8 @@ gupnp_dlna_gst_image_information_set_property (GObject *object,
{
GUPnPDLNAGstImageInformation *info =
GUPNP_DLNA_GST_IMAGE_INFORMATION (object);
- GUPnPDLNAGstImageInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstImageInformationPrivate *priv =
+ gupnp_dlna_gst_image_information_get_instance_private (info);
switch (property_id) {
case PROP_INFO:
@@ -197,7 +209,8 @@ gupnp_dlna_gst_image_information_get_property (GObject *object,
{
GUPnPDLNAGstImageInformation *info =
GUPNP_DLNA_GST_IMAGE_INFORMATION (object);
- GUPnPDLNAGstImageInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstImageInformationPrivate *priv =
+ gupnp_dlna_gst_image_information_get_instance_private (info);
switch (property_id) {
case PROP_INFO:
@@ -244,7 +257,6 @@ gupnp_dlna_gst_image_information_class_init
static void
gupnp_dlna_gst_image_information_init (GUPnPDLNAGstImageInformation *self)
{
- self->priv = gupnp_dlna_gst_image_information_get_instance_private (self);
}
GUPnPDLNAGstImageInformation *
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.h
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.h
index 457ea61..2d4caa9 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.h
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-image-information.h
@@ -31,44 +31,26 @@ G_BEGIN_DECLS
#define GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION \
(gupnp_dlna_gst_image_information_get_type())
-#define GUPNP_DLNA_GST_IMAGE_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION, \
- GUPnPDLNAGstImageInformation))
-
-#define GUPNP_DLNA_GST_IMAGE_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION, \
- GUPnPDLNAGstImageInformationClass))
-
-#define GUPNP_IS_DLNA_GST_IMAGE_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION))
-
-#define GUPNP_IS_DLNA_GST_IMAGE_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION))
-
-#define GUPNP_DLNA_GST_IMAGE_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_GST_IMAGE_INFORMATION, \
- GUPnPDLNAGstImageInformationClass))
-
-typedef struct _GUPnPDLNAGstImageInformationPrivate
- GUPnPDLNAGstImageInformationPrivate;
-
-typedef struct {
- GUPnPDLNAImageInformation parent;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_GST_DLNA_IMAGE_INFORMATION: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_IMAGE_INFORMATION GUPNP_DLNA_IS_IMAGE_INFORMATION
+/**
+ * GUPNP_IS_GST_DLNA_IMAGE_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_IMAGE_INFORMATION_CLASS \
+ GUPNP_DLNA_IS_IMAGE_INFORMATION_CLASS
- GUPnPDLNAGstImageInformationPrivate *priv;
-} GUPnPDLNAGstImageInformation;
+G_DECLARE_FINAL_TYPE (GUPnPDLNAGstImageInformation,
+ gupnp_dlna_gst_image_information,
+ GUPNP_DLNA,
+ GST_IMAGE_INFORMATION,
+ GUPnPDLNAImageInformation)
-typedef struct {
+struct _GUPnPDLNAGstImageInformationClass {
GUPnPDLNAImageInformationClass parent_class;
-} GUPnPDLNAGstImageInformationClass;
-
-GType
-gupnp_dlna_gst_image_information_get_type (void);
+};
GUPnPDLNAGstImageInformation *
gupnp_dlna_gst_image_information_new_from_discoverer_info
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
index 08f1efa..205f8d0 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.c
@@ -33,6 +33,12 @@ struct _GUPnPDLNAGstInformationPrivate {
GstDiscovererInfo* info;
};
+typedef struct _GUPnPDLNAGstInformationPrivate GUPnPDLNAGstInformationPrivate;
+
+struct _GUPnPDLNAGstInformation {
+ GUPnPDLNAInformation parent;
+};
+
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAGstInformation,
gupnp_dlna_gst_information,
GUPNP_TYPE_DLNA_INFORMATION)
@@ -47,7 +53,8 @@ static void
gupnp_dlna_gst_information_dispose (GObject *object)
{
GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (object);
- GUPnPDLNAGstInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
g_clear_pointer (&priv->info, gupnp_dlna_gst_discoverer_info_unref);
G_OBJECT_CLASS
@@ -61,7 +68,8 @@ gupnp_dlna_gst_information_set_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (object);
- GUPnPDLNAGstInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
switch (property_id) {
case PROP_INFO:
@@ -86,7 +94,8 @@ gupnp_dlna_gst_information_get_property (GObject *object,
GParamSpec *pspec)
{
GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (object);
- GUPnPDLNAGstInformationPrivate *priv = info->priv;
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
switch (property_id) {
case PROP_INFO:
@@ -104,47 +113,56 @@ gupnp_dlna_gst_information_get_property (GObject *object,
GUPnPDLNAAudioInformation *
backend_get_audio_information (GUPnPDLNAInformation *self)
{
- GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
-
- if (gst_info == NULL)
+ if (!GUPNP_DLNA_IS_GST_INFORMATION (self))
return NULL;
- return GUPNP_DLNA_AUDIO_INFORMATION
- (gupnp_dlna_gst_audio_information_new_from_discoverer_info
- (gst_info->priv->info));
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (self);
+
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
+
+ return GUPNP_DLNA_AUDIO_INFORMATION (
+ gupnp_dlna_gst_audio_information_new_from_discoverer_info (
+ priv->info));
}
GUPnPDLNAContainerInformation *
backend_get_container_information (GUPnPDLNAInformation *self)
{
- GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
-
- if (gst_info == NULL)
+ if (!GUPNP_DLNA_IS_GST_INFORMATION (self))
return NULL;
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (self);
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
+
return GUPNP_DLNA_CONTAINER_INFORMATION
(gupnp_dlna_gst_container_information_new_from_discoverer_info
- (gst_info->priv->info));
+ (priv->info));
}
GUPnPDLNAImageInformation *
backend_get_image_information (GUPnPDLNAInformation *self)
{
- GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (self);
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
- return GUPNP_DLNA_IMAGE_INFORMATION
- (gupnp_dlna_gst_image_information_new_from_discoverer_info
- (gst_info->priv->info));
+ return GUPNP_DLNA_IMAGE_INFORMATION (
+ gupnp_dlna_gst_image_information_new_from_discoverer_info (
+ priv->info));
}
GUPnPDLNAVideoInformation *
backend_get_video_information (GUPnPDLNAInformation *self)
{
- GUPnPDLNAGstInformation *gst_info = GUPNP_DLNA_GST_INFORMATION (self);
+ GUPnPDLNAGstInformation *info = GUPNP_DLNA_GST_INFORMATION (self);
+ GUPnPDLNAGstInformationPrivate *priv =
+ gupnp_dlna_gst_information_get_instance_private (info);
- return GUPNP_DLNA_VIDEO_INFORMATION
- (gupnp_dlna_gst_video_information_new_from_discoverer_info
- (gst_info->priv->info));
+ return GUPNP_DLNA_VIDEO_INFORMATION (
+ gupnp_dlna_gst_video_information_new_from_discoverer_info (
+ priv->info));
}
static void
@@ -179,7 +197,6 @@ gupnp_dlna_gst_information_class_init
static void
gupnp_dlna_gst_information_init (GUPnPDLNAGstInformation *self)
{
- self->priv = gupnp_dlna_gst_information_get_instance_private (self);
}
GUPnPDLNAGstInformation *
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.h
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.h
index fb17b44..c051257 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.h
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-information.h
@@ -30,45 +30,26 @@
G_BEGIN_DECLS
+G_DECLARE_FINAL_TYPE (GUPnPDLNAGstInformation,
+ gupnp_dlna_gst_information,
+ GUPNP_DLNA,
+ GST_INFORMATION,
+ GUPnPDLNAInformation)
#define GUPNP_TYPE_DLNA_GST_INFORMATION (gupnp_dlna_gst_information_get_type())
-#define GUPNP_DLNA_GST_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_GST_INFORMATION, \
- GUPnPDLNAGstInformation))
-
-#define GUPNP_DLNA_GST_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_GST_INFORMATION, \
- GUPnPDLNAGstInformationClass))
-
-#define GUPNP_IS_DLNA_GST_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_GST_INFORMATION))
-
-#define GUPNP_IS_DLNA_GST_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_GST_INFORMATION))
-
-#define GUPNP_DLNA_GST_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_GST_INFORMATION, \
- GUPnPDLNAGstInformationClass))
-
-typedef struct _GUPnPDLNAGstInformationPrivate GUPnPDLNAGstInformationPrivate;
-
-typedef struct {
- GUPnPDLNAInformation parent;
-
- GUPnPDLNAGstInformationPrivate *priv;
-} GUPnPDLNAGstInformation;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_GST_DLNA_INFORMATION: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_INFORMATION GUPNP_DLNA_IS_GST_IMAGE_INFORMATION
+/**
+ * GUPNP_IS_GST_DLNA_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_INFORMATION_CLASS GUPNP_DLNA_IS_GST_IMAGE_INFORMATION_CLASS
-typedef struct {
+struct _GUPnPDLNAGstInformationClass {
GUPnPDLNAInformationClass parent_class;
-} GUPnPDLNAGstInformationClass;
-
-GType
-gupnp_dlna_gst_information_get_type (void);
+};
GUPnPDLNAGstInformation *
gupnp_dlna_gst_information_new_from_discoverer_info (const gchar *uri,
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
index 702d634..9c4d4f9 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.c
@@ -26,19 +26,37 @@
#include "gupnp-dlna-gst-information.h"
#include "gupnp-dlna-gst-utils.h"
-struct _GUPnPDLNAGstMetadataExtractorPrivate {
- gpointer placeholder;
+typedef struct _GUPnPDLNAGstMetadataExtractorPrivate
+ GUPnPDLNAGstMetadataExtractorPrivate;
+
+/**
+ * GUPnPDLNAGstMetadataExtractor:
+ *
+ * The top-level object used to for metadata extraction.
+ */
+struct _GUPnPDLNAGstMetadataExtractor {
+ GUPnPDLNAMetadataExtractor parent;
+
+ GUPnPDLNAGstMetadataExtractorPrivate *priv;
};
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_GST_METADATA_BACKEND: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_METADATA_BACKEND GUPNP_DLNA_IS_GST_METADATA_BACKEND
+/**
+ * GUPNP_IS_GST_DLNA_METADATA_BACKEND_CLASS: (skip)
+ */
+#define GUPNP_IS_GST_DLNA_METADATA_BACKEND_CLASS GUPNP_DLNA_IS_GST_METADATA_BACKEND_CLASS
-G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAGstMetadataExtractor,
- gupnp_dlna_gst_metadata_extractor,
- GUPNP_TYPE_DLNA_METADATA_EXTRACTOR)
+G_DEFINE_TYPE (GUPnPDLNAGstMetadataExtractor,
+ gupnp_dlna_gst_metadata_extractor,
+ GUPNP_TYPE_DLNA_METADATA_EXTRACTOR)
static gboolean
unref_discoverer_in_idle (GstDiscoverer *discoverer)
{
- if (discoverer)
- g_object_unref (discoverer);
+ g_clear_object (&discoverer);
return FALSE;
}
@@ -142,7 +160,6 @@ gupnp_dlna_gst_metadata_extractor_class_init
static void
gupnp_dlna_gst_metadata_extractor_init (GUPnPDLNAGstMetadataExtractor *self)
{
- self->priv = gupnp_dlna_gst_metadata_extractor_get_instance_private (self);
}
GUPnPDLNAGstMetadataExtractor *
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.h
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.h
index f1bd6ca..dcef839 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.h
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-metadata-extractor.h
@@ -33,49 +33,16 @@ G_BEGIN_DECLS
#define GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR \
(gupnp_dlna_gst_metadata_extractor_get_type())
-#define GUPNP_DLNA_GST_METADATA_EXTRACTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR, \
- GUPnPDLNAGstMetadataExtractor))
+G_DECLARE_FINAL_TYPE (GUPnPDLNAGstMetadataExtractor,
+ gupnp_dlna_gst_metadata_extractor,
+ GUPNP_DLNA,
+ GST_METADATA_EXTRACTOR,
+ GUPnPDLNAMetadataExtractor)
-#define GUPNP_DLNA_GST_METADATA_EXTRACTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR, \
- GUPnPDLNAGstMetadataExtractorClass))
-#define GUPNP_IS_DLNA_GST_METADATA_EXTRACTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR))
-
-#define GUPNP_IS_DLNA_GST_METADATA_EXTRACTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR))
-
-#define GUPNP_DLNA_GST_METADATA_EXTRACTOR_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_GST_METADATA_EXTRACTOR, \
- GUPnPDLNAGstMetadataExtractorClass))
-
-typedef struct _GUPnPDLNAGstMetadataExtractorPrivate
- GUPnPDLNAGstMetadataExtractorPrivate;
-
-/**
- * GUPnPDLNAGstMetadataExtractor:
- *
- * The top-level object used to for metadata extraction.
- */
-typedef struct {
- GUPnPDLNAMetadataExtractor parent;
-
- GUPnPDLNAGstMetadataExtractorPrivate *priv;
-} GUPnPDLNAGstMetadataExtractor;
-
-typedef struct {
+struct _GUPnPDLNAGstMetadataExtractorClass {
GUPnPDLNAMetadataExtractorClass parent_class;
-} GUPnPDLNAGstMetadataExtractorClass;
-
-GType
-gupnp_dlna_gst_metadata_extractor_get_type (void);
+};
GUPnPDLNAGstMetadataExtractor *
gupnp_dlna_gst_metadata_extractor_new (void);
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
index aee6a36..f35c1e1 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.c
@@ -32,6 +32,14 @@ struct _GUPnPDLNAGstVideoInformationPrivate {
GstCaps *caps;
};
+typedef struct _GUPnPDLNAGstVideoInformationPrivate GUPnPDLNAGstVideoInformationPrivate;
+
+struct _GUPnPDLNAGstVideoInformation {
+ GUPnPDLNAVideoInformation parent;
+
+ GUPnPDLNAGstVideoInformationPrivate *priv;
+};
+
G_DEFINE_TYPE_WITH_PRIVATE (GUPnPDLNAGstVideoInformation,
gupnp_dlna_gst_video_information,
GUPNP_TYPE_DLNA_VIDEO_INFORMATION)
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.h
b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.h
index 93ebbce..ecb2b9b 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.h
+++ b/libgupnp-dlna/metadata-backends/gstreamer/gupnp-dlna-gst-video-information.h
@@ -30,40 +30,25 @@ G_BEGIN_DECLS
#define GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION gupnp_dlna_gst_video_information_get_type()
-#define GUPNP_DLNA_GST_VIDEO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION, \
- GUPnPDLNAGstVideoInformation))
-
-#define GUPNP_DLNA_GST_VIDEO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION, \
- GUPnPDLNAGstVideoInformationClass))
-
-#define GUPNP_IS_DLNA_GST_VIDEO_INFORMATION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION))
-
-#define GUPNP_IS_DLNA_GST_VIDEO_INFORMATION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION))
-
-#define GUPNP_DLNA_GST_VIDEO_INFORMATION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_GST_VIDEO_INFORMATION, \
- GUPnPDLNAGstVideoInformationClass))
-
-typedef struct _GUPnPDLNAGstVideoInformationPrivate GUPnPDLNAGstVideoInformationPrivate;
-
-typedef struct {
- GUPnPDLNAVideoInformation parent;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_VIDEO_INFORMATION: (skip)
+ */
+#define GUPNP_IS_DLNA_GST_VIDEO_INFORMATION GUPNP_DLNA_IS_GST_VIDEO_INFORMATION
+/**
+ * GUPNP_IS_DLNA_VIDEO_INFORMATION_CLASS: (skip)
+ */
+#define GUPNP_IS_DLNA_GST_VIDEO_INFORMATION_CLASS GUPNP_DLNA_IS_GST_VIDEO_INFORMATION_CLASS
- GUPnPDLNAGstVideoInformationPrivate *priv;
-} GUPnPDLNAGstVideoInformation;
+G_DECLARE_FINAL_TYPE (GUPnPDLNAGstVideoInformation,
+ gupnp_dlna_gst_video_information,
+ GUPNP_DLNA,
+ GST_VIDEO_INFORMATION,
+ GUPnPDLNAVideoInformation)
-typedef struct {
+struct _GUPnPDLNAGstVideoInformationClass {
GUPnPDLNAVideoInformationClass parent_class;
-} GUPnPDLNAGstVideoInformationClass;
-
-GType gupnp_dlna_gst_video_information_get_type (void);
+};
GUPnPDLNAGstVideoInformation *
gupnp_dlna_gst_video_information_new_from_discoverer_info (GstDiscovererInfo *info);
diff --git a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
index 766a739..d78c75d 100644
--- a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
+++ b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
@@ -69,6 +69,9 @@ struct _GUPnPDLNAMetadataExtractorPrivate {
gpointer placeholder;
};
+typedef struct _GUPnPDLNAMetadataExtractorPrivate
+ GUPnPDLNAMetadataExtractorPrivate;
+
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GUPnPDLNAMetadataExtractor,
gupnp_dlna_metadata_extractor,
G_TYPE_OBJECT)
@@ -107,10 +110,6 @@ gupnp_dlna_metadata_extractor_class_init
static void
gupnp_dlna_metadata_extractor_init (GUPnPDLNAMetadataExtractor *self)
{
- GUPnPDLNAMetadataExtractorPrivate *priv =
- gupnp_dlna_metadata_extractor_get_instance_private (self);
-
- self->priv = priv;
}
/**
@@ -134,13 +133,13 @@ gupnp_dlna_metadata_extractor_extract_async
{
GUPnPDLNAMetadataExtractorClass *extractor_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_METADATA_EXTRACTOR (extractor),
+ g_return_val_if_fail (GUPNP_DLNA_IS_METADATA_EXTRACTOR (extractor),
FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
extractor_class = GUPNP_DLNA_METADATA_EXTRACTOR_GET_CLASS (extractor);
- g_return_val_if_fail (GUPNP_IS_DLNA_METADATA_EXTRACTOR_CLASS
+ g_return_val_if_fail (GUPNP_DLNA_IS_METADATA_EXTRACTOR_CLASS
(extractor_class),
FALSE);
g_return_val_if_fail (extractor_class->extract_async != NULL, FALSE);
@@ -172,13 +171,13 @@ gupnp_dlna_metadata_extractor_extract_sync
{
GUPnPDLNAMetadataExtractorClass *extractor_class;
- g_return_val_if_fail (GUPNP_IS_DLNA_METADATA_EXTRACTOR (extractor),
+ g_return_val_if_fail (GUPNP_DLNA_IS_METADATA_EXTRACTOR (extractor),
NULL);
g_return_val_if_fail (uri != NULL, NULL);
extractor_class = GUPNP_DLNA_METADATA_EXTRACTOR_GET_CLASS (extractor);
- g_return_val_if_fail (GUPNP_IS_DLNA_METADATA_EXTRACTOR_CLASS
+ g_return_val_if_fail (GUPNP_DLNA_IS_METADATA_EXTRACTOR_CLASS
(extractor_class),
NULL);
g_return_val_if_fail (extractor_class->extract_async != NULL, NULL);
@@ -206,8 +205,8 @@ gupnp_dlna_metadata_extractor_emit_done (GUPnPDLNAMetadataExtractor *extractor,
GUPnPDLNAInformation *info,
GError *error)
{
- g_return_if_fail (GUPNP_IS_DLNA_METADATA_EXTRACTOR (extractor));
- g_return_if_fail (GUPNP_IS_DLNA_INFORMATION (info));
+ g_return_if_fail (GUPNP_DLNA_IS_METADATA_EXTRACTOR (extractor));
+ g_return_if_fail (GUPNP_DLNA_IS_INFORMATION (info));
g_signal_emit (extractor, signals[DONE], 0, info, error);
}
diff --git a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.h
b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.h
index 610d28d..79f294f 100644
--- a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.h
+++ b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.h
@@ -29,45 +29,26 @@
G_BEGIN_DECLS
+G_DECLARE_DERIVABLE_TYPE (GUPnPDLNAMetadataExtractor,
+ gupnp_dlna_metadata_extractor,
+ GUPNP_DLNA,
+ METADATA_EXTRACTOR,
+ GObject)
+
#define GUPNP_TYPE_DLNA_METADATA_EXTRACTOR \
(gupnp_dlna_metadata_extractor_get_type())
-#define GUPNP_DLNA_METADATA_EXTRACTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GUPNP_TYPE_DLNA_METADATA_EXTRACTOR, \
- GUPnPDLNAMetadataExtractor))
-
-#define GUPNP_DLNA_METADATA_EXTRACTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GUPNP_TYPE_DLNA_METADATA_EXTRACTOR, \
- GUPnPDLNAMetadataExtractorClass))
-
-#define GUPNP_IS_DLNA_METADATA_EXTRACTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GUPNP_TYPE_DLNA_METADATA_EXTRACTOR))
-
-#define GUPNP_IS_DLNA_METADATA_EXTRACTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GUPNP_TYPE_DLNA_METADATA_EXTRACTOR))
-
-#define GUPNP_DLNA_METADATA_EXTRACTOR_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GUPNP_TYPE_DLNA_METADATA_EXTRACTOR, \
- GUPnPDLNAMetadataExtractorClass))
-
-typedef struct _GUPnPDLNAMetadataExtractorPrivate
- GUPnPDLNAMetadataExtractorPrivate;
+// Backwards-compatible defines
+/**
+ * GUPNP_IS_DLNA_METADATA_EXTRACTOR: (skip)
+ */
+#define GUPNP_IS_DLNA_METADATA_EXTRACTOR GUPNP_DLNA_IS_METADATA_EXTRACTOR
/**
- * GUPnPDLNAMetadataExtractor:
- *
- * The top-level object used to for metadata extraction.
+ * GUPNP_IS_DLNA_METADATA_EXTRACTOR_CLASS: (skip)
*/
-typedef struct {
- GObject parent;
+#define GUPNP_IS_DLNA_METADATA_EXTRACTOR_CLASS GUPNP_DLNA_IS_METADATA_EXTRACTOR_CLASS
- GUPnPDLNAMetadataExtractorPrivate *priv;
-} GUPnPDLNAMetadataExtractor;
/**
* GUPnPDLNAMetadataExtractorClass:
@@ -78,7 +59,7 @@ typedef struct {
* information about media file synchronously.
* @_reserved: Padding. Ignore it.
*/
-typedef struct {
+struct _GUPnPDLNAMetadataExtractorClass {
GObjectClass parent_class;
/* virtuals */
@@ -95,10 +76,7 @@ typedef struct {
GError **error);
gpointer _reserved[12];
-} GUPnPDLNAMetadataExtractorClass;
-
-GType
-gupnp_dlna_metadata_extractor_get_type (void);
+};
gboolean
gupnp_dlna_metadata_extractor_extract_async
diff --git a/meson.build b/meson.build
index 1d2f3b1..afbca02 100644
--- a/meson.build
+++ b/meson.build
@@ -9,7 +9,7 @@ gnome = import('gnome')
shareddir = join_paths(get_option('prefix'), get_option('datadir'), 'gupnp-dlna-2.0')
metadata_backend_dir = join_paths(get_option('prefix'), get_option('libdir'), 'gupnp-dlna')
-library_version = '3.0.0'
+library_version = '4.0.0'
config = configuration_data()
config.set_quoted('GUPNP_DLNA_DEFAULT_METADATA_BACKEND', get_option('default_backend'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]