annotate src/ushare.h @ 179:ac23a9b417a2

Support Linux kernel version >= 3.8 Add ld opt -lm
author Naoya OYAMA <naoya.oyama@gmail.com>
date Fri, 03 May 2013 11:00:11 +0900
parents 4f3640bf350d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
1 /*
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
2 * ushare.h : GeeXboX uShare UPnP Media Server header.
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
3 * Originally developped for the GeeXboX project.
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
4 * Parts of the code are originated from GMediaServer from Oskar Liljeblad.
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
5 * Copyright (C) 2005-2007 Benjamin Zores <ben@geexbox.org>
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
6 *
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
10 * (at your option) any later version.
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
11 *
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
15 * GNU Library General Public License for more details.
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
16 *
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License along
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
18 * with this program; if not, write to the Free Software Foundation,
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
20 */
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
21
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
22 #ifndef _USHARE_H_
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
23 #define _USHARE_H_
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
24
136
2a9ac5ce2c7e Remove internal libdlna and libupnp.(using OS package by default)
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 131
diff changeset
25 #include <upnp.h>
2a9ac5ce2c7e Remove internal libdlna and libupnp.(using OS package by default)
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 131
diff changeset
26 #include <upnptools.h>
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
27 #include <stdbool.h>
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
28 #include <pthread.h>
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
29
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
30 #ifdef HAVE_DLNA
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
31 #include <dlna.h>
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
32 #endif /* HAVE_DLNA */
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
33
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
34 #include "content.h"
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
35 #include "buffer.h"
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
36 #include "redblack.h"
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
37
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
38 #define VIRTUAL_DIR "/web"
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
39 #define XBOX_MODEL_NAME "Windows Media Connect Compatible"
131
20442921bff5 change display name. modify PES buf size.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 126
diff changeset
40 //#define DEFAULT_UUID "898f9738-d930-4db4-a3cf"
20442921bff5 change display name. modify PES buf size.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 126
diff changeset
41 #define DEFAULT_UUID "898f9738-d930-4db4"
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
42
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
43 #define STREAM_FILE_NAME "stream.ts"
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
44 #define STREAM_LOCATION VIRTUAL_DIR "/" STREAM_FILE_NAME
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
45
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
46 #define UPNP_MAX_CONTENT_LENGTH 4096
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
47
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
48 #define STARTING_ENTRY_ID_DEFAULT 0
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
49 #define STARTING_ENTRY_ID_XBOX360 100000
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
50
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
51 #define UPNP_DMS_DESCRIPTION \
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
52 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
53 "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
54 " <specVersion>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
55 " <major>1</major>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
56 " <minor>0</minor>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
57 " </specVersion>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
58 " <device>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
59 " <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>" \
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
60 " <friendlyName>%s</friendlyName>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
61 " <manufacturer>%s</manufacturer>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
62 " <manufacturerURL>%s</manufacturerURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
63 " <modelDescription>%s</modelDescription>" \
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
64 " <modelName>%s</modelName>" \
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
65 " <modelNumber>%s</modelNumber>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
66 " <modelURL>%s</modelURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
67 " <serialNumber>%s</serialNumber>" \
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
68 " <UDN>uuid:%s</UDN>" \
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
69 " <presentationURL>%s</presentationURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
70 " <dlna:X_DLNADOC>DMS-1.00</dlna:X_DLNADOC>" \
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
71 " <serviceList>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
72 " <service>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
73 " <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
74 " <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>" \
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
75 " <SCPDURL>%s</SCPDURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
76 " <controlURL>%s</controlURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
77 " <eventSubURL>%s</eventSubURL>" \
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
78 " </service>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
79 " <service>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
80 " <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
81 " <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>" \
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
82 " <SCPDURL>%s</SCPDURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
83 " <controlURL>%s</controlURL>" \
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 166
diff changeset
84 " <eventSubURL>%s</eventSubURL>" \
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
85 " </service>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
86 " </serviceList>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
87 " </device>" \
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
88 "</root>"
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
89
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
90 struct ushare_t {
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
91 char *name;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
92 char *interface;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
93 char *model_name;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
94 content_list *contentlist;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
95 struct rbtree *rb;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
96 struct upnp_entry_t *root_entry;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
97 int nr_entries;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
98 int starting_id;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
99 int init;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
100 UpnpDevice_Handle dev;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
101 char *udn;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
102 char *ip;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
103 unsigned short port;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
104 unsigned short telnet_port;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
105 struct buffer_t *presentation;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
106 bool use_presentation;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
107 bool use_telnet;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
108 #ifdef HAVE_DLNA
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
109 bool dlna_enabled;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
110 dlna_t *dlna;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
111 dlna_org_flags_t dlna_flags;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
112 #endif /* HAVE_DLNA */
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
113 bool xbox360;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
114 bool verbose;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
115 bool daemon;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
116 bool override_iconv_err;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
117 char *cfg_file;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
118 pthread_mutex_t termination_mutex;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
119 pthread_cond_t termination_cond;
152
30e91361506a EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 146
diff changeset
120 struct channel_info_list *channel_list;
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
121 };
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
122
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
123 struct action_event_t {
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
124 struct Upnp_Action_Request *request;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
125 bool status;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
126 struct service_t *service;
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
127 };
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
128
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
129 inline void display_headers (void);
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
130 void * dlna_startup(void *p);
126
5dcaf3785ebe fix process terminate problem.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 125
diff changeset
131 void UPnPBreak (int s __attribute__ ((unused)));
5dcaf3785ebe fix process terminate problem.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 125
diff changeset
132
125
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
133
e413158cae13 Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
diff changeset
134 #endif /* _USHARE_H_ */