summaryrefslogtreecommitdiffstats
path: root/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/master'wm42012-05-201-23/+15
|\
| * core: fix EOF handling with untimed audio outputsUoti Urpala2012-05-141-14/+12
| | | | | | | | | | | | | | | | | | | | | | When using an audio output without a native playback rate (such as ao_pcm), the code plays audio further when the current write position is behind video. After support for continuing audio after the end of video was added, this could cause a deadlock: audio was not played further, but neither was EOF triggered. Fix the code to properly handle playback of remaining audio after video ends in the untimed audio case (audio-only case was not affected, only the case where a video stream exists but ends before the audio stream).
| * options: simplify option parsing/setting machineryUoti Urpala2012-05-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Each option type had three separate operations to copy option values between memory locations: copy between general memory locations ("copy"), copy from general memory to active configuration of the program ("set"), and in the other direction ("save"). No normal option depends on this distinction any more. Change everything to define and use a single "copy" operation only. Change the special options "include" and "profile", which depended on hacky option types, to be special-cased directly in option parsing instead. Remove the now unused option types m_option_type_func and m_option_type_func_param.
| * options: change -v parsingUoti Urpala2012-05-071-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Handle -v flags as a special case in command line preparsing stage, and change the option entry into a dummy one. Specifying "v" in config file no longer works (and the dummy entry shows an error in this case); "msglevel" can still be used for that purpose. Because the flag is now interpreted at an earlier parsing stage, it now affects the printing of some early messages that were only affected by the MPLAYER_VERBOSE environment variable before. The main motivation for this change is to get rid of the last CONF_TYPE_FUNC option.
* | Merge remote-tracking branch 'origin/master'wm42012-04-291-13/+21
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bstr.c bstr.h libvo/cocoa_common.m libvo/gl_common.c libvo/video_out.c mplayer.c screenshot.c sub/subassconvert.c Merge of cocoa_common.m done by pigoz. Picking my version of screenshot.c. The fix in commit aadf1002f8a will be redone in a follow-up commit, as the original commit causes too many conflicts with the work done locally in this branch, and other work in progress.
| * win32: core: wake up more often to poll for inputUoti Urpala2012-04-261-2/+13
| | | | | | | | | | | | | | | | | | MSWindows does not have properly working support for detecting events on file descriptors. As a result the current mplayer2 code does not support waking up when new input events occur. Make the central playloop wake up more often to poll for events; otherwise response would be a lot laggier than on better operating systems during pause or other cases where the process would not otherwise wake up.
| * core: change initial sync with --delay, video stream switchUoti Urpala2012-04-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Make A/V sync at the start of playback with nonzero --delay behave the same way as it does when seeking to the beginning later, meaning video plays from the start and audio is truncated or padded with silence to match timing. This was already the default behavior in case the streams in the file started at different times, but not if the mismatch was due to --delay. Trigger similar audio synchronization when switching to a new video stream. Previously, switching a video stream on after playing for some time in audio-only mode was buggy and caused initial desync equal to the duration of prior audio-only playback.
| * core: uninitialize VO and AO when no track playsUoti Urpala2012-04-231-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | Uninitialize video and audio outputs when switching to a file without a corresponding track (audio-only file / file with no sound), or when entering --idle mode. Switching track choice to "off" during playback already did this. It could be useful to have a mode where the video window stays open even when no video plays, but implementing that properly would require more than just leaving the window on screen like the code did before this commit.
* | Merge remote-tracking branch 'origin/master'wm42012-04-281-2/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: command.c libao2/ao_alsa.c libao2/ao_dsound.c libao2/ao_pulse.c libao2/audio_out.h mixer.c mixer.h mplayer.c Replace my mixer changes with uau's implementation, which is based on my code.
| * audio: fix unmute-at-end logicUoti Urpala2012-04-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The player tried to disable mute before exiting, so that if mute is emulated by setting volume to 0 and the volume setting is a system-global one, we don't leave it at 0. However, the logic doing this at process exit was flawed, as volume settings are handled by audio output instances and the audio output that set the mute state may have been closed earlier. Trying to write reliably working logic that restores volume at exit only would be tricky, so change the code to always unmute an audio driver before closing it and restore mute status if one is opened again later.
| * audio: restore volume setting after AO reinit if neededUoti Urpala2012-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MPlayer volume control was originally implemented with the assumption that it controls a system-wide volume setting which keeps its value even if a process closes and reopens the audio device. However, this is not actually true for --softvol mode or some audio output APIs that only consider volume as a per-client setting for software mixing. This could have annoying results, as the volume would be reset to a default value if the AO was closed and reopened, for example whem moving to a new file or crossing ordered chapter boundaries. Add code to set the previous volume again after audio reinitialization if the current audio chain is known to behave this way (softvol active or the AO driver is known to not keep persistent volume externally). This also avoids an inconsistency with the mute flag. The frontend assumed the mute status is persistent across file changes, but it could be similarly lost. The audio drivers that are assumed to not keep persistent volume are: coreaudio, dsound, esd, nas, openal, sdl. None of these changes have been tested. I'm guessing that ESD and NAS do per-connection non-persistent volume settings. Partially based on code by wm4.
| * audio: keep volume level internally (not only in AO)Uoti Urpala2012-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current volume was always queried from the the audio output driver (or filter in case of --softvol). The only case where it was stored on mixer level was that when turning off mute, volume was set to the value it had before mute was activated. Change the mixer code to always store the current target volume internally. It still checks for significant changes from external sources and resets the internal value in that case. The main functionality changes are: Volume will now be kept separately from mute status. Increasing or decreasing volume will now change it relative to the original value before mute, even if mute is implemented by setting AO level volume to 0. Volume changes no longer automatically disable mute. The exception is relative changes up (like the volume increase key in default keybindings); that's the only case which still disables mute. Keeping the value internally avoids problems with granularity of possible volume values supported by AO. Increase/decrease keys could work unsymmetrically, or when specifying a smaller than default --volstep, even fail completely. In one case occurring in practice, if the AO only supports changing volume in steps of about 2 and rounds down the requested volume, then volume down key would decrease by 4 but volume up would increase by 2 (previous volume plus or minus the default change of 3, rounded down to a multiple of 2). Now, the internal value will keep full precision.
* | Merge remote-tracking branch 'origin/master'wm42012-04-131-17/+20
|\| | | | | | | | | Conflicts: libvo/vo_kva.c
| * build: remove OS/2 supportUoti Urpala2012-04-061-1/+1
| |
| * input: stop trying to read terminal input on EOFUoti Urpala2012-04-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Stop trying to read terminal input if a read attempt returns EOF. The most important case where this matters is when someone runs the player with stdin redirected from /dev/null and without specifying --no-consolecontrols. This used to cause 100% CPU load while paused, as select() would continuously trigger on stdin (the need for --no-consolecontrols was not apparent to people with older mplayer versions, as input reading was less efficient and latencies like hardcoded sleeps kept CPU use well below 100%). Now this will only cause a "Dead key input" error message.
| * core: in VO flip timing, recheck time after OSD drawUoti Urpala2012-04-051-0/+1
| | | | | | | | | | | | | | | | Make the code read current real time again after drawing OSD. This ensures time taken in OSD drawing is properly deducted from the duration of the following sleep. The main practical effect is to avoid the A-V field on the status line staying at a value a couple of milliseconds above 0 (depending on VO).
| * core: fix problems in video EOF detectionUoti Urpala2012-04-051-14/+15
| | | | | | | | | | | | | | | | | | Fix a missing check that could sometimes result in video frames being shown after specified end pts (end of timeline segment or --endpos). Fix mistaken video EOF detection after aspect change in video stream, when there is no current valid visible frame but the next frame is already buffered in VO.
* | Merge remote-tracking branch 'origin/master'wm42012-04-011-339/+322
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bstr.c bstr.h etc/input.conf input/input.c input/input.h libao2/ao_pulse.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libvo/gl_common.c libvo/x11_common.c mixer.c mixer.h mplayer.c
| * ao_pulse, core: make pulse thread wake up core for more dataUoti Urpala2012-03-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ao_pulse, the current latency is not a good indicator of how soon the AO requires new data to avoid underflow. Add an internal pipe that can be used to wake up the input loop from select(), and make the pulseaudio main loop (which runs in a separate thread) use this mechanism when pulse requests more data. The wakeup signal currently contains no information about the reason for the wakup, but audio buffers are always filled when the event loop wakes up. Also, request a latency of 1 second from the Pulseaudio server. The default is normally significantly higher. We don't need low latency, while higher latency helps prevent underflows reduces need for wakeups.
| * timeline: subs: keep subtitle tracks in source timeUoti Urpala2012-03-251-30/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Timeline handling converted the pts values from demuxed subtitles to timeline scale. Change the code to do most subtitle handling in original subtitle source pts, and instead convert current playback timeline pts to those units when deciding which subtitle to show. The main functionality changes are that now demuxed subtitles which overlap chapter boundaries are handled correctly (at least for libass subtitles), and external subtitles are assumed to use same pts scale as current source (this needs improvements later). Before, a video subtitle that had a duration continuing past the end of the chapter would continue to be shown for the original duration, even if the chapter ended and playback switched to a position in the source where the subtitle shouldn't exist. Now, the subtitle will correctly end. Before, external subtitle files were interpreted as specifying pts values in timeline scale. Now, they're interpreted as specifying pts values in source file time scale, for _every_ source file. This is probably more likely to be what the user wants for the "main" source file in case there is one, but almost certainly not quite right for multiple source files where the same subs could be shown over different scenes. If the user wants them to match some main source file, it's probably still better to have incorrect extra subs for video from some files than to have every subtitle appearing at the wrong time. The new code makes it easier to change the interpretation of the subtitle times, and some configurability should be added in the future.
| * core: improve sub and audio start after timeline part switchUoti Urpala2012-03-201-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When switching to a timeline part from another file, decoders were reinitialized after doing the demuxer-level seek. This is necessary for audio because some decoders read from the demuxer stream during initialization and the previous stream position before seek could have been at EOF. However, this initialization sequence could lose first subtitles or first part of audio. The problem for subtitles was that the seek itself or audio initialization could already have buffered subtitle packets from the new position, and the way subtitles are reinitialized flushes packet buffers. Thus early subtitles could be lost (even if they were demuxed - unfortunately demuxers may not know about still active subtitles earlier in the file, but that's another issue). Fix this by moving subtitle and video reinitialization before the demuxer seek; they don't have the problems which prevent that for audio. Audio initialization can already decode and buffer some output. However, the seek_reset() call done last would then throw away this buffered output. Work around this by adding an extra flag to seek_reset().
| * options: move mixer.h options to structUoti Urpala2012-03-201-0/+3
| |
| * core: restructure main play loop, continue audio after videoUoti Urpala2012-03-191-283/+246
| | | | | | | | | | | | | | | | | | | | | | Restructure parts of the code in the main play loop. The main functionality difference is that if a video track ends first, now audio will continue to be played until it ends too. Now the process also wakes up less often if there's no need to update video or audio. This will reduce unnecessary wakeups especially when paused, but may make handling of input events laggier when fd-based notifications are not supported (like most input on Windows).
| * terminal output: if audio/video pts is missing, show "???"Uoti Urpala2012-03-161-13/+26
| | | | | | | | | | | | Change the terminal status line to show "???" instead of a huge negative number if audio or video pts is missing (there was a partial workaround for audio before, but not video or A-V difference).
* | Merge remote-tracking branch 'origin/master' into my_masterwm42012-03-161-55/+14
|\| | | | | | | | | | | | | | | Conflicts: command.c mp_core.h mplayer.c screenshot.c
| * core: remove old EDL mode (--edl option)Uoti Urpala2012-03-091-73/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the old EDL implementation that was activated with the --edl option. It is mostly redundant and inferior compared to the newer demux_edl support, though currently there's no support for using the same EDL files with the new implementation and the mute functionality of the old implementation is not supported. The main reason to remove the old implementation at this point is that the mute functionality would conflict with following audio volume handling changes, and working on the old code would be a wasted effort in the long run as at some point it would be removed anyway. The --edlout functionality is kept for now, even though after this commit there is no code that could directly read its output.
| * windows support: unicode filenameswm42012-03-091-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this.
| * windows support: remove _UWIN definewm42012-03-011-1/+0
| | | | | | | | | | | | | | The _UWIN define causes the mingw headers not to declare deprecated (on Windows) function names such as open and mkdir. But the code uses these. I have no idea why this used to work (if it even did), but the original reason why it was defined seems to have vanished.
* | Use "mplayer2" in version string, not "MPlayer2"wm42012-03-141-4/+4
| | | | | | | | | | | | | | | | The name "MPlayer2" isn't used anywhere. It's either "MPlayer" or "mplayer2". Make it more consistent by using "mplayer2" instead. Note that the version string passed as network user-agent changes from "MPlayer" to "mplayer2" as well.
* | core: do not print garbage with -identify when chapter times are unknownwm42012-03-141-3/+4
| | | | | | | | | | | | The current code tried to print -1000 as unsigned integer if the chapter time was unknown. Print -1 instead. This affects only the -identify output used for slave mode, such as ID_CHAPTER_0_START.
* | Merge remote-tracking branch 'origin/master' into my_masterwm42012-03-051-5/+14
|\| | | | | | | | | | | Conflicts: mplayer.c screenshot.c
| * osd: erase terminal OSD line with mp_msg() instead of printf()Uoti Urpala2012-02-251-1/+1
| | | | | | | | | | | | | | | | The terminal OSD line was written with mp_msg(MSGT_CPLAYER, ...) but erased with printf(). This meant that disabling MSGT_CPLAYER messages would prevent the terminal line from being printed, but a line (probably unrelated) would still be cleared. Change the clearing code to use mp_msg(MSGT_CPLAYER, ...) too.
| * vd_ffmpeg: fix flushing of buffered framesUoti Urpala2012-02-031-2/+12
| | | | | | | | | | | | | | | | | | The vd_ffmpeg decode() function returned without doing anything if the input packet had size 0. This meant that flushing buffered frames at EOF did not work. Remove this test. Have the core code skip such packets coming from the file being played instead (Libav treats 0-sized packets as flush signals anyway, so better assume such packets do not represent real frames with any codec).
| * build: switch to libavutil bswap.h and intreadwrite.hUoti Urpala2012-02-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Remove the private bswap and intreadwrite.h implementations and use libavutil headers instead. Originally these headers weren't publicly installed by libavutil at all. That already changed in 2010, but the pure C bswap version in installed headers was very inefficient. That was recently (2011-12) improved and now using the public bswap version probably shouldn't cause noticeable performance problems, at least if using a new enough compiler.
* | screenshot: make screenshot filenames configurablewm42012-02-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | |