Commit Graph

12 Commits

Author SHA1 Message Date
wm4 a1244111a7 windows support: unicode filenames
Windows uses a legacy codepage for char* / runtime functions accepting
char *. Using UTF-8 as the codepage with setlocale() is explicitly
forbidden.

Work this around by overriding the MSVCRT functions with wrapper
macros, that assume UTF-8 and use "proper" API calls like _wopen etc.
to deal with unicode filenames. All code that uses standard functions
that take or return filenames must now include osdep/io.h. stat()
can't be overridden, because MinGW-w64 itself defines "stat" as a
macro. Change code to use use mp_stat() instead.

This is not perfectly clean, but still somewhat sane, and much better
than littering the rest of the mplayer code with MinGW specific hacks.
It's also a bit fragile, but that's actually little different from the
previous situation. Also, MinGW is unlikely to ever include a nice way
of dealing with this.
2012-03-09 20:48:54 +02:00
Uoti Urpala 0958620591 bstr: rename BSTR() -> bstr()
Rename the BSTR() function to bstr(). The former caused a conflict
with some Windows OS name, and it's no longer a macro so uppercase
naming is less appropriate.
2011-07-27 08:38:12 +03:00
Uoti Urpala 3b401fb07f find_subfiles: fix unintended modification of global filename
Commit a2d28010cc ("cleanup: find_subfiles.c: simplify (mainly using
bstr)") was missing a bstrdup() in subtitle search code, and thus the
code erroneously modified the original filename string passed in. As a
result anything which printed or otherwise used the filename after
that would use a lowercase-converted version instead of the actual
file name. Fix by adding the bstrdup() to operate on a local copy of
the name instead.
2011-04-28 09:44:37 +03:00
Uoti Urpala a2d28010cc cleanup: find_subfiles.c: simplify (mainly using bstr) 2011-04-20 04:22:53 +03:00
Clément Bœsch 52d60a7334 cleanup: find_subfiles.c: simplify declarations and allocations
Also clarify compare_sub_priority() and remove a typedef for the subfn
structure in the process.
2011-04-20 04:22:53 +03:00
Clément Bœsch 549177c105 find_subfiles: select subtitle files matching -slang
Also simplify subtitle selection a bit.
2011-04-20 04:22:53 +03:00
Clément Bœsch 1a152eadaf find_subfiles: try to determine if a .sub file is text or vobsub
A file with the ambiguous extension .sub could be either VOBsub or
MicroDVD. If there's a corresponding .idx file it's certainly VOBsub,
so don't add it to the list of potential text subtitles. This will
avoid the annoying warning "SUB: Could not determine file format".
2011-04-20 04:22:53 +03:00
Clément Bœsch 1c6995d76c subs: options: add -sub-paths 2011-04-20 04:22:52 +03:00
Clément Bœsch acc187cd20 find_subfiles: allow subtitle search in multiple directories 2011-04-20 04:22:52 +03:00
Uoti Urpala bdfdece245 subs: move vobsub loading logic down to find_subfiles.c
Analogously to the previous commit, move path handling logic for
loading external vobsub files from mplayer.c to find_subfiles.c.

Based on a commit from Clément Bœsch but fixed and simplified.
2011-04-20 04:22:52 +03:00
Clément Bœsch 7221e28fe3 subs: move text sub loading logic down to find_subfiles.c
Move path handling for loading external subtitle files from mplayer.c
to find_subfiles.c. Now the remaining code in mplayer.c only gets a
list of potential filenames and tries opening those.
2011-04-20 04:22:52 +03:00
Clément Bœsch 9bcfbe4d4f find_subfiles: move sub_filenames() here
Move sub_filenames() and related code from subreader.c to new file
find_subfiles.c. This function is used to find subtitle files that
should be loaded for the current video; this functionality is not
specific to the particular kind of text subtitle handling implemented
in subreader.c.

Also reindent and prettify the moved code a bit.
2011-04-20 04:22:52 +03:00