repositories
/
deb_ffmpeg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git]
/
ffmpeg
/
libavformat
/
rtspdec.c
diff --git
a/ffmpeg/libavformat/rtspdec.c
b/ffmpeg/libavformat/rtspdec.c
index b4b4f12556f3c2d785a378789bfb53f86188ce21..fa7383c734cddfd6bd9c73ccc01e5c73e466bae9 100644
(file)
--- a/
ffmpeg/libavformat/rtspdec.c
+++ b/
ffmpeg/libavformat/rtspdec.c
@@
-360,10
+360,12
@@
static inline int parse_command_line(AVFormatContext *s, const char *line,
RTSPState *rt = s->priv_data;
const char *linept, *searchlinept;
linept = strchr(line, ' ');
RTSPState *rt = s->priv_data;
const char *linept, *searchlinept;
linept = strchr(line, ' ');
+
if (!linept) {
av_log(s, AV_LOG_ERROR, "Error parsing method string\n");
return AVERROR_INVALIDDATA;
}
if (!linept) {
av_log(s, AV_LOG_ERROR, "Error parsing method string\n");
return AVERROR_INVALIDDATA;
}
+
if (linept - line > methodsize - 1) {
av_log(s, AV_LOG_ERROR, "Method string too long\n");
return AVERROR(EIO);
if (linept - line > methodsize - 1) {
av_log(s, AV_LOG_ERROR, "Method string too long\n");
return AVERROR(EIO);
@@
-530,7
+532,7
@@
static int rtsp_read_play(AVFormatContext *s)
}
ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
}
ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
- return
-1
;
+ return
ff_rtsp_averror(reply->status_code, -1)
;
}
if (rt->transport == RTSP_TRANSPORT_RTP &&
reply->range_start != AV_NOPTS_VALUE) {
}
if (rt->transport == RTSP_TRANSPORT_RTP &&
reply->range_start != AV_NOPTS_VALUE) {
@@
-562,7
+564,7
@@
static int rtsp_read_pause(AVFormatContext *s)
else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
- return
-1
;
+ return
ff_rtsp_averror(reply->status_code, -1)
;
}
}
rt->state = RTSP_STATE_PAUSED;
}
}
rt->state = RTSP_STATE_PAUSED;
@@
-589,12
+591,12
@@
int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
sizeof(cmd));
}
ff_rtsp_send_cmd(s, "DESCRIBE", rt->control_uri, cmd, reply, &content);
sizeof(cmd));
}
ff_rtsp_send_cmd(s, "DESCRIBE", rt->control_uri, cmd, reply, &content);
- if (!content)
- return AVERROR_INVALIDDATA;
if (reply->status_code != RTSP_STATUS_OK) {
av_freep(&content);
if (reply->status_code != RTSP_STATUS_OK) {
av_freep(&content);
- return
AVERROR_INVALIDDATA
;
+ return
ff_rtsp_averror(reply->status_code, AVERROR_INVALIDDATA)
;
}
}
+ if (!content)
+ return AVERROR_INVALIDDATA;
av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", content);
/* now we got the SDP description, we parse it */
av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", content);
/* now we got the SDP description, we parse it */
@@
-609,10
+611,12
@@
int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
static int rtsp_listen(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
static int rtsp_listen(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
- char host[128], path[512], auth[128];
+ char
proto[128],
host[128], path[512], auth[128];
char uri[500];
int port;
char uri[500];
int port;
+ int default_port = RTSP_DEFAULT_PORT;
char tcpname[500];
char tcpname[500];
+ const char *lower_proto = "tcp";
unsigned char rbuf[4096];
unsigned char method[10];
int rbuflen = 0;
unsigned char rbuf[4096];
unsigned char method[10];
int rbuflen = 0;
@@
-620,18
+624,23
@@
static int rtsp_listen(AVFormatContext *s)
enum RTSPMethod methodcode;
/* extract hostname and port */
enum RTSPMethod methodcode;
/* extract hostname and port */
- av_url_split(
NULL, 0, auth, sizeof(auth), host, sizeof(host), &port
,
- path, sizeof(path), s->filename);
+ av_url_split(
proto, sizeof(proto), auth, sizeof(auth), host, sizeof(host)
,
+
&port,
path, sizeof(path), s->filename);
/* ff_url_join. No authorization by now (NULL) */
/* ff_url_join. No authorization by now (NULL) */
- ff_url_join(rt->control_uri, sizeof(rt->control_uri),
"rtsp"
, NULL, host,
+ ff_url_join(rt->control_uri, sizeof(rt->control_uri),
proto
, NULL, host,
port, "%s", path);
port, "%s", path);
+ if (!strcmp(proto, "rtsps")) {
+ lower_proto = "tls";
+ default_port = RTSPS_DEFAULT_PORT;
+ }
+
if (port < 0)
if (port < 0)
- port =
RTSP_DEFAULT_PORT
;
+ port =
default_port
;
/* Create TCP connection */
/* Create TCP connection */
- ff_url_join(tcpname, sizeof(tcpname),
"tcp"
, NULL, host, port,
+ ff_url_join(tcpname, sizeof(tcpname),
lower_proto
, NULL, host, port,
"?listen&listen_timeout=%d", rt->initial_timeout * 1000);
if (ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
"?listen&listen_timeout=%d", rt->initial_timeout * 1000);
if (ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
@@
-673,7
+682,11
@@
static int rtsp_listen(AVFormatContext *s)
static int rtsp_probe(AVProbeData *p)
{
static int rtsp_probe(AVProbeData *p)
{
- if (av_strstart(p->filename, "rtsp:", NULL))
+ if (
+#if CONFIG_TLS_PROTOCOL
+ av_strstart(p->filename, "rtsps:", NULL) ||
+#endif
+ av_strstart(p->filename, "rtsp:", NULL))
return AVPROBE_SCORE_MAX;
return 0;
}
return AVPROBE_SCORE_MAX;
return 0;
}
@@
-704,10
+717,10
@@
static int rtsp_read_header(AVFormatContext *s)
if (rt->initial_pause) {
/* do not start immediately */
} else {
if (rt->initial_pause) {
/* do not start immediately */
} else {
- if (
rtsp_read_play(s
) < 0) {
+ if (
(ret = rtsp_read_play(s)
) < 0) {
ff_rtsp_close_streams(s);
ff_rtsp_close_connections(s);
ff_rtsp_close_streams(s);
ff_rtsp_close_connections(s);
- return
AVERROR_INVALIDDATA
;
+ return
ret
;
}
}
}
}
}
}
@@
-801,7
+814,7
@@
retry:
ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK)
ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK)
- return
AVERROR_INVALIDDATA
;
+ return
ff_rtsp_averror(reply->status_code, AVERROR_INVALIDDATA)
;
rt->need_subscription = 1;
}
}
rt->need_subscription = 1;
}
}
@@
-836,7
+849,7
@@
retry:
ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK)
ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK)
- return
AVERROR_INVALIDDATA
;
+ return
ff_rtsp_averror(reply->status_code, AVERROR_INVALIDDATA)
;
rt->need_subscription = 0;
if (rt->state == RTSP_STATE_STREAMING)
rt->need_subscription = 0;
if (rt->state == RTSP_STATE_STREAMING)
@@
-874,7
+887,7
@@
retry:
if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) {
/* send dummy request to keep TCP connection alive */
if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) {
/* send dummy request to keep TCP connection alive */
- if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 ||
+ if ((av_gettime
_relative
() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 ||
rt->auth_state.stale) {
if (rt->server_type == RTSP_SERVER_WMS ||
(rt->server_type != RTSP_SERVER_REAL &&
rt->auth_state.stale) {
if (rt->server_type == RTSP_SERVER_WMS ||
(rt->server_type != RTSP_SERVER_REAL &&
@@
-897,6
+910,7
@@
static int rtsp_read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
{
RTSPState *rt = s->priv_data;
int64_t timestamp, int flags)
{
RTSPState *rt = s->priv_data;
+ int ret;
rt->seek_timestamp = av_rescale_q(timestamp,
s->streams[stream_index]->time_base,
rt->seek_timestamp = av_rescale_q(timestamp,
s->streams[stream_index]->time_base,
@@
-906,11
+920,11
@@
static int rtsp_read_seek(AVFormatContext *s, int stream_index,
case RTSP_STATE_IDLE:
break;
case RTSP_STATE_STREAMING:
case RTSP_STATE_IDLE:
break;
case RTSP_STATE_STREAMING:
- if (
rtsp_read_pause(s
) != 0)
- return
-1
;
+ if (
(ret = rtsp_read_pause(s)
) != 0)
+ return
ret
;
rt->state = RTSP_STATE_SEEKING;
rt->state = RTSP_STATE_SEEKING;
- if (
rtsp_read_play(s
) != 0)
- return
-1
;
+ if (
(ret = rtsp_read_play(s)
) != 0)
+ return
ret
;
break;
case RTSP_STATE_PAUSED:
rt->state = RTSP_STATE_IDLE;
break;
case RTSP_STATE_PAUSED:
rt->state = RTSP_STATE_IDLE;