diff options
author | Lukasz Marek <lukasz.m.luki@gmail.com> | 2013-06-07 16:27:13 +0200 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki@gmail.com> | 2013-06-08 04:17:34 +0200 |
commit | 89b4800eef7bef71f1c974ca751143f39407a437 (patch) | |
tree | 0b46843c34bb22eebf12b280ea8c66f499168f3b /libavformat/ftp.c | |
parent | eeedca4b7f4b559d1d3630585a59841c24c7a2c2 (diff) | |
download | ffmpeg-89b4800eef7bef71f1c974ca751143f39407a437.tar.gz |
ftp: probe seek capability
Make FTP streamed when server doesn't accept REST command
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Diffstat (limited to 'libavformat/ftp.c')
-rw-r--r-- | libavformat/ftp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/ftp.c b/libavformat/ftp.c index b59b5b6909..5b1c42595e 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -417,7 +417,7 @@ static int ftp_type(FTPContext *s) static int ftp_restart(FTPContext *s, int64_t pos) { char command[CONTROL_BUFFER_SIZE]; - const int rest_codes[] = {350, 501, 0}; /* 501 is incorrect code */ + const int rest_codes[] = {350, 500, 501, 0}; /* 500, 501 are incorrect codes */ snprintf(command, sizeof(command), "REST %"PRId64"\r\n", pos); if (ftp_send_command(s, command, rest_codes, NULL) != 350) @@ -573,10 +573,14 @@ static int ftp_open(URLContext *h, const char *url, int flags) goto fail; av_strlcat(s->path, path, sizeof(s->path)); - if (ftp_file_size(s) < 0 && flags & AVIO_FLAG_READ) - h->is_streamed = 1; - if (s->write_seekable != 1 && flags & AVIO_FLAG_WRITE) + if (ftp_restart(s, 0) < 0) { h->is_streamed = 1; + } else { + if (ftp_file_size(s) < 0 && flags & AVIO_FLAG_READ) + h->is_streamed = 1; + if (s->write_seekable != 1 && flags & AVIO_FLAG_WRITE) + h->is_streamed = 1; + } return 0; |