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

Lukasz M lukasz.m.luki at gmail.com
Thu Sep 19 20:13:00 CEST 2013


> > +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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavf-add-SFTP-protocol-via-libssh.patch
Type: application/octet-stream
Size: 12104 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130919/65827cae/attachment.obj>


More information about the ffmpeg-devel mailing list