[FFmpeg-cvslog] lavf/ftp: explicitly enable UTF-8

Lukasz Marek git at videolan.org
Fri Jul 4 02:28:35 CEST 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Fri Jul  4 00:32:16 2014 +0200| [a0358db323a89d976255567b909f4d18a7eb3461] | committer: Lukasz Marek

lavf/ftp: explicitly enable UTF-8

Most FTP servers enable UTF-8 by default, but it is not required by the standard.
Enabling it manually makes ffmpeg implementation more consistent when server
doesn't enable it by default.

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0358db323a89d976255567b909f4d18a7eb3461
---

 libavformat/ftp.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index e99d4dd..bbed7eb 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -434,6 +434,21 @@ static int ftp_restart(FTPContext *s, int64_t pos)
     return 0;
 }
 
+static int ftp_features(FTPContext *s)
+{
+    static const char *feat_command        = "FEAT\r\n";
+    static const char *enable_utf8_command = "OPTS UTF8 ON\r\n";
+    static const int feat_codes[] = {211, 500, 502, 0};   /* 500, 502 are incorrect codes */
+    static const int opts_codes[] = {200, 451, 500, 502}; /* 500, 451, 502 are incorrect codes */
+    char *feat;
+
+    if (ftp_send_command(s, feat_command, feat_codes, &feat) == 211) {
+        if (av_stristr(feat, "UTF8"))
+            ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
+    }
+    return 0;
+}
+
 static int ftp_connect_control_connection(URLContext *h)
 {
     char buf[CONTROL_BUFFER_SIZE], opts_format[20], *response = NULL;
@@ -477,6 +492,8 @@ static int ftp_connect_control_connection(URLContext *h)
             av_log(h, AV_LOG_ERROR, "Set content type failed\n");
             return err;
         }
+
+        ftp_features(s);
     }
     return 0;
 }



More information about the ffmpeg-cvslog mailing list