diff options
author | Marton Balint <cus@passwd.hu> | 2019-04-03 01:13:55 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2019-04-11 21:18:51 +0200 |
commit | 3e10223385b83358f013cbf6ba069f15fedc731a (patch) | |
tree | 2dc382e9b557f17ee1e4dd2a5f1a43a53f126d22 /libavformat/file.c | |
parent | 6ed7df5b20e46b30f16deca5b619a1cf88bd48b3 (diff) | |
download | ffmpeg-3e10223385b83358f013cbf6ba069f15fedc731a.tar.gz |
avformat/file: add seekable option to disallow seeking
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/file.c')
-rw-r--r-- | libavformat/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/file.c b/libavformat/file.c index e613b91010..08c7f8e6dd 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -73,6 +73,7 @@ typedef struct FileContext { int trunc; int blocksize; int follow; + int seekable; #if HAVE_DIRENT_H DIR *dir; #endif @@ -82,6 +83,7 @@ static const AVOption file_options[] = { { "truncate", "truncate existing files on write", offsetof(FileContext, trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { "follow", "Follow a file as it is being written", offsetof(FileContext, follow), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, + { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { NULL } }; @@ -238,6 +240,9 @@ static int file_open(URLContext *h, const char *filename, int flags) if (!h->is_streamed && flags & AVIO_FLAG_WRITE) h->min_packet_size = h->max_packet_size = 262144; + if (c->seekable >= 0) + h->is_streamed = !c->seekable; + return 0; } |