comparison src/ushare.h @ 125:e413158cae13

Add ushare project files.
author naoyan@johnstown.minaminoshima.org
date Sun, 03 Oct 2010 11:35:19 +0900
parents
children 5dcaf3785ebe
comparison
equal deleted inserted replaced
124:9c7bc6c0327e 125:e413158cae13
1 /*
2 * ushare.h : GeeXboX uShare UPnP Media Server header.
3 * Originally developped for the GeeXboX project.
4 * Parts of the code are originated from GMediaServer from Oskar Liljeblad.
5 * Copyright (C) 2005-2007 Benjamin Zores <ben@geexbox.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22 #ifndef _USHARE_H_
23 #define _USHARE_H_
24
25 #include <upnp/upnp.h>
26 #include <upnp/upnptools.h>
27 #include <stdbool.h>
28 #include <pthread.h>
29
30 #ifdef HAVE_DLNA
31 #include <dlna.h>
32 #endif /* HAVE_DLNA */
33
34 #include "content.h"
35 #include "buffer.h"
36 #include "redblack.h"
37
38 #define VIRTUAL_DIR "/web"
39 #define XBOX_MODEL_NAME "Windows Media Connect Compatible"
40 #define DEFAULT_UUID "898f9738-d930-4db4-a3cf"
41
42 #define STREAM_FILE_NAME "stream.ts"
43 #define STREAM_LOCATION VIRTUAL_DIR "/" STREAM_FILE_NAME
44
45 #define UPNP_MAX_CONTENT_LENGTH 4096
46
47 #define STARTING_ENTRY_ID_DEFAULT 0
48 #define STARTING_ENTRY_ID_XBOX360 100000
49
50 #define UPNP_DESCRIPTION \
51 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
52 "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">" \
53 " <specVersion>" \
54 " <major>1</major>" \
55 " <minor>0</minor>" \
56 " </specVersion>" \
57 " <device>" \
58 " <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>" \
59 " <friendlyName>%s: 1</friendlyName>" \
60 " <manufacturer>GeeXboX Team</manufacturer>" \
61 " <manufacturerURL>http://ushare.geexbox.org/</manufacturerURL>" \
62 " <modelDescription>GeeXboX uShare : UPnP Media Server</modelDescription>" \
63 " <modelName>%s</modelName>" \
64 " <modelNumber>001</modelNumber>" \
65 " <modelURL>http://ushare.geexbox.org/</modelURL>" \
66 " <serialNumber>GEEXBOX-USHARE-01</serialNumber>" \
67 " <UDN>uuid:%s</UDN>" \
68 " <serviceList>" \
69 " <service>" \
70 " <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>" \
71 " <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>" \
72 " <SCPDURL>/web/cms.xml</SCPDURL>" \
73 " <controlURL>/web/cms_control</controlURL>" \
74 " <eventSubURL>/web/cms_event</eventSubURL>" \
75 " </service>" \
76 " <service>" \
77 " <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>" \
78 " <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>" \
79 " <SCPDURL>/web/cds.xml</SCPDURL>" \
80 " <controlURL>/web/cds_control</controlURL>" \
81 " <eventSubURL>/web/cds_event</eventSubURL>" \
82 " </service>" \
83 " <service>" \
84 " <serviceType>urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1</serviceType>\n" \
85 " <serviceId>urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar</serviceId>\n" \
86 " <SCPDURL>/web/msr.xml</SCPDURL>" \
87 " <controlURL>/web/msr_control</controlURL>" \
88 " <eventSubURL>/web/msr_event</eventSubURL>" \
89 " </service>\n" \
90 " </serviceList>" \
91 " <presentationURL>/web/ushare.html</presentationURL>" \
92 " </device>" \
93 "</root>"
94
95 struct ushare_t {
96 char *name;
97 char *interface;
98 char *model_name;
99 content_list *contentlist;
100 struct rbtree *rb;
101 struct upnp_entry_t *root_entry;
102 int nr_entries;
103 int starting_id;
104 int init;
105 UpnpDevice_Handle dev;
106 char *udn;
107 char *ip;
108 unsigned short port;
109 unsigned short telnet_port;
110 struct buffer_t *presentation;
111 bool use_presentation;
112 bool use_telnet;
113 #ifdef HAVE_DLNA
114 bool dlna_enabled;
115 dlna_t *dlna;
116 dlna_org_flags_t dlna_flags;
117 #endif /* HAVE_DLNA */
118 bool xbox360;
119 bool verbose;
120 bool daemon;
121 bool override_iconv_err;
122 char *cfg_file;
123 pthread_mutex_t termination_mutex;
124 pthread_cond_t termination_cond;
125 };
126
127 struct action_event_t {
128 struct Upnp_Action_Request *request;
129 bool status;
130 struct service_t *service;
131 };
132
133 inline void display_headers (void);
134 void * dlna_startup(void *p);
135
136 #endif /* _USHARE_H_ */