[vlc-devel] commit: file: network file extra caching for Win32 ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Jul 23 17:08:39 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 23 18:08:44 2009 +0300| [18df9b1abd0ba84ebb9f5195f839a7966d286472] | committer: Rémi Denis-Courmont 

file: network file extra caching for Win32

Fixes #2983 for good ths time hopefully...
(cherry picked from commit 2a6adf74461a5e4ac7f791937f27ad28b9b9a54a)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18df9b1abd0ba84ebb9f5195f839a7966d286472
---

 configure.ac          |    1 +
 modules/access/file.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 43a72f0..9e184c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -352,6 +352,7 @@ case "${host_os}" in
         VLC_ADD_LIBS([activex mozilla],[-lgdi32])
         VLC_ADD_LIBS([cdda vcdx cddax sdl_image],[-lwinmm])
         VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap slp http stream_out_standard stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp telnet rc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd],[-lws2_32])
+        VLC_ADD_LIBS([access_file], [-lshlwapi])
     fi
     if test "${SYS}" = "mingwce"; then
         # add ws2 for closesocket, select, recv
diff --git a/modules/access/file.c b/modules/access/file.c
index 70929c7..f6af2bf 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -59,6 +59,7 @@
 #if defined( WIN32 )
 #   include <io.h>
 #   include <ctype.h>
+#   include <shlwapi.h>
 #else
 #   include <unistd.h>
 #   include <poll.h>
@@ -162,6 +163,10 @@ static int Open( vlc_object_t *p_this )
 {
     access_t     *p_access = (access_t*)p_this;
     access_sys_t *p_sys;
+#ifdef WIN32
+    wchar_t wpath[MAX_PATH+1];
+    bool is_remote = false;
+#endif
 
     /* Update default_pts to a suitable value for file access */
     var_Create( p_access, "file-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
@@ -181,6 +186,13 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Dbg (p_access, "opening file `%s'", p_access->psz_path);
         fd = open_file (p_access, p_access->psz_path);
+#ifdef WIN32
+        if (MultiByteToWideChar (CP_UTF8, 0, p_access->psz_path, -1,
+                                 wpath, MAX_PATH)
+         && PathIsNetworkPathW (wpath))
+            is_remote = true;
+# define IsRemote( fd ) ((void)fd, is_remote)
+#endif
     }
     if (fd == -1)
         goto error;




More information about the vlc-devel mailing list