path: root/demux
diff options
authorJames Ross-Gowan <>2017-10-23 21:01:45 +1100
committerJames Ross-Gowan <>2017-10-25 22:37:20 +1100
commit257a2b9646e845ef801588e871b9859d30ebf99a (patch)
tree7f9c3aec6ee54f9100ca191acd83e3a5cd0f4854 /demux
parenta5b51f75dc049b0713f4bb77cae4cb9e39ae8d49 (diff)
win32: add more-POSIXy versions of open() and fstat()
Directory-opening never worked on Windows because MSVCRT's open() doesn't open directories and its fstat() doesn't recognise directory handles. These are just MSVCRT restrictions, and the Windows API itself has no problem with opening directories as file objects, so reimplement mpv's mp_open and mp_stat to use the Windows API directly. This should fix directory playback. This also populates the st_dev and st_ino fields of struct stat, so filesystem loop checking in demux_playlist.c should now work on Windows. Fixes #4711
Diffstat (limited to 'demux')
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux_playlist.c b/demux/demux_playlist.c
index d79edfca40..dd7bc35a70 100644
--- a/demux/demux_playlist.c
+++ b/demux/demux_playlist.c
@@ -221,7 +221,7 @@ static int parse_txt(struct pl_parser *p)
static bool same_st(struct stat *st1, struct stat *st2)
- return HAVE_POSIX && st1->st_dev == st2->st_dev && st1->st_ino == st2->st_ino;
+ return st1->st_dev == st2->st_dev && st1->st_ino == st2->st_ino;
// Return true if this was a readable directory.