summaryrefslogtreecommitdiffstats
path: root/sub/find_subfiles.c
Commit message (Collapse)AuthorAgeFilesLines
* vo: dropping subtitle files on the VO window adds them as subtitle fileswm42014-01-041-0/+5
| | | | | | | Note that we don't try to be clever about detecting the files as subtitles: we just check the file extension. We could go all the way and check the files by opening them with a demuxer, but that would probably do more bad than good.
* path lookup functions: mp_msg conversionswm42013-12-211-1/+1
| | | | | | | | | | | | | | | | | There's a single mp_msg() in path.c, but all path lookup functions seem to depend on it, so we get a rat-tail of stuff we have to change. This is probably a good thing though, because we can have the path lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c.
* find_subfiles: mp_msg conversionswm42013-12-211-8/+11
|
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-2/+2
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-2/+2
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* sub: respect detected language for fuzzy-matched external subtitleswm42013-11-251-14/+10
| | | | | | | Solve this by passing through the language to the player, which then uses the generic subtitle selection code to make a choice. Fixes #367.
* Rename sub.c/.h to osd.c/.hwm42013-11-241-1/+0
| | | | | This was way too misleading. osd.c merely calls the subtitle renderers, instead of actually dealing with subtitles.
* find_subfiles: fix really dumb bug causing segfaultswm42013-09-171-1/+1
| | | | | | | NULL pointer deref when a .sub file with the same filename as the video file was present. I was probably half asleep when writing this code.
* find_subfiles: fix off-by-1 errorGabriel Peixoto2013-09-081-1/+1
| | | | | | | This could lead to a segfault, fixes #219 Signed-off-by: Gabriel Peixoto <gabrielrcp@gmail.com> Signed-off-by: wm4 <wm4@nowhere>
* mplayer: don't auto-load explicitly loaded subtitle fileswm42013-09-071-0/+4
| | | | | | | | | | | Even if a subtitle was explicitly loaded with -sub, it was still auto- loaded (if auto-loading applied to that file). Fix this by explicitly checking whether a file is already loaded. The check is maximal naive and just compares the filenames as strings. The change in find_subfiles.c is so that "-sub something.ass" happens to work (auto-loading prepended a "./" to it, so the naive filename comparison check didn't work).
* find_subfiles: don't auto-load .sub file if .idx file existswm42013-09-071-22/+55
| | | | | | | | | | | | | | | | External vobsubs usually come as .idx/.sub pairs. Loading the .idx file implicitly loads the .sub file, whereas loading the .sub file will kind of work, but miss important information such as subtitle resolution. Or in other words, if the .idx file exists, adding the .sub file as track is useless and confusing. Explicitly remove .sub file from the auto-load suntitle list in these cases. Standalone .sub files are still loaded. We also drop that weird logic that excluded .utf8 files from being loaded if -subcp was in use. I hope the associated use case didn't make much sense to begin with. If not, we could still implement it properly, instead of this weird hack.
* find_subfiles: some cleanupswm42013-09-071-6/+0
| | | | | | | Remove a crap assert() (what... either it can't happen, or it should error or at least abort() if it can't be handled). Remove some dead definitions.
* find_subfiles: use stat() instead of opening the file to check existencewm42013-09-071-3/+1
| | | | | | | Use mp_path_exists() to check for existence of a file (which in turn uses stat()), instead of opening and closing it. The difference is that if we don't have sufficient permissions to read the subtitle files, we will loudly complain. Personally, I prefer this behavior.
* find_subfiles: don't try to open URLs as directorieswm42013-09-071-0/+3
| | | | | Did things like opendir("http://..."). Makes no sense, and just generates noise.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-4/+4
| | | | Followup commit. Fixes all the files references.
* sub: remove some global variableswm42013-05-301-5/+4
|
* Fix some cppcheck / scan-build warningswm42013-05-061-1/+0
| | | | | | | | These were found by the cppcheck and scan-build static analyzers. Most of these aren't interesting (the 2 previous commits fix some interesting cases found by these analyzers), and they don't nearly fix all warnings. (Most of the unfixed warnings are spam, things MPlayer never cared about, or false positives.)
* path: add mp_find_config_file and reorganize some of the codeStefano Pigozzi2012-12-151-2/+2
| | | | | | | | | | | | | | Add `mp_find_config_file` to search different known paths and use that in ass_mp to look for the fontconfig configuration file. Some incidental changes spawned by this feature where: * Buffer allocation for the strings containing the paths is now performed with talloc. All of the allocations are done on a NULL context, but it still improves readability of the code. * Move the OSX function for lookup inside of a bundle: this code path was currently not used by the bundle generated with `make osxbundle`. The plan is to use it again in a future commit to get a fontconfig config file.
* sub: remove vobsub reader in favor of ffmpeg vobsub demuxerwm42012-12-111-51/+2
| | | | | | | | ffmpeg recently added a demuxer that can read vobsubs (pairs of .sub and .idx files). Get rid of the internal vobsub reader, and use the ffmpeg demuxer instead. Sneak in an unrelated manpage change (autosub default).
* Rename directories, move files (step 2 of 2)wm42012-11-121-4/+4
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* options: remove subtitle related options that did nothingwm42012-10-241-0/+1
| | | | | | | Most of these cased working when the OSD was switched to libass, or didn't do anything even before that. Also don't recursively include subreader.h in sub.h.
* sub: silence output of subtitle search messagewm42012-07-301-1/+1
| | | | This message is not so interesting.
* bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstrwm42012-07-281-13/+13
| | | | | Replace all uses of bstr() with bstr0(). Also remove the ridiculous C++ workaround.
* windows support: unicode filenameswm42012-03-091-0/+2
| | | | | | | | | | | | | | | | | | | 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.
* bstr: rename BSTR() -> bstr()Uoti Urpala2011-07-271-13/+13
| | | | | | 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.
* find_subfiles: fix unintended modification of global filenameUoti Urpala2011-04-281-1/+1
| | | | | | | | | | 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.
* cleanup: find_subfiles.c: simplify (mainly using bstr)Uoti Urpala2011-04-201-156/+113
|
* cleanup: find_subfiles.c: simplify declarations and allocationsClément Bœsch2011-04-201-36/+25
| | | | | Also clarify compare_sub_priority() and remove a typedef for the subfn structure in the process.
* find_subfiles: select subtitle files matching -slangClément Bœsch2011-04-201-57/+59
| | | | Also simplify subtitle selection a bit.
* find_subfiles: try to determine if a .sub file is text or vobsubClément Bœsch2011-04-201-0/+14
| | | | | | | 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".
* subs: options: add -sub-pathsClément Bœsch2011-04-201-3/+25
|
* find_subfiles: allow subtitle search in multiple directoriesClément Bœsch2011-04-201-117/+103
|
* subs: move vobsub loading logic down to find_subfiles.cUoti Urpala2011-04-201-0/+25
| | | | | | | 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.
* subs: move text sub loading logic down to find_subfiles.cClément Bœsch2011-04-201-1/+10
| | | | | | 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.
* find_subfiles: move sub_filenames() hereClément Bœsch2011-04-201-0/+271
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.