summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* player: fix an assert when reinitializing audio in some caseswm42014-02-091-0/+3
| | | | | | | | This sometimes happened when changing playback speed (= reinitializing audio) after seeking of playback start. The assertion in audio.c:441 was triggered, because buffer_playable_samples wasn't reset correctly when the audio buffer was cleared or shortened. The assertion is correct and should hold up any time.
* player: handle seek delays differentlywm42014-02-075-25/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code removed from handle_input_and_seek_coalesce() did two things: 1. If there's a queued seek, stop accepting non-seek commands, and delay them to the next playloop iteration. 2. If a seek is executing (i.e. the seek was unqueued, and now it's trying to decode and display the first video frame), stop accepting seek commands (and in fact all commands that were queued after the first seek command). This logic is disabled if seeking started longer than 300ms ago. (To avoid starvation.) I'm not sure why 1. would be needed. It's still possible that a command immediately executed after a seek command sees a "seeking in progress" state, because it affects queued seeks only, and not seeks in progress. Drop this code, since it can easily lead to input starvation, and I'm not aware of any disadvantages. The logic in 2. is good to make seeking behave much better, as it guarantees that the video display is updated frequently. Keep the core idea, but implement it differently. Now this logic is applied to seeks only. Commands after the seek can execute freely, and like with 1., I don't see a reason why they couldn't. However, in some cases, seeks are supposed to be executed instantly, so queue_seek() needs an additional parameter to signal the need for immediate update. One nice thing is that commands like sub_seek automatically profit from the seek delay logic. On the other hand, hitting chapter seek multiple times still does not update the video on chapter boundaries (as it should be). Note that the main goal of this commit is actually simplification of the input processing logic and to allow all commands to be executed immediately.
* demux: handle tag updates differentlywm42014-02-061-1/+1
| | | | | | | | | | | | | | | | Instead of printing lines like: Demuxer info GENRE changed to Alternative Rock Just output all tags once they change. The assumption is that individual tags rarely change, while all tags change in the common case. This changes tag updates to use polling. This could be fixed later, although the ICY stuff makes it a bit painful, so maybe it will remain this way. Also remove DEMUXER_CTRL_UPDATE_INFO. This was intended to check for tag updates, but now we use a different approach.
* player: refresh OSD on track switchingwm42014-02-031-0/+2
| | | | Apparently, at least sub_reload was missing a refresh at all.
* command: output more information in colorspace properties and simplifywm42014-02-031-39/+31
| | | | | Instead of trying to be clever to avoid outputting redundant information, simply output everything that we have.
* w32: use safe DLL search paths everywhereJames Ross-Gowan2014-01-271-0/+21
| | | | | | | | | | | | Windows applications that use LoadLibrary are vulnerable to DLL preloading attacks if a malicious DLL with the same name as a system DLL is placed in the current directory. mpv had some code to avoid this in ao_wasapi.c. This commit just moves it to main.c, since there's no reason it can't be used process-wide. This change can affect how plugins are loaded in AviSynth, but it shouldn't be a problem since MPC-HC also does this and it's a very popular AviSynth client.
* w32: enable heap corruption detectionJames Ross-Gowan2014-01-271-0/+3
| | | | | | | | | | Enable the terminate-on-corruption feature. This is recommended for new Windows applications and shouldn't cause a performance hit. It actually shouldn't change anything for 64-bit builds, since Win64 has this switched on by default. See: http://blogs.msdn.com/b/michael_howard/archive/2008/02/18/faq-about-heapsetinformation-in-windows-vista-and-heap-based-buffer-overruns.aspx
* w32: don't disable the error reporting dialogJames Ross-Gowan2014-01-271-1/+1
| | | | | | Windows users expect this when a program crashes. Without it, the program just disappears. Also change the SetErrorMode call to use macros instead of a hardcoded constant.
* demux_mkv: nicer edition outputwm42014-01-231-3/+13
| | | | | | | | | | | If there's more than one edition, print the list of editions, including the edition name, whether the edition is selected, whether the edition is default, and the command line option to select the edition. (Similar to stream list.) Move reading the tags to a separate function process_tags(), which is called when all other state is parsed. Otherwise, that tags will be lost if chapters are read after the tags.
* lua: allow ~ path convention for --luawm42014-01-211-1/+3
| | | | | Paths passed to the --lua option now follow the convention for paths starting with ~ documented in mpv.rst.
* lua: add playback-start eventwm42014-01-203-0/+4
|
* player: fix initial osd progbar statewm42014-01-201-0/+1
| | | | This made seeking show an empty progbar if --osd-level=0 was used.
* player: prevent null pointer deref on uninit after -Vwm42014-01-181-0/+2
| | | | Caused by the OSD changes. Fixes #490.
* 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 s