summaryrefslogtreecommitdiffstats
path: root/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the --screenshot-template option, which specifies a template for the filename used for a screenshot. The '%' character is parsed as format specifier. These format specifiers insert metadata into the filename. For example, '%f' is replaced with the filename of the currently played file. The following format specifiers are available: %n Insert sequence number (padded with 4 zeros), e.g. "0002". %0Nn Like %n, but pad to N zeros (N = 0 to 9). %n behaves like %04n. %#n Like %n, but reset the sequence counter on every screenshot. (Useful if other parts in the template make the resulting filename already mostly unique.) %#0Nn Use %0Nn and %#n at the same time. %f Insert filename of the currently played video. %F Like %f, but with stripped file extension ("." and rest). %p Insert current playback time, in HH:MM:SS format. %P Like %p, but adds milliseconds: HH:MM:SS.mmmm %tX Insert the current local date/time, using the date format X. X is a single letter and is passed to strftime() as "%X". E.g. "%td" inserts the number of the current day. %{prop} Insert the value of the slave property 'prop'. E.g. %{filename} is the same as %f. If the property doesn't exist or is not available, nothing is inserted, unless a fallback is specified as in %{prop:fallback text}. %% Insert the character '%'. The strings inserted by format specifiers will be checked for characters not allowed in filenames (including '/' and '\'), and replaced with the placeholder '_'. (This doesn't happen for text that was passed with the --screenshot-template option, and allows specifying a screenshot target directory by prefixing the template with a relative or absolute path.)
* | core: rename --paused to --pause, and improve how pausing is donewm42012-02-291-1/+1
| | | | | | | | | | | | Callign add_step_frame is not necessary, because mplayer always decodes at least one frame when starting a new file. Calling pause_player is sufficient, and unlike add_step_frame doesn't play any audio.
* | osd: clear terminal OSD line with mp_msg() instead of printfwm42012-02-251-1/+1
| | | | | | | | | | | | | | | | | | If mplayer is started with -msglevel cplayer=-1, there can't be any terminal OSD output, but the terminal line was still cleared unconditionally. Fix this by using mp_msg(), which will throw away the output to clear the terminal if disabled. Fixes #154.
* | core: add option to start in paused statewm42012-02-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | The --paused option will start the player in paused state. That means it will start out with a still image of the first frame. This can be useful in combination with --ss to inspect a certain frame. Caveat: this plays a small bit of audio at the start, which might be perceived as an annoying artifact. This is because this is implemented by frame stepping after initialization in order to decode and display the first video frame.
* | osd: add setting to display OSD always on terminalwm42012-01-181-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the option --term-osd=force will cause mplayer to display all OSD messages on the terminal, even if there is video. Possible values for --term-osd: - auto: use video OSD, or of there's no video, the terminal (default) - off: always use video for OSD - force: always use terminal for OSD -term-osd and --term-osd are equivalent to --term-osd=force. This changes the meaning of the option, since -term-osd used to enable the OSD default behavior, i.e. --term-osd=auto. -noterm-osd has the same effect as --term-osd=off, and is kept for compatibility. Implementation note: The location for the OSD text was shared between the two code paths (it was in osd_state.osd_text). We can't rely on the fact that the video-OSD update code normally isn't run when --term-osd is called. When e.g. panscan is updated, the video OSD code will draw the OSD anyway. This would sometimes show unwanted OSD text on the video. Deal with this by putting the current terminal-OSD text in a different place (in MPContext.terminal_osd_text) to deal with this.
* | core: add new support for reading .cue fileswm42012-01-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Playing a .cue file directly will now parse the .cue file, and load and play the file(s) referenced in the cue. If multiple files are referenced, a timeline including all files will be created to create the impression of a single, flat audio file containing all the tracks. For each track, a chapter is created. The chapter navigation commands can be used to jump between tracks. The chapter titles will use the string provided by the track's TITLE cue command. (The -identify command can be used to print all chapters in a not so user friendly way.) Other than the chapter names, there is no attempt at displaying or exposing any other meta data contained in the cue files yet. The handling (or lack of thereof) of gaps (track pregaps and postgaps) is probably not correct yet. In general, mplayer's mapping of tracks to the source audio files can be verified by examining the timeline, which will be printed when passing the -v switch. Note that this has nothing to do with the old cue:// support. The old code isn't touched, and is still only able to play .cue/.bin pairs. Prefixing a .cue file with cue:// will always invoke the old code, while playing a .cue file directly (i.e. "mplayer file.cue") will always use the new code. Playing audio images (.cue/.bin pairs of files) doesn't work yet.
* | Merge branch 'softvol' into my_masterwm42012-01-181-31/+6
|\ \
| * | core: remove EDL mutingwm42012-01-181-24/+1
| | | | | | | | | | | | | | | | | | I'm not sure what's the point of this feature. Aside from that, the EDL code is relatively buggy anyway, and I see no reason why such an obscure feature should be left in, if it possibly causes bugs.
| * | audio: properly restore audio volume on exit when mute is usedwm42012-01-181-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | When you mute audio, mplayer is supposed to restore the volume controls on exit. This affects when --softvol isn't used and the audio output driver volume controls directly affect the system wide volume controls. This wasn't done in some cases.
| * | softvol: make sure softvol settings are restored when switching audio trackswm42012-01-181-1/+1
| | | | | | | | | | | | | | | | | | At least in the case when switching to no audio track and then switching back, the volume settings were not restored with --softvol. Fix this by moving the call restoring the settings to a better place.
| * | audio: fix crash when exiting file when mute is enabledwm42012-01-181-0/+1
| | |
| * | mixer: keep user volume setting when --softvol is usedwm42012-01-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When --softvol is enabled, the volume set by the "volume" property is reset when changing to a new file or crossing ordered chapter boundaries. Fix this by explicitly restoring the volume on audio reinitialization. Now the behavior with --softvol should be the same as if a system mixer is used, and the volume should be persistent across file changes. This also works around an inconsistency with the mute flag. The frontend assumed the mute flag is persistent across file changes, which was not true with --softvol. If not resetting the volume on playing new files is undesired, it can be avoided by putting volume=100 in the mplayer config file.
* | | Merge remote-tracking branch 'origin/master' into my_masterwm42012-01-181-63/+59
|\ \ \ | | |/ | |/|
| * | core: print pause status message only once on consolewm42012-01-101-31/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the recent OSD redraw changes, every GUI expose event causes the message "===== PAUSE =====" to be printed on console. This was a bit annoying, so change it so that it is only printed once when going into paused mode. It's also printed again if the cache status changes (when playing URLs), or when the status line is printed during pause mode (when you seek while paused). This also removes some minor code duplication.
| * | osd: always display pause icon when frame steppingwm42012-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | | When the OSD was enabled and the player was paused by executing the frame_step command, the OSD still displayed the icon indicating playback. Fix this and always set the proper icon when the pause state is changed.
| * | cleanup: remove left over access_mpcontext.h (from GUI)Uoti Urpala2012-01-091-31/+0
| | | | | | | | | | | | | | | | | | access_mpcontext.h and the declared functions in mplayer.c were only used by the now deleted internal GUI. Remove the unused header and functions.
| * | ad_ffmpeg: pass packet side data from libavformatUoti Urpala2012-01-081-1/+1
| |/ | | | | | | | | Pass avpacket->side_data when using a libavcodec audio decoder together with libavformat demuxer (this was already done for video).
* / core: uninit video output when audio file is playedwm42011-12-231-1/+4
|/ | | | Playing a video and then an audio file only left the VO window on screen.