[FFmpeg-devel] [PATCH] lavf: add SFTP protocol via libssh

Michael Niedermayer michaelni at gmx.at
Fri Sep 20 23:15:34 CEST 2013


On Thu, Sep 19, 2013 at 08:13:00PM +0200, Lukasz M wrote:
> > > +static int libssh_open(URLContext *h, const char *url, int flags)
> > > +{
> > > +    static const int verbosity = SSH_LOG_NOLOG;
> >
> > Why is this a variable?
> >
> 
> libssh's API require to pass a pointer to it.
> 
> 
> > > +        access = O_CREAT | O_RDWR;
> > > +        if (s->trunc)
> > > +            access |= O_TRUNC;
> > > +    } else if (flags & AVIO_FLAG_WRITE) {
> > > +        access = O_CREAT | O_WRONLY;
> > > +        if (s->trunc)
> > > +            access |= O_TRUNC;
> > > +    } else {
> > > +        access = O_RDONLY;
> > > +    }
> >
> > These flags may need special treatment on windows (e.g. _O_CREAT). I'm
> > not sure we handle it yet.
> >
> 
> This code is copied from file.c. Those constants are defined in fcntl.h.
> If fcntl.h is portable then it is OK.
> 
> 
> >
> > > +    if (!(stat = sftp_fstat(s->file))) {
> > > +        av_log(h, AV_LOG_WARNING, "Cannot stat remote file %s.\n",
> > path);
> > > +        s->filesize = -1;
> > > +    } else {
> > > +        s->filesize = stat->size;
> > > +        sftp_attributes_free(stat);
> > > +    }
> >
> > This is not fatal?
> >
> 
> No. Without known size seek with SEEK_END and SEEK_SIZE will return error
> tho.
> 
> Rest of remarks fixed or answered in other mail.
> 
> I also replaced S_IRWXU into S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH
> In file protocol 0666 is used in , maybe this is also an option
> 
> Fixed patch in attachment.

>  Changelog                |    1 
>  configure                |    4 
>  doc/protocols.texi       |   32 ++++++
>  libavformat/Makefile     |    1 
>  libavformat/allformats.c |    1 
>  libavformat/libssh.c     |  229 +++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 268 insertions(+)
> ef7a7d230e4030bec5225bad055682b3c2294dac  0001-lavf-add-SFTP-protocol-via-libssh.patch
> From 6b74918e11ba8847e62385213eabde2f132eac99 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki at gmail.com>
> Date: Wed, 18 Sep 2013 14:08:11 +0200
> Subject: [PATCH] lavf: add SFTP protocol via libssh

this breaks mplayer build, someone should update mplayers configure
before this is applied ideally.
It has to be fixed anyway and fixing it first avoids breaing mplayer
build

CC  libavformat/libssh.o
libavformat/libssh.c:22:10: fatal error: 'libssh/sftp.h' file not found
#include <libssh/sftp.h>
         ^
1 error generated.


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130920/6471f58d/attachment.asc>


More information about the ffmpeg-devel mailing list