summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* audio: remove sample rate limit checkswm42014-03-301-7/+1
| | | | | | | | | | | This played the file at a wrong sample rate if the rate was out of certain bounds. A comment says this was for the sake of libaf/af_resample.c. This resampler has been long removed. Our current resampler (libav/swresample) checks supported sample rates on reconfiguration, and will error out if a sample rate is not supported. And I think that is the correct behavior.
* player: dvdnav: fix start time when entering and leaving menuwm42014-03-301-0/+4
| | | | | Unfortunately, quite a hack, because we have check the nav state outside of discnav.c.
* Merge remote-tracking branch 'mpv/pr/676'wm42014-03-303-20/+46
|\
| * player: rename dvdnav to discnavxylosper2014-03-303-11/+11
| | | | | | | | | | Now, navigation works both of DVD and non-BD-J Blu-ray. Therefore, rename all 'dvdnav' strings which are not DVD specific to 'discnav'
| * stream_bluray: implement navigation interface for Blu-ray streamxylosper2014-03-291-9/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces new stream protocols: bdnav(and others). bdnav stream shares lots of codes with original bluray stream, so it's not separated in different source file. Major difference from bluray is that bdnav does not support longest title because there is no way to query that information. bdnav://menu and bdnav://first correspond to top menu title and first play title respectively, though they often point same title. Also, binary position based seeking has been removed, because it didn't have no point.
* | video/out: remove legacy colorspace stuffwm42014-03-291-9/+9
|/ | | | | | | | | Reduce most dependencies on struct mp_csp_details, which was a bad first attempt at dealing with colorspace stuff. Instead, consistently use mp_image_params. Code which retrieves colorspace matrices from csputils.c still uses this type, though.
* player: fix unchecked access for chapter metadatawm42014-03-261-3/+1
| | | | | | | | | | It's possible that MPContext has a chapter list, but the demuxer doesn't. In this case, accesing the chapter-metadata property would lead to invalid accesses. (This fixes the out of bound access, but in theory, the returned data can still be incorrect, since MPContext chapters don't need to map directly to demuxer chapters.)
* dvdnav: fix minor memory leakwm42014-03-251-0/+1
| | | | | | This was usually handled at the end of the switch statement, so if something returns from the function before that, the event has to be freed explicitly.
* dvdnav: check and update video resolution whenever renderingxylosper2014-03-251-14/+25
| | | | | | | Previous implementation updated video resolution when highlight event was given. However, this may not work if highlight event is given before video size is queried. This commit adds checking routine into rendering function, too.
* dvdnav: make MP_NAV_EVENT_RESET_ALL handled properlyxylosper2014-03-251-1/+3
| | | | | | | | | | | dvdnav.c did not handle event in regular sequence. Usually this does not make any trouble except around MP_NAV_EVENT_RESET_ALL. Those events should be handled in regular sequence. If they're mixed, it can make wrong result. For instance, MP_NAV_EVENT_HIGHLIGHT right after MP_NAV_EVENT_RESET_ALL should not be ignored but it might be because MP_NAV_EVENT_RESET_ALL makes the demuxer reloaded and osd hidden.
* dvdnav: prevent reallocation of fake highlight bufferxylosper2014-03-251-0/+2
| | | | | Since subsizes were never updated, the bitmap buffer was always reallocated whenever mp_nav_get_highlight() called.
* player: use MP_NOPTS_VALUE as rel_time_to_abs() error valuewm42014-03-254-16/+15
| | | | | | And consistently use MP_NOPTS_VALUE as error value for the users of this function. This is better than using -1, especially because negative values can be valid timestamps.
* player: handle chapter range like --start/--endwm42014-03-252-8/+8
| | | | | | | | | | | Instead of comparing the current chapter every time, set the playback end timestamp to the chapter end. Likewise, don't execute an extra seek for the start chapter. Maybe we could also use the timeline facility to restrict playback to the given chapter range, but this would be strange when using --chapter=N to start playback at a given chapter. Then you couldn't seek back, which is possibly not what the user wants.
* player: let chapter_start_time() return MP_NOPTS_VALUE for unknown timeswm42014-03-253-4/+4
|
* player: remove weird separation between no chapters and 0 chapterswm42014-03-252-17/+11
| | | | | | For some reason, it mattered whether mpctx->chapters was NULL or not, even if mpctx->num_chapters was 0. Remove this separation; it serves no purpose.
* player: remove demuxer chapoter API wrapperswm42014-03-253-33/+34
| | | | | | Instead, always use the mpctx->chapters array. Before this commit, this array was used only for ordered chapters and such, but now it's always populated if there are chapters.
* stream: remove old chapter handling codewm42014-03-251-8/+1
| | | | | | | | Stream-level chapters (like DVD etc.) did potentially not have timestamps for each chapter, so STREAM_CTRL_SEEK_TO_CHAPTER and STREAM_CTRL_GET_CURRENT_CHAPTER were needed to navigate chapters. We've switched everything to use timestamps and that seems to work, so we can simplify the code and remove this old mechanism.
* player: remove confusing argc/argv adjustmentwm42014-03-231-5/+0
| | | | It's better if argc/argv always mean the same thing.
* command: make 'disc-title' property writablexylosper2014-03-181-2/+8
| | | | | | | | This commit makes 'disc-title' property writable using STREAM_CTRL_SET_CURRENT_TITLE. This commit also contains implementation of STREAM_CTRL_SET_CURRENT_TITLE for stream_bluray. Currently, 'disc-title' is writable only for stream_dvdnav and stream_bluray and stream_dvd is not supported.
* osc: add enable/disable message, and map DEL to disabling the OSCwm42014-03-171-0/+14
| | | | | | | | | "enable-osc" will make the OSC appear at any time (although it'll quickly disappear again if the mouse is not inside the OSC). "disable- osc" will make it disappear permanently. Also, if the OSC is visible, force remap the DEL key to make the OSC disappear.
* lua: rename mp.register_script_command() to mp.register_script_message()wm42014-03-171-13/+13
| | | | More consistent naming.
* command, lua: change script_message semanticswm42014-03-173-2/+22
| | | | | | | | Change script_message to broadcast the message to all clients. Add a new script_message_to command, which does what the old script_message command did. This is intended as simplification, although it might lead to chaos too.
* build: simplify libavfilter configure checkswm42014-03-161-1/+1
| | | | | This is all not needed anymore. In particular, remove all configure switches except --enable-libavfilter.
* demux_libass: change how external ASS subtitles are loadedwm42014-03-151-4/+0
| | | | | | | | | | Instead of parsing the ASS file in demux_libass.c and trying to pass the ASS_Track to the subtitle renderer, just read all file data in demux_libass.c, and let the subtitle renderer pass the file contents to ass_process_codec_private(). (This happens to parse full files too.) Makes the code simpler, though it also relies harder on the (messy) probe logic in demux_libass.c.
* command: rename dvd- properties to disc-wm42014-03-151-7/+7
| | | | Since these are not DVD-only, but can also be used with BDs.
* command: prefix DVD title properties with "dvd-"wm42014-03-151-8/+8
| | | | | | | | | | They're strictly DVD-only, so it's better to mark them as such. This also documentes the "title" (now renamed to "dvd-title") property. This also avoids collision with the --title option. (Technically, there was no problem. But it might be confusing for users, since we have a policy of naming properties and options the same if they refer to the same underlying functionality.)
* command: add new property 'title'xylosper2014-03-151-0/+20
| | | | | | This commit adds new property 'title' which indicates current playing title of disc. This property is useful when using a stream whose title can be changed during playback, e.g., dvdnav.
* player/main: Fix Cygwin buildJames Ross-Gowan2014-03-131-12/+8
| | | | | | | | Xlib.h (included from x11_common.h) defines a macro 'Status' as 'int'. This messed up a bunch of definitions in windows.h and broke the build in Cygwin. Including windows.h first seems to solve the problem. This commit also removes the definition of an unused flag.
* command: fix wrong condition & remove redundant stream type checkingxylosper2014-03-131-14/+2
|
* command: set 'media-title' property for bluray disc with meta-dataxylosper2014-03-131-5/+15
|
* af: add metadata field to af_stream and af_instanceAlessandro Ghedini2014-03-131-0/+1
| | | | | | This allows to propagate metadata information to audio filters. Closes #632
* Revert "player: simplify audio reset when seeking"wm42014-03-101-10/+15
| | | | | | | | | | | This reverts commit 75dd3ec2106701cb865f52966de66c51cb6f9204. This broke seeking with ordered chapters in some situations. While the reverted commit was perfectly fine for playback of normal files, it overlooked that in the ordered chapters case switching segments actually reinitialized the audio chain completely, including the decoder. And decoders still read packets on initialization. We can restore the original commit as soon as decoders stop doing this.
* audio: don't downmix when doing digital passthroughwm42014-03-101-1/+2
| | | | | | This obviously doesn't work. It wasn't much of a problem in the past because most passthrough formats use 2 channels, which is also the default for downmix.
* audio: make --channels option always force the output layoutwm42014-03-101-6/+1
| | | | | | Use the --channels value directly on the AO, instead of doing it only in the --channels=stereo (default) case and if the decoder output is not stereo.
* audio: don't write audio when pausedwm42014-03-091-0/+5
| | | | | | | | | | This is probably "safer". Without it, we will play 1 sample, because the logic was written in a way to decode 1 sample if audio is paused. 1 sample usually will initialize the audio PTS, but not play any real audio. Also see previous commit. In ancient times, this actually used 1 byte (instead of 1 sample), so clearly no sample was written, unless the audio was 8-bit mono.
* audio: remove handling of partially written datawm42014-03-093-21/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the ao_buffer_playable_samples field. This contained the number of samples that fill_audio_out_buffers() wanted to write to the AO (i.e. this data was supposed to be played at some point), but ao_play() rejected it due to partial fill. This could happen with many AOs, notably those which align all written data to an internal period size (often called "outburst" in the AO code), and the accepted number of samples is rounded down to period boundaries. The left-over samples at the end were still kept in mpctx->ao_buffer, and had to be played later. The reason ao_buffer_playable_samples had to exist was to make sure that at EOF, the correct number of left-over samples was played (and not possibly other data in the buffer that had to be sliced off due to endpts in fill_audio_out_buffers()). (You'd think you could just slice the entire buffer, but I suspect this wasn't done because the end time could actually change due to A/V sync changes. Maybe that was the reason it's so complicated.) Some commits ago, ao.c gained internal buffering, and ao_play() will never return partial writes - as long as you don't try to write more samples than ao_get_space() reports. This is always the case. The only exception is filling the audio buffers while paused. In this case, we decode and play only 1 sample in order to initialize decoding (e.g. on seeking). Actually playing this 1 sample is in fact a bug, but even of the AO doesn't have period size alignment, you won't notice it. In summary, this means we can safely remove the code.
* audio/out: make draining a separate operationwm42014-03-091-3/+2
| | | | | | | | | | | | Until now, this was always conflated with uninit. This was ugly, and also many AOs emulated this manually (or just ignored it). Make draining an explicit operation, so AOs which support it can provide it, and for all others generic code will emulate it. For ao_wasapi, we keep it simple and basically disable the internal draining implementation (maybe it should be restored later). Tested on Linux only.
* command: fix osd-height propertywm42014-03-091-1/+1
|
* audio/out: make ao struct opaquewm42014-03-095-51/+71
| | | | | | We want to move the AO to its own thread. There's no technical reason for making the ao struct opaque to do this. But it helps us sleep at night, because we can control access to shared state better.
* encode: don't access ao->ptswm42014-03-071-0/+4
| | | | | | | | | | This field will be moved out of the ao struct. The encoding code was basically using an invalid way of accessing this field. Since the AO will be moved into its own thread too and will do its own buffering, the AO and the playback core might not even agree which sample a PTS timestamp belongs to. Add some extrapolation code to handle this case.
* lua: add license headerwm42014-03-071-0/+17
| | | | Oops.
* player: reformat some codewm42014-03-031-22/+14
|
* player: make separation between user/automatic track selection strongerwm42014-03-033-8/+29
| | | | | | | | | | For example, consider the case when audio initialization fails. Then the audio track is deselected. Before this commit, this would have been equivalent to the user disabling audio. This is bad when multiple files are played at once (the next file would have audio disabled, even if it works), or if playback resume is used (if e.g. audio output failed to initialize, then audio would be disabled when resuming, even if the system's audio driver was fixed).
* command: fix null pointer dereference in idle modewm42014-03-021-2/+2
| | | | Pressing 'h' in idle mode -> crash.
* player: cheap hack against idle event feedback loopwm42014-03-012-2/+7
| | | | | | | | | | | The OSC used significant CPU time while the player was paused. It turned out that the "tick" event sent during pause is the problem. The OSC accesses the player core when receiving a tick event, which in turn will cause the core to send another tick event, leading to infinite feedback. Fix this by sending an idle tick only every 500ms. This is not very proper, but the idea behind the tick event isn't very clean to begin with (and the OSC should use timers instead).
* client API: fix playloop thread wakeupwm42014-03-011-0/+9
| | | | | | | | | | | | | | The playloop usually waits in select(), using a timeout needed for refilling audio and video buffers. This means the client API needs a separate mechanism to interrupt the select() call. This mechanism exists, but I forgot to use it. This commit fixes it. If it works, this will make the client API react faster, epsecially in audio-only mode. If video is enabled, the reaction time is capped to 50ms (or somewhat faster if the framerate is >20 fps), because the playloop stops reacting to anything in order to render and time the next video frame. (This will be fixed later by moving the VO to its own thread.)
* lua: set a proper chunk name for builtin moduleswm42014-03-011-1/+2
| | | | | | | | luaL_loadstring(), which was used until now, uses the start of the Lua code itself as chunk name. Since the chunk name shows up even with runtime errors triggered by e.g. Lua code loaded from user scripts, this looks a but ugly. Switch to luaL_loadbuffer(), which is almost the same as luaL_loadstring(), but allows setting a chunk name.
* lua: fix add_key_binding()wm42014-03-011-2/+2
| | | | | add_key_binding() didn't work, because it passed a flag that was renamed. add_forced_key_binding() worked, but did the wrong thing.
* lua: fix format string in luaL_error()wm42014-03-011-1/+1
|
* client API: fix timeout handlingwm42014-03-011-1/+4
| | | | | | (Again.) Fixed Lua timers as well.
* lua: fix use of renamed functionwm42014-03-011-3/+3
| | | | Apparently this was overlooked when get_timer was renamed to get_time.
* lua: add option to disable auto-loading of lua scriptswm42014-02-281-0/+2
|
* config: don't load global config files with --config-dirwm42014-02-281-1/+2
| | | | This sidestepped the usual logic by hardcoding the path.
* client API: add two properties, 'time-start' and 'seekable'xylosper2014-02-281-0/+21
|
* client APIs: fix some typosxylosper2014-02-281-1/+1
|
* client API: rename MPV_EVENT_PLAYBACK_START, add MPV_EVENT_SEEKwm42014-02-283-2/+9
| | | | | | Rename MPV_EVENT_PLAYBACK_START to MPV_EVENT_FILE_LOADED. Add MPV_EVENT_SEEK and MPV_EVENT_PLAYBACK_RESTART.
* client API: wait for remaining asynchronous requests before terminatingwm42014-02-281-0/+9
| | | | | | Sending an asynchronous request and then calling mpv_destroy() would crash the player when trying to send the reply to the removed client. Fix this by waiting until all remaining replies have been sent.
* command: use the step size for "add volume" commandswm42014-02-271-4/+1
| | | | | | | | | | | | The step argument for "add volume <step>" was ignored until now. Fix it. There is one problem: by defualt, "add volume" should use the value set with --volstep. This value is 3 by default. Since the default volue for the step argument is always 1 (and we don't really want to make the generic code more complicated by introducing custom step sizes), we simply multiply the step argument with --volstep to keep it compatible. The --volstep option should probably be just removed in the future.
* command: format volume property as integer for OSDwm42014-02-271-0/+6
| | | | | | | The value range is 0-100, so fractional values don't make much sense. But the underlying data type is probably float to avoid getting "stuck" when doing small volume increments. So step this around and pretend it's an integer just on display.
* lua: add set_property_native functionwm42014-02-261-3/+132
| | | | | | Probably completely useless, at least for now. Also not very well tested, but initial test seems successful.
* lua: mark table values returned by get_property_native with their typewm42014-02-262-1/+22
| | | | | | | Lua doesn't distinguish between arrays and maps on the language level; there are just tables. Use metatables to mark these tables with their actual types. In particular, it allows distinguishing empty arrays from empty tables.
* lua: implement mp.get_opt() in Luawm42014-02-262-24/+9
| | | | | | Will be more expensive if used very often, but it's probably ok. Reduce the dependency of lua.c on MPContext a bit further.
* client API: don't send MPV_EVENT_IDLE when not entering idle modewm42014-02-261-2/+3
| | | | | | For simplicity, this was sent before actually checking the idle condition, which meant that we'd send it even of the idle loop is never entered.
* client API: don't explode when destroying uninitialized mpv_handlewm42014-02-261-1/+2
|
* client API: accept NULL as mpv_destroy() argumentwm42014-02-261-0/+3
|
* client API: treat MPV_FORMAT_STRING differently in mpv_set_propertywm42014-02-261-19/+20
| | | | | | | | | | | | | |