gstrtspdefs.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /* GStreamer
  2. * Copyright (C) <2005,2006> Wim Taymans <[email protected]>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. /*
  20. * Unless otherwise indicated, Source Code is licensed under MIT license.
  21. * See further explanation attached in License Statement (distributed in the file
  22. * LICENSE).
  23. *
  24. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25. * this software and associated documentation files (the "Software"), to deal in
  26. * the Software without restriction, including without limitation the rights to
  27. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  28. * of the Software, and to permit persons to whom the Software is furnished to do
  29. * so, subject to the following conditions:
  30. *
  31. * The above copyright notice and this permission notice shall be included in all
  32. * copies or substantial portions of the Software.
  33. *
  34. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  40. * SOFTWARE.
  41. */
  42. #ifndef __GST_RTSP_DEFS_H__
  43. #define __GST_RTSP_DEFS_H__
  44. #include <glib.h>
  45. #include <glib-object.h>
  46. G_BEGIN_DECLS
  47. /**
  48. * GST_RTSP_CHECK:
  49. * @stmt: a statement
  50. * @label: a label
  51. *
  52. * Macro that checks the return value of @stmt and jumps to @label when it does
  53. * not equal #GST_RTSP_OK.
  54. */
  55. #define GST_RTSP_CHECK(stmt, label) \
  56. G_STMT_START { \
  57. if (G_UNLIKELY ((res = (stmt)) != GST_RTSP_OK)) \
  58. goto label; \
  59. } G_STMT_END
  60. /**
  61. * GstRTSPResult:
  62. * @GST_RTSP_OK: no error
  63. * @GST_RTSP_ERROR: some unspecified error occured
  64. * @GST_RTSP_EINVAL: invalid arguments were provided to a function
  65. * @GST_RTSP_EINTR: an operation was canceled
  66. * @GST_RTSP_ENOMEM: no memory was available for the operation
  67. * @GST_RTSP_ERESOLV: a host resolve error occured
  68. * @GST_RTSP_ENOTIMPL: function not implemented
  69. * @GST_RTSP_ESYS: a system error occured, errno contains more details
  70. * @GST_RTSP_EPARSE: a persing error occured
  71. * @GST_RTSP_EWSASTART: windows networking could not start
  72. * @GST_RTSP_EWSAVERSION: windows networking stack has wrong version
  73. * @GST_RTSP_EEOF: end-of-file was reached
  74. * @GST_RTSP_ENET: a network problem occured, h_errno contains more details
  75. * @GST_RTSP_ENOTIP: the host is not an IP host
  76. * @GST_RTSP_ETIMEOUT: a timeout occured
  77. * @GST_RTSP_ETGET: the tunnel GET request has been performed
  78. * @GST_RTSP_ETPOST: the tunnel POST request has been performed
  79. * @GST_RTSP_ELAST: last error
  80. *
  81. * Result codes from the RTSP functions.
  82. */
  83. typedef enum {
  84. GST_RTSP_OK = 0,
  85. /* errors */
  86. GST_RTSP_ERROR = -1,
  87. GST_RTSP_EINVAL = -2,
  88. GST_RTSP_EINTR = -3,
  89. GST_RTSP_ENOMEM = -4,
  90. GST_RTSP_ERESOLV = -5,
  91. GST_RTSP_ENOTIMPL = -6,
  92. GST_RTSP_ESYS = -7,
  93. GST_RTSP_EPARSE = -8,
  94. GST_RTSP_EWSASTART = -9,
  95. GST_RTSP_EWSAVERSION = -10,
  96. GST_RTSP_EEOF = -11,
  97. GST_RTSP_ENET = -12,
  98. GST_RTSP_ENOTIP = -13,
  99. GST_RTSP_ETIMEOUT = -14,
  100. GST_RTSP_ETGET = -15,
  101. GST_RTSP_ETPOST = -16,
  102. GST_RTSP_ELAST = -17
  103. } GstRTSPResult;
  104. /**
  105. * GstRTSPEvent:
  106. * @GST_RTSP_EV_READ: connection is readable
  107. * @GST_RTSP_EV_WRITE: connection is writable
  108. *
  109. * The possible events for the connection.
  110. */
  111. typedef enum {
  112. GST_RTSP_EV_READ = (1 << 0),
  113. GST_RTSP_EV_WRITE = (1 << 1)
  114. } GstRTSPEvent;
  115. /**
  116. * GstRTSPFamily:
  117. * @GST_RTSP_FAM_NONE: unknown network family
  118. * @GST_RTSP_FAM_INET: internet
  119. * @GST_RTSP_FAM_INET6: internet V6
  120. *
  121. * The possible network families.
  122. */
  123. typedef enum {
  124. GST_RTSP_FAM_NONE,
  125. GST_RTSP_FAM_INET,
  126. GST_RTSP_FAM_INET6
  127. } GstRTSPFamily;
  128. /**
  129. * GstRTSPState:
  130. * @GST_RTSP_STATE_INVALID: invalid state
  131. * @GST_RTSP_STATE_INIT: initializing
  132. * @GST_RTSP_STATE_READY: ready for operation
  133. * @GST_RTSP_STATE_SEEKING: seeking in progress
  134. * @GST_RTSP_STATE_PLAYING: playing
  135. * @GST_RTSP_STATE_RECORDING: recording
  136. *
  137. * The different RTSP states.
  138. */
  139. typedef enum {
  140. GST_RTSP_STATE_INVALID,
  141. GST_RTSP_STATE_INIT,
  142. GST_RTSP_STATE_READY,
  143. GST_RTSP_STATE_SEEKING,
  144. GST_RTSP_STATE_PLAYING,
  145. GST_RTSP_STATE_RECORDING
  146. } GstRTSPState;
  147. /**
  148. * GstRTSPVersion:
  149. * @GST_RTSP_VERSION_INVALID: unknown/invalid version
  150. * @GST_RTSP_VERSION_1_0: version 1.0
  151. * @GST_RTSP_VERSION_1_1: version 1.1.
  152. *
  153. * The supported RTSP versions.
  154. */
  155. typedef enum {
  156. GST_RTSP_VERSION_INVALID = 0x00,
  157. GST_RTSP_VERSION_1_0 = 0x10,
  158. GST_RTSP_VERSION_1_1 = 0x11
  159. } GstRTSPVersion;
  160. /**
  161. * GstRTSPMethod:
  162. * @GST_RTSP_INVALID: invalid method
  163. * @GST_RTSP_DESCRIBE: the DESCRIBE method
  164. * @GST_RTSP_ANNOUNCE: the ANNOUNCE method
  165. * @GST_RTSP_GET_PARAMETER: the GET_PARAMETER method
  166. * @GST_RTSP_OPTIONS: the OPTIONS method
  167. * @GST_RTSP_PAUSE: the PAUSE method
  168. * @GST_RTSP_PLAY: the PLAY method
  169. * @GST_RTSP_RECORD: the RECORD method
  170. * @GST_RTSP_REDIRECT: the REDIRECT method
  171. * @GST_RTSP_SETUP: the SETUP method
  172. * @GST_RTSP_SET_PARAMETER: the SET_PARAMETER method
  173. * @GST_RTSP_TEARDOWN: the TEARDOWN method
  174. * @GST_RTSP_GET: the GET method (HTTP).
  175. * @GST_RTSP_POST: the POST method (HTTP).
  176. *
  177. * The different supported RTSP methods.
  178. */
  179. typedef enum {
  180. GST_RTSP_INVALID = 0,
  181. GST_RTSP_DESCRIBE = (1 << 0),
  182. GST_RTSP_ANNOUNCE = (1 << 1),
  183. GST_RTSP_GET_PARAMETER = (1 << 2),
  184. GST_RTSP_OPTIONS = (1 << 3),
  185. GST_RTSP_PAUSE = (1 << 4),
  186. GST_RTSP_PLAY = (1 << 5),
  187. GST_RTSP_RECORD = (1 << 6),
  188. GST_RTSP_REDIRECT = (1 << 7),
  189. GST_RTSP_SETUP = (1 << 8),
  190. GST_RTSP_SET_PARAMETER = (1 << 9),
  191. GST_RTSP_TEARDOWN = (1 << 10),
  192. GST_RTSP_GET = (1 << 11),
  193. GST_RTSP_POST = (1 << 12)
  194. } GstRTSPMethod;
  195. /**
  196. * GstRTSPAuthMethod:
  197. * @GST_RTSP_AUTH_NONE: no authentication
  198. * @GST_RTSP_AUTH_BASIC: basic authentication
  199. * @GST_RTSP_AUTH_DIGEST: digest authentication
  200. *
  201. * Authentication methods, ordered by strength
  202. */
  203. typedef enum {
  204. GST_RTSP_AUTH_NONE = 0x00,
  205. GST_RTSP_AUTH_BASIC = 0x01,
  206. GST_RTSP_AUTH_DIGEST = 0x02
  207. } GstRTSPAuthMethod;
  208. /**
  209. * GST_RTSP_AUTH_MAX:
  210. *
  211. * Strongest available authentication method
  212. */
  213. #define GST_RTSP_AUTH_MAX GST_RTSP_AUTH_DIGEST
  214. /**
  215. * GstRTSPHeaderField:
  216. *
  217. * Enumeration of rtsp header fields
  218. */
  219. typedef enum {
  220. GST_RTSP_HDR_INVALID,
  221. /*
  222. * R = Request
  223. * r = response
  224. * g = general
  225. * e = entity
  226. */
  227. GST_RTSP_HDR_ACCEPT, /* Accept R opt. entity */
  228. GST_RTSP_HDR_ACCEPT_ENCODING, /* Accept-Encoding R opt. entity */
  229. GST_RTSP_HDR_ACCEPT_LANGUAGE, /* Accept-Language R opt. all */
  230. GST_RTSP_HDR_ALLOW, /* Allow r opt. all */
  231. GST_RTSP_HDR_AUTHORIZATION, /* Authorization R opt. all */
  232. GST_RTSP_HDR_BANDWIDTH, /* Bandwidth R opt. all */
  233. GST_RTSP_HDR_BLOCKSIZE, /* Blocksize R opt. all but OPTIONS, TEARDOWN */
  234. GST_RTSP_HDR_CACHE_CONTROL, /* Cache-Control g opt. SETUP */
  235. GST_RTSP_HDR_CONFERENCE, /* Conference R opt. SETUP */
  236. GST_RTSP_HDR_CONNECTION, /* Connection g req. all */
  237. GST_RTSP_HDR_CONTENT_BASE, /* Content-Base e opt. entity */
  238. GST_RTSP_HDR_CONTENT_ENCODING, /* Content-Encoding e req. SET_PARAMETER, DESCRIBE, ANNOUNCE */
  239. GST_RTSP_HDR_CONTENT_LANGUAGE, /* Content-Language e req. DESCRIBE, ANNOUNCE */
  240. GST_RTSP_HDR_CONTENT_LENGTH, /* Content-Length e req. SET_PARAMETER, ANNOUNCE, entity */
  241. GST_RTSP_HDR_CONTENT_LOCATION, /* Content-Location e opt. entity */
  242. GST_RTSP_HDR_CONTENT_TYPE, /* Content-Type e req. SET_PARAMETER, ANNOUNCE, entity */
  243. GST_RTSP_HDR_CSEQ, /* CSeq g req. all */
  244. GST_RTSP_HDR_DATE, /* Date g opt. all */
  245. GST_RTSP_HDR_EXPIRES, /* Expires e opt. DESCRIBE, ANNOUNCE */
  246. GST_RTSP_HDR_FROM, /* From R opt. all */
  247. GST_RTSP_HDR_IF_MODIFIED_SINCE, /* If-Modified-Since R opt. DESCRIBE, SETUP */
  248. GST_RTSP_HDR_LAST_MODIFIED, /* Last-Modified e opt. entity */
  249. GST_RTSP_HDR_PROXY_AUTHENTICATE, /* Proxy-Authenticate */
  250. GST_RTSP_HDR_PROXY_REQUIRE, /* Proxy-Require R req. all */
  251. GST_RTSP_HDR_PUBLIC, /* Public r opt. all */
  252. GST_RTSP_HDR_RANGE, /* Range Rr opt. PLAY, PAUSE, RECORD */
  253. GST_RTSP_HDR_REFERER, /* Referer R opt. all */
  254. GST_RTSP_HDR_REQUIRE, /* Require R req. all */
  255. GST_RTSP_HDR_RETRY_AFTER, /* Retry-After r opt. all */
  256. GST_RTSP_HDR_RTP_INFO, /* RTP-Info r req. PLAY */
  257. GST_RTSP_HDR_SCALE, /* Scale Rr opt. PLAY, RECORD */
  258. GST_RTSP_HDR_SESSION, /* Session Rr req. all but SETUP, OPTIONS */
  259. GST_RTSP_HDR_SERVER, /* Server r opt. all */
  260. GST_RTSP_HDR_SPEED, /* Speed Rr opt. PLAY */
  261. GST_RTSP_HDR_TRANSPORT, /* Transport Rr req. SETUP */
  262. GST_RTSP_HDR_UNSUPPORTED, /* Unsupported r req. all */
  263. GST_RTSP_HDR_USER_AGENT, /* User-Agent R opt. all */
  264. GST_RTSP_HDR_VIA, /* Via g opt. all */
  265. GST_RTSP_HDR_WWW_AUTHENTICATE, /* WWW-Authenticate r opt. all */
  266. /* Real extensions */
  267. GST_RTSP_HDR_CLIENT_CHALLENGE, /* ClientChallenge */
  268. GST_RTSP_HDR_REAL_CHALLENGE1, /* RealChallenge1 */
  269. GST_RTSP_HDR_REAL_CHALLENGE2, /* RealChallenge2 */
  270. GST_RTSP_HDR_REAL_CHALLENGE3, /* RealChallenge3 */
  271. GST_RTSP_HDR_SUBSCRIBE, /* Subscribe */
  272. GST_RTSP_HDR_ALERT, /* Alert */
  273. GST_RTSP_HDR_CLIENT_ID, /* ClientID */
  274. GST_RTSP_HDR_COMPANY_ID, /* CompanyID */
  275. GST_RTSP_HDR_GUID, /* GUID */
  276. GST_RTSP_HDR_REGION_DATA, /* RegionData */
  277. GST_RTSP_HDR_MAX_ASM_WIDTH, /* SupportsMaximumASMBandwidth */
  278. GST_RTSP_HDR_LANGUAGE, /* Language */
  279. GST_RTSP_HDR_PLAYER_START_TIME, /* PlayerStarttime */
  280. GST_RTSP_HDR_LOCATION, /* Location */
  281. GST_RTSP_HDR_ETAG, /* ETag */
  282. GST_RTSP_HDR_IF_MATCH, /* If-Match */
  283. /* WM extensions [MS-RTSP] */
  284. GST_RTSP_HDR_ACCEPT_CHARSET, /* Accept-Charset */
  285. GST_RTSP_HDR_SUPPORTED, /* Supported */
  286. GST_RTSP_HDR_VARY, /* Vary */
  287. GST_RTSP_HDR_X_ACCELERATE_STREAMING, /* X-Accelerate-Streaming */
  288. GST_RTSP_HDR_X_ACCEPT_AUTHENT, /* X-Accept-Authentication */
  289. GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT, /* X-Accept-Proxy-Authentication */
  290. GST_RTSP_HDR_X_BROADCAST_ID, /* X-Broadcast-Id */
  291. GST_RTSP_HDR_X_BURST_STREAMING, /* X-Burst-Streaming */
  292. GST_RTSP_HDR_X_NOTICE, /* X-Notice */
  293. GST_RTSP_HDR_X_PLAYER_LAG_TIME, /* X-Player-Lag-Time */
  294. GST_RTSP_HDR_X_PLAYLIST, /* X-Playlist */
  295. GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE, /* X-Playlist-Change-Notice */
  296. GST_RTSP_HDR_X_PLAYLIST_GEN_ID, /* X-Playlist-Gen-Id */
  297. GST_RTSP_HDR_X_PLAYLIST_SEEK_ID, /* X-Playlist-Seek-Id */
  298. GST_RTSP_HDR_X_PROXY_CLIENT_AGENT, /* X-Proxy-Client-Agent */
  299. GST_RTSP_HDR_X_PROXY_CLIENT_VERB, /* X-Proxy-Client-Verb */
  300. GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE, /* X-Receding-PlaylistChange */
  301. GST_RTSP_HDR_X_RTP_INFO, /* X-RTP-Info */
  302. GST_RTSP_HDR_X_STARTUPPROFILE, /* X-StartupProfile */
  303. GST_RTSP_HDR_TIMESTAMP, /* Timestamp */
  304. GST_RTSP_HDR_AUTHENTICATION_INFO, /* Authentication-Info */
  305. GST_RTSP_HDR_HOST, /* Host */
  306. GST_RTSP_HDR_PRAGMA, /* Pragma */
  307. GST_RTSP_HDR_X_SERVER_IP_ADDRESS, /* X-Server-IP-Address */
  308. GST_RTSP_HDR_X_SESSIONCOOKIE, /* X-Sessioncookie */
  309. GST_RTSP_HDR_RTCP_INTERVAL, /* RTCP-Interval */
  310. /* Since 1.4 */
  311. GST_RTSP_HDR_KEYMGMT, /* KeyMgmt */
  312. GST_RTSP_HDR_LAST
  313. } GstRTSPHeaderField;
  314. /**
  315. * GstRTSPStatusCode:
  316. *
  317. * Enumeration of rtsp status codes
  318. */
  319. typedef enum {
  320. GST_RTSP_STS_INVALID = 0,
  321. GST_RTSP_STS_CONTINUE = 100,
  322. GST_RTSP_STS_OK = 200,
  323. GST_RTSP_STS_CREATED = 201,
  324. GST_RTSP_STS_LOW_ON_STORAGE = 250,
  325. GST_RTSP_STS_MULTIPLE_CHOICES = 300,
  326. GST_RTSP_STS_MOVED_PERMANENTLY = 301,
  327. GST_RTSP_STS_MOVE_TEMPORARILY = 302,
  328. GST_RTSP_STS_SEE_OTHER = 303,
  329. GST_RTSP_STS_NOT_MODIFIED = 304,
  330. GST_RTSP_STS_USE_PROXY = 305,
  331. GST_RTSP_STS_BAD_REQUEST = 400,
  332. GST_RTSP_STS_UNAUTHORIZED = 401,
  333. GST_RTSP_STS_PAYMENT_REQUIRED = 402,
  334. GST_RTSP_STS_FORBIDDEN = 403,
  335. GST_RTSP_STS_NOT_FOUND = 404,
  336. GST_RTSP_STS_METHOD_NOT_ALLOWED = 405,
  337. GST_RTSP_STS_NOT_ACCEPTABLE = 406,
  338. GST_RTSP_STS_PROXY_AUTH_REQUIRED = 407,
  339. GST_RTSP_STS_REQUEST_TIMEOUT = 408,
  340. GST_RTSP_STS_GONE = 410,
  341. GST_RTSP_STS_LENGTH_REQUIRED = 411,
  342. GST_RTSP_STS_PRECONDITION_FAILED = 412,
  343. GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE = 413,
  344. GST_RTSP_STS_REQUEST_URI_TOO_LARGE = 414,
  345. GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE = 415,
  346. GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD = 451,
  347. GST_RTSP_STS_CONFERENCE_NOT_FOUND = 452,
  348. GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH = 453,
  349. GST_RTSP_STS_SESSION_NOT_FOUND = 454,
  350. GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE = 455,
  351. GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE = 456,
  352. GST_RTSP_STS_INVALID_RANGE = 457,
  353. GST_RTSP_STS_PARAMETER_IS_READONLY = 458,
  354. GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED = 459,
  355. GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED = 460,
  356. GST_RTSP_STS_UNSUPPORTED_TRANSPORT = 461,
  357. GST_RTSP_STS_DESTINATION_UNREACHABLE = 462,
  358. GST_RTSP_STS_KEY_MANAGEMENT_FAILURE = 463, /* since 1.4 */
  359. GST_RTSP_STS_INTERNAL_SERVER_ERROR = 500,
  360. GST_RTSP_STS_NOT_IMPLEMENTED = 501,
  361. GST_RTSP_STS_BAD_GATEWAY = 502,
  362. GST_RTSP_STS_SERVICE_UNAVAILABLE = 503,
  363. GST_RTSP_STS_GATEWAY_TIMEOUT = 504,
  364. GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED = 505,
  365. GST_RTSP_STS_OPTION_NOT_SUPPORTED = 551
  366. } GstRTSPStatusCode;
  367. gchar* gst_rtsp_strresult (GstRTSPResult result);
  368. const gchar* gst_rtsp_method_as_text (GstRTSPMethod method);
  369. const gchar* gst_rtsp_version_as_text (GstRTSPVersion version);
  370. const gchar* gst_rtsp_header_as_text (GstRTSPHeaderField field);
  371. const gchar* gst_rtsp_status_as_text (GstRTSPStatusCode code);
  372. gchar* gst_rtsp_options_as_text (GstRTSPMethod options);
  373. GstRTSPMethod gst_rtsp_options_from_text (const gchar *options);
  374. GstRTSPHeaderField gst_rtsp_find_header_field (const gchar *header);
  375. GstRTSPMethod gst_rtsp_find_method (const gchar *method);
  376. gboolean gst_rtsp_header_allow_multiple (GstRTSPHeaderField field);
  377. G_END_DECLS
  378. #endif /* __GST_RTSP_DEFS_H__ */