[vlc-devel] "file://localhost/" handling in input.c on win32

Michael A. Puls II shadow2531 at gmail.com
Wed Aug 24 14:17:10 CEST 2011


On Tue, 23 Aug 2011 19:32:00 -0400, Michael A. Puls II  
<shadow2531 at gmail.com> wrote:

> I'll just create a vlc_proxy.exe for Opera that converts  
> file://localhost/ to file:///

I created this workaround for Opera users:

#include <string>
#include <windows.h>
#include <cstdlib>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

int main() {
     wstring command(GetCommandLineW());
     command = regex_replace(command, wregex(L"vlc_opera", regex::icase),  
wstring(L"vlc"), format_first_only);
     command = regex_replace(command, wregex(L"file://localhost/",  
regex::icase), wstring(L"file:///"));
     STARTUPINFOW si;
     PROCESS_INFORMATION pi;
     ZeroMemory(&si, sizeof(si));
     ZeroMemory(&pi, sizeof(pi));
     si.cb = sizeof(si);
     if (!CreateProcessW(NULL, &command[0], NULL, NULL, FALSE, 0, NULL,  
NULL, &si, &pi)) {;
         return EXIT_FAILURE;
     }
     WaitForSingleObject(pi.hProcess, INFINITE);
     CloseHandle(pi.hProcess);
     CloseHandle(pi.hThread);
}

// g++ -Wall -Wextra vlc_opera.cc -o vlc_opera -O3 -s  
-Wl,--subsystem,windows -lboost_regex

Just place vlc_opera.exe next to vlc.exe. Then, when using "pass web  
address directly to application" for the file type in Opera (ctrl + F12 ->  
advanced -> downloads -> the type -> edit -> "open with other  
application"), set the program to vlc_opera.exe instead of vlc.exe and  
vlc_opera will pass things along with file://localhost/ paths converted to  
file:///.

-- 
Michael



More information about the vlc-devel mailing list