1c09737891e9e452486981244cbd3ead02dbb7fc
[src/app-framework-binder.git] / plugins / media / media-rygel.h
1 /*
2  * Copyright (C) 2016 "IoT.bzh"
3  * Author "Manuel Bachmann"
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef MEDIA_RYGEL_H
19 #define MEDIA_RYGEL_H
20
21 /* --------------- MEDIA RYGEL DEFINITIONS ------------------ */
22
23 #include <sys/time.h>
24 #include <libgupnp/gupnp-control-point.h>
25 #include <libgupnp-av/gupnp-av.h>
26
27 #include "local-def.h"
28
29 #define URN_MEDIA_SERVER   "urn:schemas-upnp-org:device:MediaServer:1"
30 #define URN_MEDIA_RENDERER "urn:schemas-upnp-org:device:MediaRenderer:1"
31 #define URN_CONTENT_DIR    "urn:schemas-upnp-org:service:ContentDirectory"
32 #define URN_AV_TRANSPORT   "urn:schemas-upnp-org:service:AVTransport"
33
34 typedef enum { PLAY, PAUSE, STOP, SEEK } State;
35 typedef struct dev_ctx dev_ctx_T;
36
37 struct dev_ctx {
38     GMainContext *loop;
39     GUPnPContext *context;
40     GUPnPDeviceInfo *device_info;
41     GUPnPServiceInfo *content_dir;
42     GUPnPServiceInfo *av_transport;
43     char *content_res;
44     int content_num;
45     State state;
46     State target_state;
47     char *action_args;
48     char *transfer_path;
49     unsigned char transfer_started;
50 };
51
52 STATIC char* _rygel_list_raw (dev_ctx_T *, unsigned int *);
53 STATIC char* _rygel_find_upload_id (dev_ctx_T *, char *);
54 STATIC char* _rygel_find_id_for_index (dev_ctx_T *, char *, unsigned int);
55 STATIC char* _rygel_find_metadata_for_id (dev_ctx_T *, char *);
56 STATIC char* _rygel_find_uri_for_metadata (dev_ctx_T *, char *);
57 STATIC unsigned char _rygel_start_uploading (dev_ctx_T *, char *, char *);
58 STATIC unsigned char _rygel_start_doing (dev_ctx_T *, char *, char *, State, char *);
59 STATIC unsigned char _rygel_find_av_transport (dev_ctx_T *);
60 STATIC void _rygel_device_cb (GUPnPControlPoint *, GUPnPDeviceProxy *, gpointer);
61 STATIC void _rygel_av_transport_cb (GUPnPControlPoint *, GUPnPDeviceProxy *, gpointer);
62 STATIC void _rygel_content_cb (GUPnPServiceProxy *, GUPnPServiceProxyAction *, gpointer);
63 STATIC void _rygel_metadata_cb (GUPnPServiceProxy *, GUPnPServiceProxyAction *, gpointer);
64 STATIC void _rygel_select_cb (GUPnPServiceProxy *, GUPnPServiceProxyAction *, gpointer);
65 STATIC void _rygel_upload_cb (GUPnPServiceProxy *, GUPnPServiceProxyAction *, gpointer);
66 STATIC void _rygel_transfer_cb (GUPnPServiceProxy *, GUPnPServiceProxyAction *, gpointer);
67 STATIC void _rygel_do_cb (GUPnPServiceProxy *, GUPnPServiceProxyAction *, gpointer);
68
69 static unsigned int client_count = 0;
70 static struct dev_ctx **dev_ctx = NULL;
71
72 #endif /* MEDIA_RYGEL_H */