Revision 5b33a553 libavformat/file.c

View differences:

libavformat/file.c
26 26
#include <io.h>
27 27
#endif
28 28
#include <unistd.h>
29
#include <sys/stat.h>
29 30
#include <sys/time.h>
30 31
#include <stdlib.h>
31 32
#include "os_support.h"
......
73 74
static int64_t file_seek(URLContext *h, int64_t pos, int whence)
74 75
{
75 76
    int fd = (intptr_t) h->priv_data;
76
    if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)
77
        return AVERROR_NOTSUPP;
77
    if (whence == AVSEEK_SIZE) {
78
        struct stat st;
79
        int ret = fstat(fd, &st);
80
        return ret < 0 ? AVERROR(errno) : st.st_size;
81
    }
78 82
    return lseek(fd, pos, whence);
79 83
}
80 84

  

Also available in: Unified diff