summaryrefslogtreecommitdiffstats
path: root/mpvcore
Commit message (Collapse)AuthorAgeFilesLines
* talloc: change talloc destructor signaturewm42013-10-131-2/+1
| | | | | | | | | | | | | Change talloc destructor so that they can never signal failure, and don't return a status code. This makes our talloc copy even more incompatible to upstream talloc, but on the other hand this is preparation for getting rid of talloc entirely. (The talloc replacement in the next commit won't allow the talloc_free equivalent to fail, and the destructor return value would be useless. But I don't want to change any mpv code either; the idea is that the talloc replacement commit can be reverted for some time in order to test whether the talloc replacement introduced a regression.)
* command: preferably show "add"/"cycle"/"set" command errors on OSDwm42013-10-121-10/+10
| | | | | | Before this, they were shown on terminal only. Now they use the OSD mechanism, which shows them on the video window or the terminal, depending on settings and what's available.
* command: don't allow changing volume if no audio initializedwm42013-10-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Changing volume when audio is disabled was a feature request (github issue #215), and was introduced with commit 327a779. But trying to fix github issue #280 (volume is not correct in no-audio mode, and if audio is re-enabled, the volume set in no-audio mode isn't set), I concluded that it's not worth the trouble and the current implementation is questionable all around. (For example, you can't change the real volume in no-audio mode, even if the AO is open - this could happen with gapless audio.) It's hard to get right, and the current mixer code is already hilariously overcomplicated. (Virtually all of mixer.c is an amalgamation of various obscure corner cases.) So just remove this feature again. Note that "options/volume" and "options/mute" still can be used in idle mode to adjust the volume used next time, though these properties can't be used during playback and thus not in audio-only mode. Querying the volume still "works" in audio-only mode, though it can return bogus values.
* playlist: check for NULL on caller sitewm42013-10-122-2/+3
| | | | | Letting some playlist functions randomly accept NULL, while others do not isn't such a good idea.
* options: --loop=N means playback N times, not N+1 timesPhilip Sequeira2013-10-122-4/+4
| | | | | | | | | | The argument or this change is that --loop should set how often the file is played, not the number of additional repeats. Based on pull request 277, with additions to the manpage and removal of "--loop=0". Signed-off-by: wm4 <wm4@nowhere>
* libquvi9: work around insane interaction between libquvi and libkdecorewm42013-10-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The primary effect of this commit is that it fixes playback resume if libquvi 0.9 and German locale are used, and libkdecore is on the system. (See github issue #279.) libquvi uses libproxy to determine system-wide proxy settings. libproxy in turn loads libkdecore (if present) to determine KDE proxy settings. libkdecore has a global constructor, which calls setlocale(LC_ALL, ""), switching the current locale from "C" to what the user's settings. This breaks some basic C string processing functions. Note that the locale won't be set on program start, but only when libproxy calls dlopen() on its config_kde module, which actually causes libkdecore to be loaded and initialized. In particular, with German locale, snprintf() would use "," instead of "." when formatting float values, which in combination with playback resume, would lead to parse errors the next time mpv was started, which is how this issue was found. I'd consider this a bug with libkdecore or at least libproxy. No library should ever even touch locale: it might break basic expectations on C string handling functions, might override program settings, and it's not thread-safe. But this is so nasty and severe, that a quick hack to fix it hurts less. See github issue #279 and KDE bug #325902.
* mpvcore/playlist.c: Avoid NULL reference in playlist_add_base_path()Mohammad Alsaleh2013-10-111-1/+1
| | | | | | | | | | Before this patch, those will cause a crash: mpv -playlist /dev/null mpv -playlist <(bla) # if the result of bla is empty Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com> Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
* mp_ring: fix mp_ring_read_cb() when read wraps aroundWilliam Light2013-10-081-2/+10
| | | | | | previously, mp_ring_read_cb() would allow reading past the end of the ringbuffer when buffered > available. mp_ring_read() had logic for splitting the read into two, which I duplicated into mp_ring_read_cb().
* command: sub_seek: avoid getting stuckwm42013-10-071-0/+5
| | | | | | | | | First, don't try to seek if the result is 0 (i.e. nothing found, or subtitle event happens to be exactly on spot). Second, since we never can make sure that we actually seek to the exact subtitle PTS (seeking "snaps" to video PTS), offset the seek by 10ms. Since most subtitle events are longer than 10ms, this should work fine.
* osc: Okay, don't multiply the cache valueChrisK22013-10-071-5/+1
| | | | As expected, this is not liked.
* osc: Display cache fill statusChrisK22013-10-071-1/+21
| | | | | | The OSC will now display cache fill status between the timecodes, but only if it's below 48% to not clutter the interface with erratically changing values. By default, the displayed value is multiplied by 2 to not confuse users who are unfamillar with the inner workings of the caching system. This can be disabled using the iAmAProgrammer=true setting.
* osc: Add another scale option for forced windows.ChrisK22013-10-061-3/+6
| | | | If the OSC is rendered on a forced window (by --force-window), the scale can be configured with scaleForcedWindow.
* mplayer: don't resume playlist if --no-resume-playback is usedwm42013-10-061-0/+2
|
* command: add commands for displaying overlayswm42013-10-055-4/+148
| | | | | | Requested by github issue #255. Does not work where mmap is not available (i.e. Windows).
* command: add properties for retrieving OSD dimensionswm42013-10-051-0/+23
|
* mplayer: fix some issues with playlist_prev commandwm42013-10-051-1/+9
| | | | | | | | | | | | | | | | You couldn't jump to the first entry in the playlist, if that entry was marked as "too short". But this is usually fine, because it doesn't get into the way of the user. (This feature is meant to allow being able to jump backwards through the playlist even if a file immediately stops playback right after initialization, not to prevent playing these files at all.) Also, apply the skip logic when wrapping around the playlist when going backwards. This happens with --loop, because looping pretends the playlist is infinitely repeated forwards and backwards (as long as the playlist_prev/next commands are concerned). Also add some comments.
* mplayer: fix cleanup if VO initialization failswm42013-10-051-0/+1
| | | | | Just specifying a VO that doesn't exist would make it crash. Regression caused by commit 6a0408b.
* mplayer: don't keep previous video frame with --force-windowwm42013-10-041-15/+14
| | | | | | | | | | When for example switching off the video stream, and --force-window is used, forcefully reconfigure the VO. This will reset the size, and will clear the window with black. Needed some effort, because you don't always want to clear the window on "discontinuity" points like going to a next file: this would introduce some flicker.
* command: add sub_seek input commandwm42013-10-023-6/+18
| | | | | | | Essentially reuses the sub_step command, and is subject to the same restrictions. Seems to behave a bit strange sometimes, but generally works.
* input: remove strange offset from commands enumwm42013-10-021-1/+1
| | | | A leftover from 10 years of refactoring.
* command: don't let "avsync" property print NOPTS valuewm42013-10-021-0/+2
| | | | | | Can happen when seeking in audio files with attached picture. MP_NOPTS_VALUE doesn't really make sense outside of mpv internals, so don't return it.
* mplayer: osd bar depends on VO, not video decodingwm42013-10-021-1/+1
| | | | The OSD bar wasn't displayed, and instead a fallback message was shown.
* mplayer: make VO interaction work in --idle modewm42013-10-021-19/+34
| | | | | | | Didn't handle VO events, didn't handle OSD message management. There is probably still some strangeness left. --idle mode was never made for direct interaction.
* mplayer: change default window size for --force-windowwm42013-10-021-1/+1
| | | | Closer to the ubiquitous 16:9 screen aspect ratio. Requested by ChrisK3.
* command: subtitle support depends on VO, not video decodingwm42013-10-022-13/+9
| | | | | | | | | We can render subtitles if a VO is open. Whether we're decoding video (i.e. if mpctx->sh_video is set) doesn't really matter. Subtitle display with --force-window still doesn't quite work yet, because there's nothing to actually force redrawing of subtitles in this mode.
* core: add --force-windowwm42013-10-024-16/+83
| | | | | | | | | | | | | | | | | This commit adds the --force-window option, which will cause mpv always to create a window when started. This can be useful when pretending that mpv is a GUI application (which it isn't, but users pretend anyway), and playing audio files would run mpv in the background without giving a window to control it. This doesn't actually create the window immediately: it only does so only after initializing playback and when it is clear that there won't be any actual video. This could be a problem when starting slow or completely stuck network streams (mpv would remain frozen in the background), or if video initialization somehow is stuck forever in an in-between state (like when the decoder doesn't output a video frame, but doesn't return an error either). Well, we can pretend only so much that mpv is a GUI application.
* core: don't require "refresh" seek for --keep-openwm42013-10-021-7/+1
| | | | | | | | | | | | | | | | | | | | | Seeking normally resets the VO and throws away the currently displayed frame, so if you seek outside the video with --keep-open enabled, the window would normally be "stuck" and not redraw properly, because there is no source video frame that could be redrawn. To deal with this, a precise seek to the position of the last displayed video frame was issued. This usually worked, but it can fail for formats where seeking is broken or not possible (consider reading from a pipe). Fix this by changing the semantics for vo_seek_reset(): now the video frame is remembered even after seeking. Note that this changes behavior a little when trying to seek outside of a file with --keep-open enabled. Since no actual seek is done anymore, the video will remain "frozen" on the previous position, and you can't unpause or framestep to see the video between current position and actual end of the video. If users complain, I might revert this commit.
* mplayer: fix looping of very short fileswm42013-09-293-7/+19
| | | | | | | | | | | | | | | Commit 884c179 attempted to make it possible to skip backwards through the playlist, even for files which fail to intitialize, or play for a very short time. This was also used to prevent mpv from looping forever and doing nothing if --loop=inf is used, and no file in the playlist is playable. This broke looping of very short files, because mpv was assuming that this case happened. But there are legitimate use cases. Fix this by making the looping case special. Instead of checking whether playback was "very short", check whether something could be decoded and displayed/played. If yes, allow looping.
* osc: add options to show OSC only when FS/windowedChrisK22013-09-271-2/+12
| | | | | | The boolean-options showWindowed and showFullscreen can now be set in plugin_osc.conf to control the behaviour. enhancement for #262
* network: add options to control TLS verificationwm42013-09-272-0/+6
|
* input: translate mouse position to OSD space earlywm42013-09-273-17/+2
| | | | | | | | | | | | | | Until now, mouse positions were just passed to the core as-is, even if the mouse coordinates didn't map to any useful coordinate space, like OSD coordinates. Lua scripting (used by the OSC, the only current user of mouse input) had to translate mouse coordinates manually to OSD space using mp_get_osd_mouse_pos(). This actually didn't work correctly in cases mouse coordinates didn't map to OSD (like vo_xv): the mouse coordinates the OSC got were correct, but input.c was still expecting "real" mosue coordinates for mouse areas. Fix this by converting to OSD coordinates before passing the mouse position to the core.
* input: handle MOUSE_LEAVE speciallywm42013-09-271-0/+8
| | | | | | Do this so that MOUSE_LEAVE can't be combined with other keys. (E.g. keep 'w' pressed, then move the mouse outside of the mpv window; it will print a warning what w-MOUSE_LEAVE is not mapped.)
* input: more mp_msg conversionwm42013-09-273-64/+57
| | | | | | | | It appears the last run missed all mp_tmsg(). Since the command parser also prints messages, it needs a new parameter to pass a log context. We go the easy way and just require the input_ctx to be passed, and use its mp_log.
* osc: Prevent OSD style options from messing with the OSC stylesChrisK22013-09-261-18/+30
| | | | Should fix #259
* matroska: fix uninitialized memory accesses with ordered chaptersBen Boeckel2013-09-261-0/+1
| | | | | | | There is uninitialized memory access if the actual size isn't passed along. In the worst case, this can cause a source to be loaded against the uninitialized memory, causing a false count of found versus required sources, preventing the "Failed to find ordered chapter part" message.
* video: let sh_video->disp_w/h always be container sizewm42013-09-261-4/+8
| | | | | | | Nothing really accesses it. Subtitle initialization actually does in a somewhat meaningful way, but there container size is probably fine, as subtitles were always initialized before the first video frame was decoded.
* video: let sh_video->aspect always be container aspect ratiowm42013-09-262-9/+19
| | | | | | | Now writing -1 to the 'aspect' property resets the video to the auto aspect ratio. Returning the aspect from the property becomes a bit more complicated, because we still try to return the container aspect ratio if no frame has been decoded yet.
* Add the on-screen-controllerChrisK22013-09-264-0/+1175
| | | | Signed-off-by: wm4 <wm4@nowhere>
* Add initial Lua scripting supportwm42013-09-2612-3/+1017
| | | | | | | | | | | | | | | | | | | | | | This is preliminary. There are still tons of issues, and any aspect of scripting may change in the future. I decided to merge this (preliminary) work now because it makes it easier to develop it, not because it's done. lua.rst is clear enough about it (plus some sarcasm). This requires linking to Lua. Lua has no official pkg-config file, but there are distribution specific .pc files, all with different names. Adding a non-pkg-config based configure test was considered, but we'd rather not. One major complication is that libquvi links against Lua too, and if the Lua version is different from mpv's, you will get a crash as soon as libquvi uses Lua. (libquvi by design always runs when a file is opened.) I would consider this the problem of distros and whoever builds mpv, but to make things easier for users, we add a terrible runtime test to the configure script, which probes whether libquvi will crash. This is disabled when cross-compiling, but in that case we hope the user knows what he is doing.
* Fix previous commitwm42013-09-251-0/+4
| | | | | | | This time it broke because I didn't actually test compiling vo_vaapi.c, and it was using a macro from mp_image.h, which implicitly assumed FFALIGN was available. Screw that too, and copy the definition of ffmpeg's FFALIGN to MP_ALIGN_UP, and move these macros to mp_comnon.h.
* vaapi: fix compilation with Libavwm42013-09-251-0/+2
| | | | | | | | | | | The code using FFSWAP was moved from vo_vaapi.c to vaapi.c, which didn't include libavutil/common.h anymore, just libavutil/avutil.h. The header avutil.h doesn't include common.h recursively in Libav, so it broke there. Add FFSWAP as MPSWAP in mp_common.h (copy pasted from ffmpeg) to make sure this doesn't happen again. (This kind of stuff happens all too often, so screw libavutil.)
* options: allow selecting the libass shaperwm42013-09-252-0/+4
| | | | | | I'm using the word "languages" instead of "scripts" in the manpage, but I think that's easier to understand with a smaller amount of descriptions.
* options: make --ass-hinting a choice, instead of using magic numberswm42013-09-251-1/+2
| | | | | options.c still doesn't use the constants defined by the libass headers, but it's still better than exposing those to the user directly.
* vaapi: allow GPU read-back with --hwdec=vaapi-copywm42013-09-251-1/+2
| | | | | | | | | | | | | | This code is actually quite inefficient: it reuses the (slow, simple) screenshot code. It uses an inefficient method to read the image (vaGetImage() instead of vaDeriveImage()), allocates new memory for each frame that is read, and it tries all image formats again each time. Also, in my tests it always picked NV12 as image format, which is not ideal if you actually want to filter the video, and vo_xv can't handle this format without conversion either. However, a user confirmed that it worked for him, so everything is fine.
* vaapi: add vf_vavpp and use it for deinterlacingxylosper2013-09-251-0/+3
| | | | | | | | Merged from pull request #246 by xylosper. Minor cosmetic changes, some adjustments (compatibility with older libva versions), and manpage additions by wm4. Signed-off-by: wm4 <wm4@nowhere>
* command: fix short buffer when handling of long property nameswm42013-09-241-6/+4
| | | | | | This wasn't enough and could lead to a cut off message shown on OSD. Just make it dynamic, since we already use dynamic memory allocation at this point anyway.
* mplayer: attempt to make playback resume work with DVD/BDwm42013-09-224-13/+24
| | | | | | | | | | | | | | | | The problem with DVD/BD and playback resume is that most often, the filename is just "dvd://", while the actual path to the DVD disk image is given with --dvd-device. But playback resume works on the filename only. Add a pretty bad hack that includes the path to the disk image if the filename starts with dvd://, and the same for BD respectively. (It's a bad hack, but I want to go to bed, so here we go. I might revert or improve it later, depending on user feedback.) We have to cleanup the global variable mess around the dvd_device. Ideally, this should go into MPOpts, but it isn't yet. Make the code paths in mplayer.c take MPOpts anyway.
* network: fix rtsp playbackwm42013-09-222-0/+7
| | | | | | | | | | | | | | By default, libavformat uses UDP for rtsp playback. This doesn't work very well. Apparently the reason is that the buffer sizes libavformat chooses for UDP are way too small, and switching to TCP gets rid of this issue entirely (thanks go to Reimar Döffinger for figuring this out). In theory, you can set buffer sizes as libavformat options, but that doesn't seem to help. Add an option to select the rtsp transport, and make TCP the default. Also remove an outdated comment from stream.c.
* command: when changing volume while muted, show an extra message on OSDwm42013-09-211-1/+2
| | | | | So nobody has to wonder why everything is silent, even if they raise the volume.
* command: when changing a property, allow showing an extra OSD messagewm42013-09-214-33/+50
| | | | | | | | | | This is for properties that normally show a bar, and thus do not show an OSD message (as per classic mplayer behavior). Setting an extra_msg allows showing an OSD message anyway, except if OSD messages are explicitly suppressed. This refactors the whole show_property_osd() function a bit, and replaces the weird sep field with a more general method.
* m_property: add a way to switch on property values in property expansionwm42013-09-201-3/+9
| | | | | | | | | | Allows for example: --status-msg='${?pause==yes:(Paused) } ...' to emulate the normal terminal status line. It's useful in other situations too. I'm a bit worried about extending this mini-DSL, and sure hope nobody will implement a generic formula evaluator at some point in the future. But for now we're probably safe.
* m_property: rearrange codewm42013-09-201-20/+27
|
* command: don't append, but prepend deinterlace filter by defaultwm42013-09-201-1/+1
| | | | | | In most cases, it's better if deinterlacing happens before any other filtering, so prepend the filter to the user's filter list, instead of appending it.
* command: use a list of potential deinterlacer filterswm42013-09-201-13/+22
| | | | | | | | Instead of hardcoding a single filter. This might be helpful for modeling the vaapi deinterlacer as a video filter. The idea is that a software deinterlacer would be tried first, and if that fails (because vaapi hardware decoding uses HW surfaces, which a software deinterlacer does not accept), the vaapi filter would be tried.
* Merge branch 'volume_restore'wm42013-09-205-61/+37
|\
| * mixer: make struct opaquewm42013-09-203-15/+14
| | | | | | | | Also remove stray include statements from ao_alsa and ao_oss.
| * mixer: allow accessing volume and mute property on disabled audiowm42013-09-201-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <