X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Ffile.c;h=8303436be09cc6d8e16457d16629217ba17ad035;hb=11cb635c84cd5d011abc2aade27c7498bcf29595;hp=e613b91010281862a9ece670aafd30f046830fd3;hpb=bad70b7af6b909691f5389e14eb7d0c03db10af9;p=ffmpeg diff --git a/libavformat/file.c b/libavformat/file.c index e613b910102..8303436be09 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; } @@ -364,7 +369,7 @@ const URLProtocol ff_file_protocol = { .url_open_dir = file_open_dir, .url_read_dir = file_read_dir, .url_close_dir = file_close_dir, - .default_whitelist = "file,crypto" + .default_whitelist = "file,crypto,data" }; #endif /* CONFIG_FILE_PROTOCOL */ @@ -403,7 +408,7 @@ const URLProtocol ff_pipe_protocol = { .url_check = file_check, .priv_data_size = sizeof(FileContext), .priv_data_class = &pipe_class, - .default_whitelist = "crypto" + .default_whitelist = "crypto,data" }; #endif /* CONFIG_PIPE_PROTOCOL */