Commit 39e64341 authored by W. Michael Petullo's avatar W. Michael Petullo

Big indent patch

Signed-off-by: W. Michael Petullo's avatarW. Michael Petullo <mike@flyn.org>
parent e8c41928
......@@ -31,7 +31,7 @@ struct DAAPConnectionPrivate {
*/
static DMAPContentCode
get_protocol_version_cc (DMAPConnection *connection)
get_protocol_version_cc (DMAPConnection * connection)
{
return DMAP_CC_APRO;
}
......@@ -48,7 +48,8 @@ get_query_metadata (void)
}
static DMAPRecord *
handle_mlcl (DMAPConnection *connection, DMAPRecordFactory *factory, GNode *n, int *item_id)
handle_mlcl (DMAPConnection * connection, DMAPRecordFactory * factory,
GNode * n, int *item_id)
{
GNode *n2;
DMAPRecord *record = NULL;
......@@ -73,53 +74,57 @@ handle_mlcl (DMAPConnection *connection, DMAPRecordFactory *factory, GNode *n, i
meta_item = n2->data;
switch (meta_item->content_code) {
case DMAP_CC_MIID:
*item_id = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_MINM:
title = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASAL:
album = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASAR:
artist = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASFM:
format = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASGN:
genre = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASTM:
length = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASTN:
track_number = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASDN:
disc_number = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASYR:
year = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASSZ:
size = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASBR:
bitrate = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASUL:
streamURI = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASSA:
sort_artist = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASSU:
sort_album = g_value_get_string (&(meta_item->content));
break;
default:
break;
case DMAP_CC_MIID:
*item_id = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_MINM:
title = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASAL:
album = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASAR:
artist = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASFM:
format = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASGN:
genre = g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASTM:
length = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASTN:
track_number =
g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASDN:
disc_number = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASYR:
year = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASSZ:
size = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASBR:
bitrate = g_value_get_int (&(meta_item->content));
break;
case DMAP_CC_ASUL:
streamURI =
g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASSA:
sort_artist =
g_value_get_string (&(meta_item->content));
break;
case DMAP_CC_ASSU:
sort_album =
g_value_get_string (&(meta_item->content));
break;
default:
break;
}
}
......@@ -128,68 +133,65 @@ handle_mlcl (DMAPConnection *connection, DMAPRecordFactory *factory, GNode *n, i
goto _return;
}
g_object_set (record,
"year", year,
"track", track_number,
"disc", disc_number,
"bitrate", bitrate,
"duration", length / 1000,
"filesize", (guint64) size,
"format", format,
"title", title,
"songalbum", album,
"songartist", artist,
"songgenre", genre,
"sort-artist", sort_artist,
"sort-album", sort_album,
NULL);
_return:
"year", year,
"track", track_number,
"disc", disc_number,
"bitrate", bitrate,
"duration", length / 1000,
"filesize", (guint64) size,
"format", format,
"title", title,
"songalbum", album,
"songartist", artist,
"songgenre", genre,
"sort-artist", sort_artist,
"sort-album", sort_album, NULL);
_return:
return record;
}
static void
daap_connection_class_init (DAAPConnectionClass *klass)
daap_connection_class_init (DAAPConnectionClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
DMAPConnectionClass *parent_class = DMAP_CONNECTION_CLASS (object_class);
DMAPConnectionClass *parent_class =
DMAP_CONNECTION_CLASS (object_class);
parent_class->get_protocol_version_cc = get_protocol_version_cc;
parent_class->get_query_metadata = get_query_metadata;
parent_class->handle_mlcl = handle_mlcl;
/* FIXME:
g_type_class_add_private (klass, sizeof (DAAPConnectionPrivate));
*/
* g_type_class_add_private (klass, sizeof (DAAPConnectionPrivate));
*/
}
DAAPConnection *
daap_connection_new (const char *name,
const char *host,
guint port,
gboolean password_protected,
DMAPDb *db,
DMAPRecordFactory *factory)
daap_connection_new (const char *name,
const char *host,
guint port,
gboolean password_protected,
DMAPDb * db, DMAPRecordFactory * factory)
{
DAAPConnection *connection;
connection = g_object_new (DAAP_TYPE_CONNECTION,
"name", name,
"password-protected", password_protected,
"db", db,
"host", host,
"port", port,
"factory", factory,
NULL);
"name", name,
"password-protected", password_protected,
"db", db,
"host", host,
"port", port, "factory", factory, NULL);
return connection;
}
static void
daap_connection_init (DAAPConnection *connection)
daap_connection_init (DAAPConnection * connection)
{
/* FIXME:
connection->priv = DAAP_CONNECTION_GET_PRIVATE (connection);
*/
* connection->priv = DAAP_CONNECTION_GET_PRIVATE (connection);
*/
}
G_DEFINE_TYPE (DAAPConnection, daap_connection, DMAP_TYPE_CONNECTION)
......@@ -23,7 +23,6 @@
#include <libdmapsharing/dmap-db.h>
G_BEGIN_DECLS
/**
* DAAP_TYPE_CONNECTION:
*
......@@ -71,26 +70,26 @@ G_BEGIN_DECLS
* Returns: pointer to object class structure.
*/
#define DAAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DAAP_TYPE_CONNECTION, DAAPConnectionClass))
typedef struct DAAPConnectionPrivate DAAPConnectionPrivate;
typedef struct {
typedef struct
{
DMAPConnectionClass dmap_connection_class;
} DAAPConnectionClass;
typedef struct {
typedef struct
{
DMAPConnection dmap_connection_instance;
DAAPConnectionPrivate *priv;
} DAAPConnection;
GType daap_connection_get_type (void);
GType daap_connection_get_type (void);
DAAPConnection * daap_connection_new (const char *name,
const char *host,
guint port,
gboolean password_protected,
DMAPDb *db,
DMAPRecordFactory *factory);
DAAPConnection *daap_connection_new (const char *name,
const char *host,
guint port,
gboolean password_protected,
DMAPDb * db,
DMAPRecordFactory * factory);
G_END_DECLS
#endif /* __DAAP_CONNECTION_H */
......@@ -23,184 +23,175 @@
static gint daap_record_init_count = 0;
static void
daap_record_init (DAAPRecordIface *iface)
daap_record_init (DAAPRecordIface * iface)
{
static gboolean is_initialized = FALSE;
daap_record_init_count++;
daap_record_init_count++;
if (! is_initialized) {
if (!is_initialized) {
g_object_interface_install_property (iface,
g_param_spec_string ("location",
"URI pointing to song data",
"URI pointing to song data",
NULL,
G_PARAM_READWRITE));
g_param_spec_string
("location",
"URI pointing to song data",
"URI pointing to song data",
NULL,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("title",
"Song title",
"Song title",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("title", "Song title",
"Song title", "Unknown",
G_PARAM_READWRITE));
/* FIXME: This is actually an enum */
g_object_interface_install_property (iface,
g_param_spec_int ("mediakind",
"Media kind",
"Media kind",
0,
G_MAXINT,
1,
G_PARAM_READWRITE));
g_param_spec_int
("mediakind",
"Media kind",
"Media kind", 0,
G_MAXINT, 1,
G_PARAM_READWRITE));
/* NOTE: the name must match the part after the last dot of the
DAAP name, so daap.songalbum becomes songalbum and so on.*/
* DAAP name, so daap.songalbum becomes songalbum and so on. */
g_object_interface_install_property (iface,
g_param_spec_string ("songalbum",
"Album name",
"Album name",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("songalbum",
"Album name",
"Album name", "Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int64 ("songalbumid",
"Album id",
"Album id",
G_MININT64,
G_MAXINT64,
0,
G_PARAM_READWRITE));
g_param_spec_int64
("songalbumid",
"Album id", "Album id",
G_MININT64, G_MAXINT64,
0, G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("sort-album",
"Album sort name",
"Album sort name",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("sort-album",
"Album sort name",
"Album sort name",
"Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("songartist",
"Song artist",
"Song artist",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("songartist",
"Song artist",
"Song artist",
"Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("sort-artist",
"Song artist sort name",
"Song artist sort name",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("sort-artist",
"Song artist sort name",
"Song artist sort name",
"Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("songgenre",
"Song genre",
"Song genre",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("songgenre",
"Song genre",
"Song genre", "Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_string ("format",
"Song data format",
"Song data format",
"Unknown",
G_PARAM_READWRITE));
g_param_spec_string
("format",
"Song data format",
"Song data format",
"Unknown",
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("rating",
"Song rating",
"Song rating",
0,
5,
0,
G_PARAM_READWRITE));
g_param_spec_int
("rating", "Song rating",
"Song rating", 0, 5, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_uint64 ("filesize",
"Song data size in bytes",
"Song data size in bytes",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_uint64
("filesize",
"Song data size in bytes",
"Song data size in bytes",
0, G_MAXINT, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("duration",
"Song duration in seconds",
"Song duration in seconds",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int
("duration",
"Song duration in seconds",
"Song duration in seconds",
0, G_MAXINT, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("track",
"Song track number",
"Song track number",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int
("track",
"Song track number",
"Song track number", 0,
G_MAXINT, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("year",
"Song publication year",
"Song publication year",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int ("year",
"Song publication year",
"Song publication year",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("firstseen",
"FIXME",
"FIXME",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int
("firstseen", "FIXME",
"FIXME", 0, G_MAXINT, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("mtime",
"Song modification time",
"Song modification time",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int
("mtime",
"Song modification time",
"Song modification time",
0, G_MAXINT, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("disc",
"Song disc number",
"Song disc number",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int ("disc",
"Song disc number",
"Song disc number",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_int ("bitrate",
"Song data bitrate in Kb/s",
"Song data bitrate in Kb/s",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
g_param_spec_int
("bitrate",
"Song data bitrate in Kb/s",
"Song data bitrate in Kb/s",
0, G_MAXINT, 0,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_boolean ("has-video",
"Song has video component",
"Song has video component",
FALSE,
G_PARAM_READWRITE));
g_param_spec_boolean
("has-video",
"Song has video component",
"Song has video component",
FALSE,
G_PARAM_READWRITE));
is_initialized = TRUE;
}
}
static void
daap_record_finalize (DAAPRecordIface *iface)
daap_record_finalize (DAAPRecordIface * iface)
{
daap_record_init_count--;
}
......@@ -210,34 +201,35 @@ GType
daap_record_get_type (void)
{
static GType object_type = 0;
if (!object_type) {
static const GTypeInfo object_info = {
sizeof(DAAPRecordIface),
sizeof (DAAPRecordIface),
(GBaseInitFunc) daap_record_init,
(GBaseFinalizeFunc) daap_record_finalize
};
object_type =
g_type_register_static(G_TYPE_INTERFACE,
"DAAPRecord",
&object_info, 0);
g_type_register_static (G_TYPE_INTERFACE,
"DAAPRecord",
&object_info, 0);
}
return object_type;
}
gboolean
daap_record_itunes_compat (DAAPRecord *record)
daap_record_itunes_compat (DAAPRecord * record)
{
return DAAP_RECORD_GET_INTERFACE (record)->itunes_compat (record);
}
GInputStream *
daap_record_read (DAAPRecord *record, GError **err)
daap_record_read (DAAPRecord * record, GError