summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* sub: uglify OSD code path with lockingwm42014-01-1810-107/+119
| | | | | | | | | | | | | | | Do two things: 1. add locking to struct osd_state 2. make struct osd_state opaque While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses lots of osd_state (and osd_object) members. To make sure everything is accessed synchronously, I prefer making osd_state opaque, even if it means adding pretty dumb accessors. All of this is meant to allow running VO in their own threads. Eventually, VOs will request OSD on their own, which means osd_state will be accessed from foreign threads.
* sub: uglify sub decoder with lockingwm42014-01-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The plan is to make the whole OSD thread-safe, and we start with this. We just put locks on all entry points (fortunately, dec_sub.c and all sd_*.c decoders are very closed off, and only the entry points in dec_sub.h let you access it). I think this is pretty ugly, but at least it's very simple. There's a special case with sub_get_bitmaps(): this function returns pointers to decoder data (specifically, libass images). There's no way to synchronize this internally, so expose sub_lock/sub_unlock functions. To make things simpler, and especially because the lock is sort-of exposed to the outside world, make the locks recursive. Although the only case where this is actually needed (although trivial) is sub_set_extradata(). One corner case are ASS subtitles: for some reason, we keep a single ASS_Renderer instance for subtitles around (probably to avoid rescanning fonts with ordered chapters), and this ASS_Renderer instance is not synchronized. Also, demux_libass.c loads ASS_Track objects, which are directly passed to sd_ass.c. These things are not synchronized (and would be hard to synchronize), and basically we're out of luck. But I think for now, accesses happen reasonably serialized, so there is no actual problem yet, even if we start to access OSD from other threads.
* player: remove OSD message IDswm42014-01-174-66/+39
| | | | | | These were needed before the last commit, but now they don't do anything anymore. (They were used to decide whether to replace or stack the previous OSD message when a new one was displayed.)
* player: remove OSD stackwm42014-01-173-58/+15
| | | | | | | | | | | If certain OSD messages were displayed at the same time, the hidden messages were put on the stack, and displayed again once the higher priority messages disappeared. The idea was probably that lower priority messages could not hide higher priority ones, and also that the lower messages did not get lost. But in practice, this gives confusing results with OSD messages randomly reappearing for a brief time. Remove it.
* player: don't use OSD message stack for term OSD subswm42014-01-172-13/+17
| | | | | | | | Showing subtitles on terminal used the OSD message stack (which uses a stack to "pile up" messages that were displayed at the same time). This had a bunch of weird and annoying consequences. This accessed a certain osd_state field, which is a minor annoyance since I want to make that struct opaque. Implement this differently.
* lua: add a --lua-opts option, which can be queried by scriptswm42014-01-161-0/+16
| | | | | | | The values set by this new option can be queried by Lua scripts using the mp.getopt() function. The function takes a string parameter, and returns the value of the first key that matches. If no key matches, nil is returned.
* lua: use core log level nameswm42014-01-162-12/+3
| | | | | | When the Lua code was written, the core didn't have names for log levels yet (just numbers). The only user visible change is that "verbose" becomes "v", since this level had different names.
* lua: allow scripts to snoop messageswm42014-01-161-10/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the following Lua function to enable message events: mp.enable_messages(size, level) size is the maximum number of messages the ringbuffer consists of. level is the minimum log level for a message to be added to the ringbuffer, and uses the same values as the mp.log() function. (Actually not yet, but this will be fixed in the following commit.) The messages will be delivered via the mp_event() in the user script, using "message" as event name. The event argument is a table with the following fields: level: log level of the message (string as in mp.log()) prefix: string identifying the module of origin text: contents of the message As of currently, the message text will contain newline characters. A message can consist of several lines. It is also possible that a message doesn't end with a newline, and a caller can use multiple messages to "build" a line. Most messages will contain exactly 1 line ending with a single newline character, though. If the message buffer overflows (messages are not read quickly enough), new messages are lost until the queued up messages are read. At the point of the overflow, a special overflow message is inserted. It will have prefix set to "overflow", and the message text is set to "". Care should be taken not to print any messages from the message event handler. This would lead to an infinite loop (the event handler would be called again after returning, because a new message is available). This includes mp.log() and all mp.msg.* functions. Keep in mind that the Lua print() function is mapped to mp.msg.info().
* msg: move special declarations to msg_control.hwm42014-01-163-0/+4
| | | | | While almost everything uses msg.h, the moved definitions are rarely needed by anything.
* io/win32: move mp_attach_console to terminal-win.cMartin Herkt2014-01-161-1/+0
| | | | Why didn't I put it there from the start?
* player: handle the corner cases in --term-osd-bar correctlyJohannes Nixdorf2014-01-151-3/+3
| | | | With the old code and pos == width - 2 one character too many is drawn.
* player: use more than 1/100 resolution for --term-osd-barJohannes Nixdorf2014-01-151-1/+2
| | | | | If the terminal width is large enough the position marker jumps over several characters because currently pos only increases in 1/100th steps.
* osc: check for availabillity of percent-pos instead of lengthChrisK22014-01-151-2/+2
| | | | ... to decide wether the seekbar should be enabled or not.
* command: if playback position is unknown, make percent-pos unavailablewm42014-01-151-3/+8
| | | | | | | Before that, it just returned -1. The print case is inconsistent with that, but I'll leave it for now, because it's consistent with status line / show_progress behavior.
* player: add --term-osd-bar, which shows a status bar on the terminalwm42014-01-151-0/+29
| | | | | Feature request from github issue #451. Disabled by default, will probably stay this way.
* player: don't print status in --idle modewm42014-01-141-1/+1
| | | | Apparently this annoys certain users. Restores old behavior.
* player: avoid stalling when starting a network streamwm42014-01-141-2/+7
| | | | | | | | | | | | Starting a network stream could stall by executing uncacheable stream control requests (STREAM_CTRL_GET_LANG and STREAM_CTRL_GET_DVD_INFO). Being uncacheable means the player has to wait until the cache is done reading the current block of data. These requests can't be cached because they're too complicated, so the only way to avoid them is special casing the DVD and Bluray streams (which are the only things which need these requests), and not doing them in other cases. (This is kind of inelegant, but so is the rest of the DVD/BD code.)
* player: redo terminal OSD and status line handlingwm42014-01-136-62/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The terminal OSD code includes the handling of the terminal status line, showing player OSD messages on the terminal, and showing subtitles on terminal (the latter two only if there is no video window, or if terminal OSD is forced). This didn't handle some corner cases correctly. For example, showing an OSD message on the terminal always cleared the previous line, even if the line was an important message (or even just the command prompt, if most other messages were silenced). Attempt to handle this correctly by keeping track of how many lines the terminal OSD currently consists of. Since there could be race conditions with other messages being printed, implement this in msg.c. Now msg.c expects that MSGL_STATUS messages rewrite the status line, so the caller is forced to use a single mp_msg() call to set the status line. Instead of littering print_status() all over the place, update the status only once per playloop iteration in update_osd_msg(). In audio- only mode, the status line might now be a little bit off, but it's perhaps ok. Print the status line only if it has changed, or if another message was printed. This might help with extremely slow terminals, although in audio+video mode, it'll still be updated very often (A-V sync display changes on every frame). Instead of hardcoding the terminal sequences, use terminfo/termcap to get the sequences. Remove the --term-osd-esc option, which allowed to override the hardcoded escapes - it's useless now. The fallback for terminals with no escape sequences for moving the cursor and clearing a line is removed. This somewhat breaks status line display on these terminals, including the MS Windows console: instead of querying the terminal size and clearing the line manually by padding the output with spaces, the line is simply not cleared. I don't expect this to be a problem on UNIX, and on MS Windows we could emulate escape sequences. Note that terminal OSD (other than the status line) was broken anyway on these terminals. In osd.c, the function get_term_width() is not used anymore, so remove it. To remind us that the MS Windows console apparently adds a line break when writint the last column, adjust screen_width in terminal- win.c accordingly.
* player: don't block terminal OSD while seekingwm42014-01-131-3/+6
| | | | | | | | Seeking usually show the status on OSD. In terminal OSD mode, no status is shown, because there is already a separate status line. Unfortunately, the mechanism for showing the status was still active, which forced showing no message while the code for showing seek status was active.
* player: mention subtitles in av_desync_help_textwm42014-01-121-2/+2
| | | | | | | | Insane .ass subtitle scripts can cause severe slowdown (depending on the speed of the machine, or the insanity of the script), so mention how to test without subtitles. This is mainly to make the user aware that subtitle rendering can be a problem. For longwinded explanation, there isn't enough space.
* command: don't access VO for output parameterswm42014-01-091-12/+18
| | | | | | Use the video chain for this instead. This is for facilitating coming changes, which will clean up the vo->aspdat stuff, and this code would be in the way.
* player: strip 'file://' from filenames on playback startwm42014-01-081-1/+7
| | | | | | | | | | | | This fixes two things: 1. Dropping files on the VO window will auto-load subtitles (since most drag & drop code prefixes the filenames with 'file://', and the subtitle auto-load code considers 'file://' non-local) 2. Fix behavior of the %x screenshot filename template (similar problem) One could force all that code to special-case 'file://' URLs, but just replacing the filename on playback start is simpler.
* screenshot: add format specifiers to get file directory pathwm42014-01-081-0/+21
| | | | | Useful if you want to put the screenshot into the same directory as the file that is being played.
* player: fix setting smaller timeout on Windows systemswm42014-01-081-1/+1
| | | | | | | On Windows, we don't have proper input event wakeup handling, so we need to lower the playloop timeout in order to react fast to input. Closes #387.
* audio: fix previous commitwm42014-01-061-1/+1
|
* Fix audio delay inversionMartin Herkt2014-01-062-4/+4
|
* sub: fix previous commitwm42014-01-061-2/+2
| | | | sub_seek and sub_step were broken.
* Fix subtitle delay inversionMartin Herkt2014-01-061-1/+1
|
* player: always ise [statusline] for terminal OSDwm42014-01-051-3/+3
| | | | | | This was inconsistent: the actual statusline used [statusline] as message prefix, while other parts of the terminal OSD used [cplayer] (and MSGL_STATUS). This commit makes it consistent.
* player: print an error message if run command failswm42014-01-051-1/+5
| | | | | | | | | | | Note that we can't use mp_msg, because it's not async-signal safe (we might be running other threads while forking, so only functions specified to be async-signal safe can be called, and this doesn't include stdio; mp_msg acquires a mutex too). Also, always print a \n before running the program to flush the status line. The effect is that a program running successfully as well as the error message will effectively start on a new line.
* player: don't select subtitles added from quvi by defaultwm42014-01-052-5/+10
| | | | | | | | | | Quvi subtitles are considered external subtitles (simply because they're separate from the audio/video stream), but for the sake of subtitle auto-selection, they should not be considered external. Change this so that quvi subtitles are treated like muxed subtitles (with default flag never set). This means subtitles won't be selected by default, unless explicitly requested with --sid or --slang.
* demux_subreader: reject file if not opened by --subwm42014-01-041-0/+1
| | | | | | | demux_subreader.c contains the old MPlayer subtitle parser, and I have absolutely no confidence in this (very crappy) code. There might be one or two security risks associated with running that code on arbitrary input.
* dvdnav: set correct stride for fake highlightswm42014-01-031-1/+1
| | | | | This didn't really matter, because the fake highlight rectangle is in a single color, and every pixel has the same color value.
* Windows: use the GUI subsystem, attach to consoleMartin Herkt2014-01-021-0/+1
| | | | | | | | This is necessary to start mpv without forcing a console window, but also breaks console usability. A workaround is to call mpv from a wrapper process that uses the console subsystem and helps redirecting the standard streams and WriteConsole output to where they belong.
* player: load encoding-profiles.conf before the main configwm42014-01-011-7/+7
| | | | Otherwise one can't add profiles based on the encoding profiles.
* player: fix DVD playbackwm42014-01-011-1/+1
| | | | | | | Crashed in case of lazily added subtitle streams, which add tracks with track->stream set to NULL. Fixes gituhub issue #439.
* Update copyright yearwm42014-01-011-1/+1
|
* video: fix --brightness etc. optionswm42013-12-291-0/+14
| | | | They were set before the VO was intitialized, which silently failed.
* player: add two more font mimetypes recognized by Haaliwm42013-12-291-1/+3
| | | | | | | | | | | | | | The Haali Matroska splitter is basically the reference implementation for this crap, and it knows only: application/vnd.ms-opentype application/x-font-ttf application/x-truetype-font Two of them were missing in our code. One of them, "application/x-font", is probably plain incorrect, but I can't really tell. Also see: http://www.cccp-project.net/beta/test_files/fontsample.mkv
* player: use arrays to list font mimetypes and font file extensionswm42013-12-291-9/+15
|
* Install encoding-profiles.conf by defaultwm42013-12-281-9/+26
| | | | | | | | | | | | This is probably useful. Note that this includes a small, stupid hack to prevent loading of the config file if vf_lavfi is not available. The profile by default uses vf_lavfi, and the config parser will output errors if vf_lavfi is not available. As another caveat, we install the example profile even if encoding is disabled (though we don't load it, since this would print errors).
* player: fix buggy error condition when loading mpv.confwm42013-12-281-1/+1
|
* options: simplify handling of some help optionswm42013-12-261-4/+0
|
* player: deselect secondary sub when switching to file with different trackswm42013-12-251-0/+2
| | | | | | This applies the usual logic of resetting stream selections to default when switching to a file with a different track layout. (This is to prevent selecting random streams.)
* player: fix initial selection with --secondary-sidwm42013-12-251-3/+21
| | | | | | | | Also, make sure that a track can't be selected twice. While this might work in some situations, it certainly won't work with subtitles demuxed from a stream. Fixes #425.
* player: add --secondary-sid for displaying a second subtitle streamwm42013-12-248-83/+166
| | | | | | | This is relatively hacky, but it's Christmas, so it's ok. This does two things: 1. allow selecting two subtitle tracks, and 2. include a hack that renders the second subtitle always as toptitle. See manpage additions how to use this.
* player: add infrastructure to select multiple tracks at oncewm42013-12-246-43/+64
| | | | | Of course this does not allow decoding multiple tracks at once; it just adds some minor infrastructure, which could be used to achieve this.
* player: do initial seek for external tracks only oncewm42013-12-241-2/+12
| | | | | | Normally, there can be only one demuxer stream active for each demuxer of an external file, but this assumption will be broken for multiple subtitles support.
* player: slightly simplify seeking in external fileswm42013-12-241-16/+9
| | | | | | | For some reason, this checked whether there are external tracks at all before doing any seeks. Possibly this was to avoid multiple get_main_demux_pts() calls, but calling this multiple times shouldn't be too bad.
* player: redo demuxer stream selectionwm42013-12-247-85/+79
| | | | | | | Use struct track to decide what stream to select. Add a "selected" field and use that in some places instead of checking mpctx->current_track.
* player: fix typo in previous commitwm42013-12-231-1/+1
| | | | Apparently I pushed too quickly.
* player: warn if Matroska font attachments have incorrect MIME typewm42013-12-231-2/+11
| | | | | | Normally we shouldn't load these files. But for some reason it was added in commit b784346e some years ago, and disabling this hack would probably be an inconvenience. So just print a warning.
* player: simplify mp_load_per_file_configwm42013-12-221-8/+7
| | | | | Get rid of the stupid and error-prone buffer size calculations, use snprintf instead of strcpy.
* player: move code aroundwm42013-12-222-42/+37
| | | | | | The only thing that used mp_load_per_file_config() was inside configfiles.c too, so remove the declaration from core.h and move the function before its use.
* player: remove code duplication for auto-loaded config profileswm42013-12-221-60/+14
| | | | | | Code for loading "[vo.vdpau]" profiles and similar. The messages printed on loading change, but other than that, everything should behave about the same.
* path: change mp_splitext() semanticswm42013-12-221-1/+1
| | | | | | | | | Including the "." in the returned extension was too inconvenient. I think originally, the semantics were supposed to work like in Python, but screw this. Also, return NULL instead of "" on failure (which is what its only user actually seems to expect).
* Don't include version.h from make options.cwm42013-12-221-2/+7
| | | | | | | | | I find this annoying. It's the reason common/version.c exists at all. options.c did this for the user agent, which contains the version number. Because not including version.h means you can't build the user agent and use it in mp_default_opts anymore, do something rather awkward in main.c to initialize the default user agent.
* msg: remove global statewm42013-12-211-1/+6
|
* player: use separate msg prefix for statuslinewm42013-12-213-3/+5
| | | | | So the user can specifically mute or unmute the status line with --msglevel. Accidentally removed with commit 5e0c4ec3.
* msg: rename mp_msg_log -> mp_msgwm42013-12-213-15/+15
| | | | Same for companion functions.
* msg: convert defines to enumwm42013-12-211-1/+1
| | | | Also get rid of MSGL_HINT and the many MSGL_DBG* levels.
* path lookup functions: mp_msg conversionswm42013-12-217-68/+70
| | | | | | | | | | | | | | | | | 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