summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* encoding: fixed-vo option was removedwm42015-02-131-1/+0
|
* player: add a --loop=force modewm42015-02-122-8/+6
| | | | | | | Requested. See manpage additions. This also makes the magical loop_times constants slightly saner, but shouldn't change the semantics of any existing --loop option values.
* osx: move code to unset input context to the right placewm42015-02-121-4/+4
| | | | | | | Setting the input context is always called, both in cplayer and libmpv, and under HAVE_COCOA. Unsetting the input context was done only the cplayer uninit call. Also it was under HAVE_COCOA_APPLICATION, so it was not unset in libmpv (dangling pointer).
* osx: move cocoa specific call out of common codewm42015-02-121-8/+0
| | | | This is almost equivalent, and gets rid of the ifdef.
* player: drop explicit exit() callswm42015-02-121-14/+9
| | | | | | | | | The code in main.c calls exit() explicitly, but the code is actually easier to follow by simply exiting from main() instead. The exit() call in av_log.c happens only on severely broken builds, so replace it with abort(). (Shuts up rpmlint warnings.)
* audio: add device change notification for hotpluggingwm42015-02-122-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Not very important for the command line player; but GUI applications will want to know about this. This only adds the internal API; support for specific audio outputs comes later. This reuses the ao struct as context for the hotplug event listener, similar to how the "old" device listing API did. This is probably a bit unclean and confusing. One argument got reusing it is that otherwise rewriting parts of ao_pulse would be required (because the PulseAudio API requires so damn much boilerplate). Another is that --ao-defaults is applied to the hotplug dummy ao struct, which automatically applies such defaults even to the hotplug context. Notification works through the property observation mechanism in the client API. The notification chain is a bit complicated: the AO notifies the player, which in turn notifies the clients, which in turn will actually retrieve the device list. (It still has the advantage that it's slightly cleaner, since the AO stuff doesn't need to know about client API issues.) The weird handling of atomic flags in ao.c is because we still don't require real atomics from the compiler. Otherwise we'd just use atomic bitwise operations.
* Revert "player: make --force-window create the window immediately on start"wm42015-02-121-1/+0
| | | | | | | | | | | This reverts commit acc5e8f57419debdb74234a228b44db75023e28b. As expected, some didn't like this. Others won't like this revert. Whatever. See #1561. This should go into mpv 0.8.0 before it's released.
* player: use af_scaletempo when slowing down audio toowm42015-02-121-1/+1
| | | | | | In my opinion the artifacts created by af_scaletempo on extreme slowdown (50% or so) are too bothersome - but users disagree. So use af_scaletempo on any speed changes, not just on speedup.
* player: skip audio filter reinit on some types of speed changeswm42015-02-101-1/+11
| | | | | | | | | | | | | This avoids potentially dropping some small amount of audio data buffered in filters. Reinit can be skipped only if the filter is af_scaletempo (which maps to AF_CONTROL_SET_PLAYBACK_SPEED). The other case using af_lavrresample is much more complicated due to filter chain politics. Also, changing speed between 1.0 and something higher typically inserts or removes the filter, so this obviously requires reinitialization. It can be prevented by forcing the filter with --af=scaletempo.
* tl_matroska: only check the chapter count when adding chaptersBen Boeckel2015-02-061-3/+3
| | | | | | | Fixes #1445 without failing in the case where file outside.mkv with N chapters references inside.mkv with N+1 chapters. Since we don't care about the number of chapters in inner files (yet; nested chapters would change this, but also make chapters dynamic anyways), don't check there.
* tl_matroska: squeeze down the number of parametersBen Boeckel2015-02-061-62/+77
| | | | | | Much cleaner. The difference between timeline_info and inner_timeline_info is that timeline_info is stuff the top-level cares about and inner_timeline_info is just for the current chapter.
* player: do not autoload audio with audio files, enable autoloadingwm42015-02-051-0/+12
| | | | | | | | | | | | | | Autoload external audio files only if there's at least a video track (which is not coverart pseudo-video). Enable external audio file autoloading by default. Now that we actively avoid doing stupid things like loading an external audio file for an audio-only file, this should be fine. Additionally, don't autoload subtitles if a subtitle is played. Although you currently can't play subtitles without audio or video, it's disturbing and stupid that the player might load subtitle files with different extension and then fail.
* matroska: warn against mismatching segmentswm42015-02-041-0/+49
| | | | | | | | Matroska ordered chapters require all segment files to have the same layout. If a referenced file has more tracks than the main file or misses some tracks, the file is invalid. Also see issue #1553.
* player: move timeline specific handling to timeline loaderswm42015-02-044-14/+14
| | | | In particular, gets rid of the Matroska specifics from the common code.
* command: add on_unload hookwm42015-02-041-0/+10
| | | | Fixes #1552.
* player: make --force-window create the window immediately on startwm42015-02-031-0/+1
| | | | | | | | | | | | | | | | Before this change, window creation was delayed until the video was initialized. This guaranteed that the first window size was that of the video, so the WM would place it correctly. Some time ago, it was requested on the IRC channel that --force-window should not do this. Sometimes, it can take a while until video is initialized, e.g. when youtube-dl is used (which incurs lots of network delay). In this case, it's awkward that it takes so long until a window (any window) is shown. On the other hand, this can cause incorrect window placement with some WMs. We simply hope that this won't happen with modern WMs. (Although it does with the WM I use, crappy old IceWM.)
* player: remove --fixed-vowm42015-02-033-7/+2
| | | | | | | In ancient times, this was needed because it was not default, and many VOs had problems with it. But it was always default in mpv, and all VOs are required to deal with it. Also, running --fixed-vo=no is not useful and just creates weird corner cases. Get rid of it.
* command: new commands audio_add/audio_remove/audio_reloadxylosper2015-02-033-34/+37
| | | | | | | | These commands are counterparts of sub_add/sub_remove/sub_reload which work for external audio file. Signed-off-by: wm4 <wm4@nowhere> (minor simplification)
* command: add property returning detected audio deviceStefano Pigozzi2015-02-031-1/+11
| | | | | This can be useful to adjust some other audio related properties at runtime depending on the audio device being used.
* command: add property returning detected hwdec APIwm42015-02-021-1/+32
| | | | | | | | | This is somewhat imperfect, because detection of hw decoding APIs is mostly done on demand, and often avoided if not necessary. (For example, we know very well that there are no hw decoders for certain codecs.) This also requires every hwdec backend to identify itself (see hwdec.h changes).
* player: add external audio file auto-loadingwm42015-02-021-44/+58
| | | | | | Apparently some people want this. Not enabled by default. Fixes #967.
* command: add properties returning the current VO and AO driverwm42015-02-021-2/+18
| | | | This wasn't possible before.
* client API: add mpv_wait_async_requests()wm42015-02-021-8/+12
| | | | | | | | | | | | | | | | | | | | This does what it's documented to do. The implementation reuses the code in mpv_detach_destroy(). Due to the way async requests currently work, just sending a synchronous dummy request (like a "ignore" command) would be enough to ensure synchronization, but this code will continue to work even if this changes. The line "ctx->event_mask = 0;" is removed, but it shouldn't be needed. (If a client is somehow very slow to terminate, this could silence an annoying queue overflow message, but all in all it does nothing.) Calling mpv_wait_async_requests() and mpv_wait_event() concurrently is in theory allowed, so change pthread_cond_signal() to pthread_cond_broadcast() to avoid missed wakeups. As requested in issue #1542.
* command: add dummy get implementation for tv-channel propertywm42015-02-021-0/+2
| | | | | A small cosmetic change with the effect that pressing 'k' shows "unavailable" instead of "error" (even if no TV code is active).
* player: dump audio jitter to stats filewm42015-02-011-4/+5
| | | | | This allows us to plot the difference between video timestamps, and the adjusted video timestamps due to syncing video to audio speed.
* command: send additional property change events in-between loadingwm42015-02-013-0/+3
| | | | | | | | Opening the stream and opening the demuxer are both done asynchronously, meaning the player reacts to client API requests. They also can potentially take a while. Thus it's better to process outstanding property changes, so that change events are sent for properties that were changed during opening.
* command: improve observability of some audio propertieswm42015-02-011-1/+2
| | | | | | | | | In particular, this would fix the sending the initial change event. It was easily missed because MPV_EVENT_FILE_LOADED usually triggered it, but the actual property could change only later, because audio initialization really is kind of asynchronous to it. This probably fixes #1544.
* player: don't treat audio playback restart while paused specialwm42015-01-301-4/+1
| | | | | | I guess this was supposed to be some sort of optimization, but even though it probably works, it's pretty meaningless and I couldn't measure a difference. One special case killed.
* player: minor simplification in A/V-sync related codewm42015-01-302-10/+6
| | | | Just minor things.
* Revert "player: allow seeking audio between video frames"wm42015-01-301-9/+1
| | | | | | | | This reverts commit 7b3feecbc23e3e0b0d9cf66f02af53d127a0b681. It's broken, hr-seek never ends at a video position before seek pts. Not sure what I was thinking, although it did work anyway when artificially forcing a video frame to display before seek pts.
* player: print desync message on negative A/V-sync toowm42015-01-301-1/+1
| | | | | | | | At least there is _some_ problem if this happens. It would mean that audio is playing slower than video. Normally, video is synced to audio, so if audio stops playback completely, video will not advance at all. But using things like --autosync, it's well possible that this kind of desync happens.
* player: rearrange some A/V-sync related codewm42015-01-301-6/+5
| | | | | | | | | | | | Move the update_avsync_before_frame() call further down. Moving it closer to where the time_frame value is used (and which the function updates) should make the code more readable. With this change, there's no need anymore to reset the time_frame value on the video reconfig path. Move the update_avsync_after_frame() up. Now no meaningful amount of time passes since the previous get_relative_time() call anymore, and the second one can be removed.
* player: use correct type for some relative timeswm42015-01-301-3/+3
| | | | | | We use double for these things everywhere, just this code didn't. It likely doesn't matter much, and this code is for an optional feature too.
* command: change sub-visibility OSD messagewm42015-01-291-1/+2
| | | | | | | | | | | | | Now it shows one of: - "Subtitles hidden" (sub-visibility=no) - "Subtitles visible" (sub-visibility=yes, sub!=no) - "Subtitles visible (but no subtitles selected)" (otherwise) It should be a bit more self-explanatory than before. On the other hand, I have no clue about UI issues. This also gets close to what's reasonably possible with the OSD expansion string syntax, which is why it looks so awful.
* player: move more code out of central playloop functionwm42015-01-291-58/+73
| | | | | | | | | | ...into its own functions. The central playloop function is still too big, but looks much cleaner now. No changes in functionality. The code moved to handle_playback_restart() is unindented by 1 level and moving it out of the if condition around. The if condition is inverted and early-exits from the function. Also some comments are changed.
* player: remove redundant variablewm42015-01-295-12/+9
| | | | | | mpctx->audio_delay always has the same value as opts->audio_delay. (This was not the case a long time ago, when the audio-delay property didn't actually write to opts->audio_delay. I think.)
* player: allow seeking audio between video frameswm42015-01-281-1/+9
| | | | | | | | | | | | | | | This allows seeking audio between two video frames that are relatively far away. The implementation of this is a bit subtle. It pretend the audio position is different, and the actual PTS adjustment happens in audio.c with this line: sync_pts -= mpctx->audio_delay - mpctx->delay; Effectively this is the same as setting sync_pts to hrseek_pts after this line, though. (I'm actually not sure if this could be written in a more straightforward way; probably yes.)
* player: enable hr-seek on audio after video endwm42015-01-281-1/+2
| | | | | | | | | | | | | | | | | | Some files can have audio after video has ended, and playback of the audio-only remainder is supposed to work just fine. Seeking is broken-ish though. Not much can be done about this, since it's the way demuxers work. Also, such files are obscure corner cases. But enabling hr-seek for audio after video end can improve the situation a lot. This helps with issue #1533. The reported also provided a command line to produce such a file: ffmpeg -i image.jpg -i audio.flac -threads $(nproc) \ -c:v libvpx -crf 10 -qmin 5 -qmax 55 \ -vf scale=360:-1 -sws_flags lanczos -c:a libvorbis -ac 2 \ -b:a 128K out.webm
* player: demote matroska ordered chapter scanning messages to VerboseDiogo Franco (Kovensky)2015-01-281-1/+1
| | | | | Causes a lot of terminal spam on large folders and is not actually useful except maybe for debugging.
* ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAILBen Boeckel2015-01-271-1/+1
| | | | | The macro actually returns the *available* space in the array, not how much is actually filled in.
* command: export more details about file seekabilitywm42015-01-261-0/+10
| | | | | | | | | | If a file is unseekable (consider e.g. a http server without resume functionality), but the stream cache is active, the player will enable seeking anyway. Until know, client API user couldn't know that this happens, and it has implications on how well seeking will work. So add a property which exports whether this situation applies. Fixes #1522.
* player: fix framestep over timeline segment boundarieswm42015-01-261-0/+2
| | | | | | | | | | | This was subtly broken by commit a937ba20. Instead of framestepping over the timeline segment boundary, it would just unpause playback, because seeking now resets mpctx->step_frames. This was especially apparent when doing something like "mpv *.jpg --merge-files". Fix by restoring the step_frames field specifically if the seek is done for switching segment boundaries. Hopefully the number fields which need such an exception on seeking won't grow and turn this code into a mess.
* options: list correct default value for --screenshot-templatewm42015-01-261-1/+1
| | | | | | Make the default value part of the option metadata, instead of doing this in the screenshot code. Makes more sense with --list-options and the command.c option metadata properties.
* lua: do not use math.pow()wm42015-01-251-1/+1
| | | | | It's the first thing that breaks with Lua 5.3. I don't know if there are other failures because I don't care enough.
* vo: simplify VOs by adding generic screenshot supportwm42015-01-241-1/+1
| | | | | | | | | | | At the time screenshot support was added, images weren't refcounted yet, so screenshots required specialized implementations in the VOs. But now we can handle these things much simpler. Also see commit 5bb24980. If there are VOs in the future which can't do this (e.g. they need to write to the image passed to vo_driver->draw_image), this still could be disabled on a per-VO basis etc., so we lose no potential performance advantages.
* ytdl: implement user-agent and cookie overrideswm42015-01-241-5/+34
| | | | | | | | | | | | | | | | For some sites, youtube-dl sends a special user-agent. If we don't send the same user-agent, the server will reject mpv's connection attempt. This was observed with trailers.apple.com. Fix it by forcing the user-agent youtube-dl uses. Some sites set cookies when doing a website access, and require the client to provide these cookies when downloading the actual media. This is needed at least by nicovideo.jp. Fix by adding youtube-dl's cookies to our request headers. Both of these require a very recent youtube-dl version (youtube-dl added the necessary headers a few hours ago). The script still works with older youtube-dl versions, though.
* video: separate screenshot modeswm42015-01-231-24/+25
| | | | | | | | | Use different VOCTRLs for "window" and normal screenshot modes. The normal one will probably be removed, and replaced by generic code in vo.c, and this commit is preparation for this. (Doing it the other way around would be slightly simpler, but I haven't decided yet about the second one, and touching every VO is needed anyway in order to remove the unneeded crap. E.g. has_osd has been unused for a long time.)
* input, player: new command for mouse eventxylosper2015-01-231-0/+19
| | | | | | | New command `mouse <x> <y> [<button> [single|double]]` is introduced. This will update mouse position with given coordinate (`<x>`, `<y>`), and additionally, send single-click or double-click event if `<button>` is given.
* command: export file format as propertywm42015-01-231-0/+12
| | | | | | | | | | | | Repurpose demuxer->filetype for this. It used to be used to print a human readable format description; change it to a symbolic format name and export it as property. Unfortunately, libavformat has its own weird conventions, which are reflected through the new property, e.g. the .mp4 case mentioned in the manpage. Fixes #1504.
* player: some fixes for property notificationxylosper2015-01-232-4/+4
| | | | | | | | | | `core-idle` depends on seeking state `mpctx->restart_complete`, so make `core-idle` notified whenever `seeking` is notified, too. `paused-for-cache` can be changed on MPV_EVENT_CACHE_UPDATE obviously. Finally, `MPV_EVENT_PLAYBACK_RESTART` should be notified after `mpctx->restart_complete` changed.
* video: handle hwdec screenshots differentlywm42015-01-221-0/+10
| | | | | | | | Instead of converting the hw surface to an image in the VO, provide a generic way to convet hw surfaces, and use this in the screenshot code. It's all relatively straightforward, except vdpau is being terrible. It needs a huge chunk of new code, because copying back is not simple.
* client API: check locale, and reject anything other than "C" localewm42015-01-201-0/+16
| | | | | | | | | | | | | | | Sigh... The C locale system is incredibly shitty, and if used, breaks basic string functions. The locale can change the decimal mark from "." to ",", which affects conversion between floats and strings: snprintf() and strtod() respect the locale decimal mark, and change behavior. (What's even better, the behavior of these functions can change asynchronously, if setlocale() is called after threads were started.) So just check the locale in the client API, and refuse to work if it's wrong. This also makes the lib print to stderr, which I consider the lesser evil in this specific situation.
* win32: remove check for SetPriorityClass()wm42015-01-201-3/+3
| | | | | | | | | | This function is always available, which is reflected by the fact that the configure check doesn't actually bother to check for its existence. Instead, MinGW and Cygwin imply it. The check was probably "needed" when the priority code was still in a separate source file. Remove the check, and use _WIN32 for testing for the win32 API (in a bunch of other places too).
* audio: don't force any parameters if spdif is usedwm42015-01-201-5/+3
| | | | | | The existing code only ignored --audio-channels, but not --audio-rate or --audio-format if spdif passthrough is used. Setting these makes no sense.
* demux_disc: pass seek flags to stream layerwm42015-01-191-3/+6
| | | | | | | | | | | | | | | | Pass through the seek flags to the stream layer. The STREAM_CTRL semantics become a bit awkward, but that's still the least awkward part about optical disc media. Make demux_disc.c request relative seeks. Now the player will use relative seeks if the user sends relative seek commands, and the demuxer announces it wants these by setting rel_seeks to true. This change probably changes seek behavior for dvd, dvdnav, bluray, cdda, and possibly makes seeking useless if the demuxer-cache is set to a high value. Will be used in the next commit. (Split to make reverting the next commit easier.)
* client API: minor cleanupwm42015-01-191-17/+28
| | | | | Try not to put "everything" into mpv_wait_event: move out the code for generating log message events.
* client API: notify API user on event queue overflowwm42015-01-192-11/+23
| | | | | | | | | | | | |