Mercurial > pt1.oyama
comparison libdlna-0.2.3/src/dlna.h @ 129:4f6d9621ee00
add multi session streaming & add depending librarys.
- libupnp-1.6.6
- libdlna-0.2.3
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Sun, 10 Oct 2010 15:33:18 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
128:3a7d8d2f0585 | 129:4f6d9621ee00 |
---|---|
1 /* | |
2 * libdlna: reference DLNA standards implementation. | |
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org> | |
4 * | |
5 * This file is part of libdlna. | |
6 * | |
7 * libdlna is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public | |
9 * License as published by the Free Software Foundation; either | |
10 * version 2.1 of the License, or (at your option) any later version. | |
11 * | |
12 * libdlna 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 GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with libdlna; if not, write to the Free Software | |
19 * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 */ | |
21 | |
22 #ifndef _DLNA_H_ | |
23 #define _DLNA_H_ | |
24 | |
25 /** | |
26 * @file dlna.h | |
27 * external api header. | |
28 */ | |
29 | |
30 #ifdef __cplusplus | |
31 extern "C" { | |
32 #if 0 /* avoid EMACS indent */ | |
33 } | |
34 #endif /* 0 */ | |
35 #endif /* __cplusplus */ | |
36 | |
37 #define DLNA_STRINGIFY(s) DLNA_TOSTRING(s) | |
38 #define DLNA_TOSTRING(s) #s | |
39 | |
40 #define LIBDLNA_VERSION_INT ((0<<16)+(2<<8)+3) | |
41 #define LIBDLNA_VERSION 0.2.3 | |
42 #define LIBDLNA_BUILD LIBDLNA_VERSION_INT | |
43 | |
44 #define LIBDLNA_IDENT "DLNA " DLNA_STRINGIFY(LIBDLNA_VERSION) | |
45 | |
46 typedef enum { | |
47 DLNA_PROTOCOL_INFO_TYPE_UNKNOWN, | |
48 DLNA_PROTOCOL_INFO_TYPE_HTTP, | |
49 DLNA_PROTOCOL_INFO_TYPE_RTP, | |
50 DLNA_PROTOCOL_INFO_TYPE_ANY | |
51 } dlna_protocol_info_type_t; | |
52 | |
53 /* DLNA.ORG_PS: play speed parameter (integer) | |
54 * 0 invalid play speed | |
55 * 1 normal play speed | |
56 */ | |
57 typedef enum { | |
58 DLNA_ORG_PLAY_SPEED_INVALID = 0, | |
59 DLNA_ORG_PLAY_SPEED_NORMAL = 1, | |
60 } dlna_org_play_speed_t; | |
61 | |
62 /* DLNA.ORG_CI: conversion indicator parameter (integer) | |
63 * 0 not transcoded | |
64 * 1 transcoded | |
65 */ | |
66 typedef enum { | |
67 DLNA_ORG_CONVERSION_NONE = 0, | |
68 DLNA_ORG_CONVERSION_TRANSCODED = 1, | |
69 } dlna_org_conversion_t; | |
70 | |
71 /* DLNA.ORG_OP: operations parameter (string) | |
72 * "00" (or "0") neither time seek range nor range supported | |
73 * "01" range supported | |
74 * "10" time seek range supported | |
75 * "11" both time seek range and range supported | |
76 */ | |
77 typedef enum { | |
78 DLNA_ORG_OPERATION_NONE = 0x00, | |
79 DLNA_ORG_OPERATION_RANGE = 0x01, | |
80 DLNA_ORG_OPERATION_TIMESEEK = 0x10, | |
81 } dlna_org_operation_t; | |
82 | |
83 /* DLNA.ORG_FLAGS, padded with 24 trailing 0s | |
84 * 80000000 31 senderPaced | |
85 * 40000000 30 lsopTimeBasedSeekSupported | |
86 * 20000000 29 lsopByteBasedSeekSupported | |
87 * 10000000 28 playcontainerSupported | |
88 * 8000000 27 s0IncreasingSupported | |
89 * 4000000 26 sNIncreasingSupported | |
90 * 2000000 25 rtspPauseSupported | |
91 * 1000000 24 streamingTransferModeSupported | |
92 * 800000 23 interactiveTransferModeSupported | |
93 * 400000 22 backgroundTransferModeSupported | |
94 * 200000 21 connectionStallingSupported | |
95 * 100000 20 dlnaVersion15Supported | |
96 * | |
97 * Example: (1 << 24) | (1 << 22) | (1 << 21) | (1 << 20) | |
98 * DLNA.ORG_FLAGS=01700000[000000000000000000000000] // [] show padding | |
99 */ | |
100 typedef enum { | |
101 DLNA_ORG_FLAG_SENDER_PACED = (1 << 31), | |
102 DLNA_ORG_FLAG_TIME_BASED_SEEK = (1 << 30), | |
103 DLNA_ORG_FLAG_BYTE_BASED_SEEK = (1 << 29), | |
104 DLNA_ORG_FLAG_PLAY_CONTAINER = (1 << 28), | |
105 DLNA_ORG_FLAG_S0_INCREASE = (1 << 27), | |
106 DLNA_ORG_FLAG_SN_INCREASE = (1 << 26), | |
107 DLNA_ORG_FLAG_RTSP_PAUSE = (1 << 25), | |
108 DLNA_ORG_FLAG_STREAMING_TRANSFER_MODE = (1 << 24), | |
109 DLNA_ORG_FLAG_INTERACTIVE_TRANSFERT_MODE = (1 << 23), | |
110 DLNA_ORG_FLAG_BACKGROUND_TRANSFERT_MODE = (1 << 22), | |
111 DLNA_ORG_FLAG_CONNECTION_STALL = (1 << 21), | |
112 DLNA_ORG_FLAG_DLNA_V15 = (1 << 20), | |
113 } dlna_org_flags_t; | |
114 | |
115 typedef enum { | |
116 DLNA_CLASS_UNKNOWN, | |
117 DLNA_CLASS_IMAGE, | |
118 DLNA_CLASS_AUDIO, | |
119 DLNA_CLASS_AV, | |
120 DLNA_CLASS_COLLECTION | |
121 } dlna_media_class_t; | |
122 | |
123 typedef enum { | |
124 /* Image Class */ | |
125 DLNA_PROFILE_IMAGE_JPEG, | |
126 DLNA_PROFILE_IMAGE_PNG, | |
127 /* Audio Class */ | |
128 DLNA_PROFILE_AUDIO_AC3, | |
129 DLNA_PROFILE_AUDIO_AMR, | |
130 DLNA_PROFILE_AUDIO_ATRAC3, | |
131 DLNA_PROFILE_AUDIO_LPCM, | |
132 DLNA_PROFILE_AUDIO_MP3, | |
133 DLNA_PROFILE_AUDIO_MPEG4, | |
134 DLNA_PROFILE_AUDIO_WMA, | |
135 /* AV Class */ | |
136 DLNA_PROFILE_AV_MPEG1, | |
137 DLNA_PROFILE_AV_MPEG2, | |
138 DLNA_PROFILE_AV_MPEG4_PART2, | |
139 DLNA_PROFILE_AV_MPEG4_PART10, /* a.k.a. MPEG-4 AVC */ | |
140 DLNA_PROFILE_AV_WMV9 | |
141 } dlna_media_profile_t; | |
142 | |
143 /** | |
144 * DLNA profile. | |
145 * This specifies the DLNA profile one file/stream is compatible with. | |
146 */ | |
147 typedef struct dlna_profile_s { | |
148 /* Profile ID, part of DLNA.ORG_PN= string */ | |
149 const char *id; | |
150 /* Profile MIME type */ | |
151 const char *mime; | |
152 /* Profile Label */ | |
153 const char *label; | |
154 /* Profile type: IMAGE / AUDIO / AV */ | |
155 dlna_media_class_t class; | |
156 } dlna_profile_t; | |
157 | |
158 /** | |
159 * DLNA Library's controller. | |
160 * This controls the whole library. | |
161 */ | |
162 typedef struct dlna_s dlna_t; | |
163 | |
164 /** | |
165 * Initialization of library. | |
166 * | |
167 * @warning This function must be called before any libdlna function. | |
168 * @return DLNA library's controller. | |
169 */ | |
170 dlna_t *dlna_init (void); | |
171 | |
172 /** | |
173 * Uninitialization of library. | |
174 * | |
175 * @param[in] dlna The DLNA library's controller. | |
176 */ | |
177 void dlna_uninit (dlna_t *dlna); | |
178 | |
179 /** | |
180 * Set library's verbosity level. | |
181 * | |
182 * @param[in] dlna The DLNA library's controller. | |
183 * @param[in] level Level of verbosity (0 to disable, 1 to enable). | |
184 */ | |
185 void dlna_set_verbosity (dlna_t *dlna, int level); | |
186 | |
187 /** | |
188 * Set library's check level on files extension. | |
189 * | |
190 * @param[in] dlna The DLNA library's controller. | |
191 * @param[in] level Level of check (0 for no check, 1 to enable checks). | |
192 */ | |
193 void dlna_set_extension_check (dlna_t *dlna, int level); | |
194 | |
195 /** | |
196 * Register all known/supported DLNA profiles. | |
197 * | |
198 * @param[in] dlna The DLNA library's controller. | |
199 */ | |
200 void dlna_register_all_media_profiles (dlna_t *dlna); | |
201 | |
202 /** | |
203 * Register one specific known/supported DLNA profiles. | |
204 * | |
205 * @param[in] dlna The DLNA library's controller. | |
206 * @param[in] profile The profile ID to be registered. | |
207 */ | |
208 void dlna_register_media_profile (dlna_t *dlna, dlna_media_profile_t profile); | |
209 | |
210 | |
211 /** | |
212 * Guess which DLNA profile one input file/stream is compatible with. | |
213 * | |
214 * @warning This function returns a pointer, do _NOT_ free it. | |
215 * @param[in] dlna The DLNA library's controller. | |
216 * @param[in] filename The file to be checked for compliance. | |
217 * @return A pointer on file's DLNA profile if compatible, NULL otherwise. | |
218 */ | |
219 dlna_profile_t *dlna_guess_media_profile (dlna_t *dlna, const char *filename); | |
220 | |
221 /** | |
222 * Provides UPnP A/V ContentDirectory Object Item associated to profile. | |
223 * | |
224 * @warning This function returns a pointer, do _NOT_ free it. | |
225 * @param[in] profile The DLNA profile that was targeted. | |
226 * @return A pointer on CDS Object Item string. | |
227 */ | |
228 char *dlna_profile_upnp_object_item (dlna_profile_t *profile); | |
229 | |
230 /** | |
231 * Output the protocol information string that must be send by a DMS to a DMP | |
232 * for the file to be played/recognized. | |
233 * | |
234 * @param[in] type Streaming method. | |
235 * @param[in] speed DLNA.ORG_PS parameter. | |
236 * @param[in] ci DLNA.ORG_CI parameter. | |
237 * @param[in] op DLNA.ORG_OP parameter. | |
238 * @param[in] flags DLNA.ORG_FLAGS parameter. | |
239 * @param[in] profile The DLNA's file profile that has been guessed. | |
240 * @return The protocol information string. | |
241 */ | |
242 char * dlna_write_protocol_info (dlna_protocol_info_type_t type, | |
243 dlna_org_play_speed_t speed, | |
244 dlna_org_conversion_t ci, | |
245 dlna_org_operation_t op, | |
246 dlna_org_flags_t flags, | |
247 dlna_profile_t *p); | |
248 | |
249 /** | |
250 * Create a valid UPnP device description for Digital Media Server (DMS). | |
251 * | |
252 * @param[in] friendly_name UPnP device friendly name. | |
253 * @param[in] manufacturer UPnP device manufacturer. | |
254 * @param[in] manufacturer_url UPnP device manufacturer URL. | |
255 * @param[in] model_description UPnP device model description. | |
256 * @param[in] model_name UPnP device model name. | |
257 * @param[in] model_number UPnP device model number. | |
258 * @param[in] model_url UPnP device model URL. | |
259 * @param[in] serial_number UPnP device serial number. | |
260 * @param[in] uuid UPnP device unique identifier. | |
261 * @param[in] presentation_url UPnP device web presentation page URL. | |
262 * @param[in] cms_scpd_url UPnP ConnectionManager service SCPD URL. | |
263 * @param[in] cms_control_url UPnP ConnectionManager service control URL. | |
264 * @param[in] cms_event_url UPnP ConnectionManager service event URL. | |
265 * @param[in] cds_scpd_url UPnP ContentDirectory service SCPD URL. | |
266 * @param[in] cds_control_url UPnP ContentDirectory service control URL. | |
267 * @param[in] cds_event_url UPnP ContentDirectory service event URL. | |
268 * | |
269 * @return The DMS device description string. | |
270 */ | |
271 char * | |
272 dlna_dms_description_get (const char *friendly_name, | |
273 const char *manufacturer, | |
274 const char *manufacturer_url, | |
275 const char *model_description, | |
276 const char *model_name, | |
277 const char *model_number, | |
278 const char *model_url, | |
279 const char *serial_number, | |
280 const char *uuid, | |
281 const char *presentation_url, | |
282 const char *cms_scpd_url, | |
283 const char *cms_control_url, | |
284 const char *cms_event_url, | |
285 const char *cds_scpd_url, | |
286 const char *cds_control_url, | |
287 const char *cds_event_url); | |
288 | |
289 #ifdef __cplusplus | |
290 #if 0 /* avoid EMACS indent */ | |
291 { | |
292 #endif /* 0 */ | |
293 } | |
294 #endif /* __cplusplus */ | |
295 | |
296 #endif /* _DLNA_H_ */ |