rtspcodes.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * RTSP definitions
  3. * copyright (c) 2002 Fabrice Bellard
  4. * copyright (c) 2014 Samsung Electronics. All rights reserved.
  5. * @Author: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef AVFORMAT_RTSPCODES_H
  24. #define AVFORMAT_RTSPCODES_H
  25. #include "libavutil/common.h"
  26. #include "libavformat/http.h"
  27. /** RTSP handling */
  28. enum RTSPStatusCode {
  29. RTSP_STATUS_CONTINUE =100,
  30. RTSP_STATUS_OK =200,
  31. RTSP_STATUS_CREATED =201,
  32. RTSP_STATUS_LOW_ON_STORAGE_SPACE =250,
  33. RTSP_STATUS_MULTIPLE_CHOICES =300,
  34. RTSP_STATUS_MOVED_PERMANENTLY =301,
  35. RTSP_STATUS_MOVED_TEMPORARILY =302,
  36. RTSP_STATUS_SEE_OTHER =303,
  37. RTSP_STATUS_NOT_MODIFIED =304,
  38. RTSP_STATUS_USE_PROXY =305,
  39. RTSP_STATUS_BAD_REQUEST =400,
  40. RTSP_STATUS_UNAUTHORIZED =401,
  41. RTSP_STATUS_PAYMENT_REQUIRED =402,
  42. RTSP_STATUS_FORBIDDEN =403,
  43. RTSP_STATUS_NOT_FOUND =404,
  44. RTSP_STATUS_METHOD =405,
  45. RTSP_STATUS_NOT_ACCEPTABLE =406,
  46. RTSP_STATUS_PROXY_AUTH_REQUIRED =407,
  47. RTSP_STATUS_REQ_TIME_OUT =408,
  48. RTSP_STATUS_GONE =410,
  49. RTSP_STATUS_LENGTH_REQUIRED =411,
  50. RTSP_STATUS_PRECONDITION_FAILED =412,
  51. RTSP_STATUS_REQ_ENTITY_2LARGE =413,
  52. RTSP_STATUS_REQ_URI_2LARGE =414,
  53. RTSP_STATUS_UNSUPPORTED_MTYPE =415,
  54. RTSP_STATUS_PARAM_NOT_UNDERSTOOD =451,
  55. RTSP_STATUS_CONFERENCE_NOT_FOUND =452,
  56. RTSP_STATUS_BANDWIDTH =453,
  57. RTSP_STATUS_SESSION =454,
  58. RTSP_STATUS_STATE =455,
  59. RTSP_STATUS_INVALID_HEADER_FIELD =456,
  60. RTSP_STATUS_INVALID_RANGE =457,
  61. RTSP_STATUS_RONLY_PARAMETER =458,
  62. RTSP_STATUS_AGGREGATE =459,
  63. RTSP_STATUS_ONLY_AGGREGATE =460,
  64. RTSP_STATUS_TRANSPORT =461,
  65. RTSP_STATUS_UNREACHABLE =462,
  66. RTSP_STATUS_INTERNAL =500,
  67. RTSP_STATUS_NOT_IMPLEMENTED =501,
  68. RTSP_STATUS_BAD_GATEWAY =502,
  69. RTSP_STATUS_SERVICE =503,
  70. RTSP_STATUS_GATEWAY_TIME_OUT =504,
  71. RTSP_STATUS_VERSION =505,
  72. RTSP_STATUS_UNSUPPORTED_OPTION =551,
  73. };
  74. static const av_unused char * const rtsp_status_strings[] = {
  75. [RTSP_STATUS_CONTINUE] ="Continue",
  76. [RTSP_STATUS_OK] ="OK",
  77. [RTSP_STATUS_CREATED] ="Created",
  78. [RTSP_STATUS_LOW_ON_STORAGE_SPACE] ="Low on Storage Space",
  79. [RTSP_STATUS_MULTIPLE_CHOICES] ="Multiple Choices",
  80. [RTSP_STATUS_MOVED_PERMANENTLY] ="Moved Permanently",
  81. [RTSP_STATUS_MOVED_TEMPORARILY] ="Moved Temporarily",
  82. [RTSP_STATUS_SEE_OTHER] ="See Other",
  83. [RTSP_STATUS_NOT_MODIFIED] ="Not Modified",
  84. [RTSP_STATUS_USE_PROXY] ="Use Proxy",
  85. [RTSP_STATUS_BAD_REQUEST] ="Bad Request",
  86. [RTSP_STATUS_UNAUTHORIZED] ="Unauthorized",
  87. [RTSP_STATUS_PAYMENT_REQUIRED] ="Payment Required",
  88. [RTSP_STATUS_FORBIDDEN] ="Forbidden",
  89. [RTSP_STATUS_NOT_FOUND] ="Not Found",
  90. [RTSP_STATUS_METHOD] ="Method Not Allowed",
  91. [RTSP_STATUS_NOT_ACCEPTABLE] ="Not Acceptable",
  92. [RTSP_STATUS_PROXY_AUTH_REQUIRED] ="Proxy Authentication Required",
  93. [RTSP_STATUS_REQ_TIME_OUT] ="Request Time-out",
  94. [RTSP_STATUS_GONE] ="Gone",
  95. [RTSP_STATUS_LENGTH_REQUIRED] ="Length Required",
  96. [RTSP_STATUS_PRECONDITION_FAILED] ="Precondition Failed",
  97. [RTSP_STATUS_REQ_ENTITY_2LARGE] ="Request Entity Too Large",
  98. [RTSP_STATUS_REQ_URI_2LARGE] ="Request URI Too Large",
  99. [RTSP_STATUS_UNSUPPORTED_MTYPE] ="Unsupported Media Type",
  100. [RTSP_STATUS_PARAM_NOT_UNDERSTOOD] ="Parameter Not Understood",
  101. [RTSP_STATUS_CONFERENCE_NOT_FOUND] ="Conference Not Found",
  102. [RTSP_STATUS_BANDWIDTH] ="Not Enough Bandwidth",
  103. [RTSP_STATUS_SESSION] ="Session Not Found",
  104. [RTSP_STATUS_STATE] ="Method Not Valid in This State",
  105. [RTSP_STATUS_INVALID_HEADER_FIELD] ="Header Field Not Valid for Resource",
  106. [RTSP_STATUS_INVALID_RANGE] ="Invalid Range",
  107. [RTSP_STATUS_RONLY_PARAMETER] ="Parameter Is Read-Only",
  108. [RTSP_STATUS_AGGREGATE] ="Aggregate Operation no Allowed",
  109. [RTSP_STATUS_ONLY_AGGREGATE] ="Only Aggregate Operation Allowed",
  110. [RTSP_STATUS_TRANSPORT] ="Unsupported Transport",
  111. [RTSP_STATUS_UNREACHABLE] ="Destination Unreachable",
  112. [RTSP_STATUS_INTERNAL] ="Internal Server Error",
  113. [RTSP_STATUS_NOT_IMPLEMENTED] ="Not Implemented",
  114. [RTSP_STATUS_BAD_GATEWAY] ="Bad Gateway",
  115. [RTSP_STATUS_SERVICE] ="Service Unavailable",
  116. [RTSP_STATUS_GATEWAY_TIME_OUT] ="Gateway Time-out",
  117. [RTSP_STATUS_VERSION] ="RTSP Version not Supported",
  118. [RTSP_STATUS_UNSUPPORTED_OPTION] ="Option not supported",
  119. };
  120. #define RTSP_STATUS_CODE2STRING(x) (\
  121. x >= 100 && x < FF_ARRAY_ELEMS(rtsp_status_strings) && rtsp_status_strings[x] \
  122. )? rtsp_status_strings[x] : NULL
  123. enum RTSPMethod {
  124. DESCRIBE,
  125. ANNOUNCE,
  126. OPTIONS,
  127. SETUP,
  128. PLAY,
  129. PAUSE,
  130. TEARDOWN,
  131. GET_PARAMETER,
  132. SET_PARAMETER,
  133. REDIRECT,
  134. RECORD,
  135. UNKNOWN = -1,
  136. };
  137. static inline int ff_rtsp_averror(enum RTSPStatusCode status_code, int default_averror)
  138. {
  139. return ff_http_averror(status_code, default_averror);
  140. }
  141. #endif /* AVFORMAT_RTSPCODES_H */