Implement Media Plugin upload API, update README.md
[src/app-framework-binder.git] / plugins / media / media-rygel.h
1 /*
2  * Copyright (C) 2016 "IoT.bzh"
3  * Author "Manuel Bachmann"
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef MEDIA_RYGEL_H
20 #define MEDIA_RYGEL_H
21
22 /* --------------- MEDIA RYGEL DEFINITIONS ------------------ */
23
24 #include <sys/time.h>
25 #include <libgupnp/gupnp-control-point.h>
26 #include <libgupnp-av/gupnp-av.h>
27
28 #include "local-def.h"
29
30 #define URN_MEDIA_SERVER   "urn:schemas-upnp-org:device:MediaServer:1"
31 #define URN_MEDIA_RENDERER "urn:schemas-upnp-org:device:MediaRenderer:1"
32 #define URN_CONTENT_DIR    "urn:schemas-upnp-org:service:ContentDirectory"
33 #define URN_AV_TRANSPORT   "urn:schemas-upnp-org:service:AVTransport"
34
35 typedef enum { PLAY, PAUSE, STOP } State;
36 typedef struct dev_ctx dev_ctx_T;
37
38 struct dev_ctx {
39     GMainContext *loop;
40     GUPnPContext *context;
41     GUPnPDeviceInfo *device_info;
42     GUPnPServiceInfo *content_dir;
43     GUPnPServiceInfo *av_transport;
44     char *content_res;
45     int content_num;
46     State state;
47     State target_state;
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);
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 */