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