Update media-service-upnp to version 0.3.0 ( ca17a69 )
[profile/ivi/media-service-upnp.git] / src / props.h
1 /*
2  * media-service-upnp
3  *
4  * Copyright (C) 2012 Intel Corporation. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU Lesser General Public License,
8  * version 2.1, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Mark Ryan <mark.d.ryan@intel.com>
20  *
21  */
22
23 #ifndef MSU_PROPS_H__
24 #define MSU_PROPS_H__
25
26 #include <libgupnp-av/gupnp-av.h>
27 #include "async.h"
28
29 enum msu_upnp_prop_mask_ {
30         MSU_UPNP_MASK_PROP_PARENT = 1,
31         MSU_UPNP_MASK_PROP_TYPE = 1 << 1,
32         MSU_UPNP_MASK_PROP_PATH = 1 << 2,
33         MSU_UPNP_MASK_PROP_DISPLAY_NAME = 1 << 3,
34         MSU_UPNP_MASK_PROP_CHILD_COUNT = 1 << 4,
35         MSU_UPNP_MASK_PROP_SEARCHABLE = 1 << 5,
36         MSU_UPNP_MASK_PROP_URLS = 1 << 6,
37         MSU_UPNP_MASK_PROP_MIME_TYPE = 1 << 7,
38         MSU_UPNP_MASK_PROP_ARTIST = 1 << 8,
39         MSU_UPNP_MASK_PROP_ALBUM = 1 << 9,
40         MSU_UPNP_MASK_PROP_DATE = 1 << 10,
41         MSU_UPNP_MASK_PROP_GENRE = 1 << 11,
42         MSU_UPNP_MASK_PROP_DLNA_PROFILE = 1 << 12,
43         MSU_UPNP_MASK_PROP_TRACK_NUMBER = 1 << 13,
44         MSU_UPNP_MASK_PROP_SIZE = 1 << 14,
45         MSU_UPNP_MASK_PROP_DURATION = 1 << 15,
46         MSU_UPNP_MASK_PROP_BITRATE = 1 << 16,
47         MSU_UPNP_MASK_PROP_SAMPLE_RATE = 1 << 17,
48         MSU_UPNP_MASK_PROP_BITS_PER_SAMPLE = 1 << 18,
49         MSU_UPNP_MASK_PROP_WIDTH = 1 << 19,
50         MSU_UPNP_MASK_PROP_HEIGHT = 1 << 20,
51         MSU_UPNP_MASK_PROP_COLOR_DEPTH = 1 << 21,
52         MSU_UPNP_MASK_PROP_ALBUM_ART_URL = 1 << 22,
53         MSU_UPNP_MASK_PROP_RESOURCES = 1 << 23,
54         MSU_UPNP_MASK_PROP_URL = 1 << 24,
55         MSU_UPNP_MASK_PROP_REFPATH = 1 << 25,
56         MSU_UPNP_MASK_PROP_RESTRICTED = 1 << 26,
57         MSU_UPNP_MASK_PROP_DLNA_MANAGED = 1 << 27,
58         MSU_UPNP_MASK_PROP_CREATOR = 1 << 28,
59         MSU_UPNP_MASK_PROP_ARTISTS = 1 << 29,
60         MSU_UPNP_MASK_PROP_CREATE_CLASSES = 1 << 30
61 };
62 typedef enum msu_upnp_prop_mask_ msu_upnp_prop_mask;
63
64 typedef struct msu_prop_map_t_ msu_prop_map_t;
65 struct msu_prop_map_t_ {
66         const gchar *upnp_prop_name;
67         msu_upnp_prop_mask type;
68         gboolean filter;
69         gboolean searchable;
70         gboolean updateable;
71 };
72
73 void msu_prop_maps_new(GHashTable **property_map, GHashTable **filter_map);
74
75 guint32 msu_props_parse_filter(GHashTable *filter_map, GVariant *filter,
76                                gchar **upnp_filter);
77
78 gboolean msu_props_parse_update_filter(GHashTable *filter_map,
79                                        GVariant *to_add_update,
80                                        GVariant *to_delete, guint32 *mask,
81                                        gchar **upnp_filter);
82
83 void msu_props_add_device(GUPnPDeviceInfo *proxy,
84                           msu_device_t *device,
85                           GVariantBuilder *vb);
86
87 GVariant *msu_props_get_device_prop(GUPnPDeviceInfo *proxy,
88                                     msu_device_t *device,
89                                     const gchar *prop);
90
91 gboolean msu_props_add_object(GVariantBuilder *item_vb,
92                               GUPnPDIDLLiteObject *object,
93                               const char *root_path,
94                               const gchar *parent_path,
95                               guint32 filter_mask);
96
97 GVariant *msu_props_get_object_prop(const gchar *prop, const gchar *root_path,
98                                     GUPnPDIDLLiteObject *object);
99
100 void msu_props_add_container(GVariantBuilder *item_vb,
101                              GUPnPDIDLLiteContainer *object,
102                              guint32 filter_mask,
103                              gboolean *have_child_count);
104
105 void msu_props_add_child_count(GVariantBuilder *item_vb, gint value);
106
107 GVariant *msu_props_get_container_prop(const gchar *prop,
108                                        GUPnPDIDLLiteObject *object);
109
110 void msu_props_add_resource(GVariantBuilder *item_vb,
111                             GUPnPDIDLLiteObject *object,
112                             guint32 filter_mask,
113                             const gchar *protocol_info);
114
115 void msu_props_add_item(GVariantBuilder *item_vb,
116                         GUPnPDIDLLiteObject *object,
117                         const gchar *root_path,
118                         guint32 filter_mask,
119                         const gchar *protocol_info);
120
121 GVariant *msu_props_get_item_prop(const gchar *prop, const gchar *root_path,
122                                   GUPnPDIDLLiteObject *object,
123                                   const gchar *protocol_info);
124
125 const gchar *msu_props_media_spec_to_upnp_class(const gchar *m2spec_class);
126
127 const gchar *msu_props_upnp_class_to_media_spec(const gchar *upnp_class);
128
129 #endif