diff options
author | Anton Kindestam <antonki@kth.se> | 2018-12-05 19:02:03 +0100 |
---|---|---|
committer | Anton Kindestam <antonki@kth.se> | 2018-12-05 19:19:24 +0100 |
commit | 8b83c8996686072bc743b112ae5cb3bf93aa33ed (patch) | |
tree | b09ce6a7ff470b05006622f19914b3d39d2f7d9f /stream/stream_file.c | |
parent | 5bcac8580df6fc62323136f756a3a6d1e754fe9c (diff) | |
parent | 559a400ac36e75a8d73ba263fd7fa6736df1c2da (diff) | |
download | mpv-8b83c8996686072bc743b112ae5cb3bf93aa33ed.tar.bz2 mpv-8b83c8996686072bc743b112ae5cb3bf93aa33ed.tar.xz |
Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into wm4-commits--merge-edition
This bumps libmpv version to 1.103
Diffstat (limited to 'stream/stream_file.c')
-rw-r--r-- | stream/stream_file.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c index a905780b2d..dc5a3ed6f7 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -34,6 +34,7 @@ #include "common/common.h" #include "common/msg.h" +#include "misc/thread_tools.h" #include "stream.h" #include "options/m_option.h" #include "options/path.h" @@ -64,6 +65,7 @@ struct priv { bool regular_file; bool appending; int64_t orig_size; + struct mp_cancel *cancel; }; // Total timeout = RETRY_TIMEOUT * MAX_RETRIES @@ -84,7 +86,7 @@ static int fill_buffer(stream_t *s, char *buffer, int max_len) #ifndef __MINGW32__ if (p->use_poll) { - int c = s->cancel ? mp_cancel_get_fd(s->cancel) : -1; + int c = mp_cancel_get_fd(p->cancel); struct pollfd fds[2] = { {.fd = p->fd, .events = POLLIN}, {.fd = c, .events = POLLIN}, @@ -111,7 +113,7 @@ static int fill_buffer(stream_t *s, char *buffer, int max_len) if (!p->appending || p->use_poll) break; - if (mp_cancel_wait(s->cancel, RETRY_TIMEOUT)) + if (mp_cancel_wait(p->cancel, RETRY_TIMEOUT)) break; } @@ -159,6 +161,7 @@ static void s_close(stream_t *s) struct priv *p = s->priv; if (p->close) close(p->fd); + talloc_free(p->cancel); } // If url is a file:// URL, return the local filename, otherwise return NULL. @@ -323,7 +326,6 @@ static int open_f(stream_t *stream) if (fstat(p->fd, &st) == 0) { if (S_ISDIR(st.st_mode)) { stream->is_directory = true; - stream->allow_caching = false; MP_INFO(stream, "This is a directory - adding to playlist.\n"); } else if (S_ISREG(st.st_mode)) { p->regular_file = true; @@ -360,6 +362,10 @@ static int open_f(stream_t *stream) p->orig_size = get_size(stream); + p->cancel = mp_cancel_new(p); + if (stream->cancel) + mp_cancel_set_parent(p->cancel, stream->cancel); + return STREAM_OK; } |