Commit Graph

1688 Commits

Author SHA1 Message Date
wm4 6de8120822 Merge remote-tracking branch 'origin/master' into my_master
Conflicts:
	command.c
	mp_core.h
	mplayer.c
	screenshot.c
2012-03-16 19:14:44 +01:00
wm4 0eb21226cb Use "mplayer2" in version string, not "MPlayer2"
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.
2012-03-14 10:29:35 +01:00
wm4 7608a0fac9 core: do not print garbage with -identify when chapter times are unknown
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.
2012-03-14 10:27:36 +01:00
Uoti Urpala 7576885677 core: remove old EDL mode (--edl option)
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.
2012-03-09 20:48:54 +02:00
wm4 a1244111a7 windows support: unicode filenames
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.
2012-03-09 20:48:54 +02:00
wm4 8dc0743571 Merge remote-tracking branch 'origin/master' into my_master
Conflicts:
	mplayer.c
	screenshot.c
2012-03-05 22:24:57 +01:00
wm4 3dbb18d91a windows support: remove _UWIN define
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.
2012-03-01 00:22:29 +02:00
wm4 12c44610ad screenshot: make screenshot filenames configurable
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.)
2012-02-29 04:14:54 +01:00
wm4 5fcd29eb40 core: rename --paused to --pause, and improve how pausing is done
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.
2012-02-29 03:07:10 +01:00
Uoti Urpala d0bae74702 osd: erase terminal OSD line with mp_msg() instead of printf()
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.
2012-02-25 16:40:47 +02:00
wm4 3022129d85 osd: clear terminal OSD line with mp_msg() instead of printf
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.
2012-02-25 13:49:29 +01:00
wm4 bbdff34d69 core: add option to start in paused state
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.
2012-02-09 00:36:53 +01:00
Uoti Urpala da52c9400d vd_ffmpeg: fix flushing of buffered frames
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).
2012-02-03 20:15:16 +02:00
Uoti Urpala fc6a9e4a3e build: switch to libavutil bswap.h and intreadwrite.h
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.
2012-02-01 22:46:27 +02:00
wm4 fee4d3b473 osd: add setting to display OSD always on terminal
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.
2012-01-18 04:33:30 +01:00
wm4 55560d62ee core: add new support for reading .cue files
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.
2012-01-18 04:25:19 +01:00
wm4 6e41497d5b Merge branch 'softvol' into my_master 2012-01-18 04:21:58 +01:00
wm4 ad18a33f58 core: remove EDL muting
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.
2012-01-18 04:21:45 +01:00
wm4 aae97b7e25 audio: properly restore audio volume on exit when mute is used
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.
2012-01-18 04:21:45 +01:00
wm4 95c52f865d softvol: make sure softvol settings are restored when switching audio tracks
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.
2012-01-18 04:21:45 +01:00
wm4 d1b38a8a37 audio: fix crash when exiting file when mute is enabled 2012-01-18 04:21:45 +01:00
wm4 f341b21a90 Merge remote-tracking branch 'origin/master' into my_master 2012-01-18 04:18:41 +01:00
wm4 5489d0e89a core: print pause status message only once on console
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.
2012-01-10 04:28:27 +02:00
wm4 b51e1d427e osd: always display pause icon when frame stepping
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.
2012-01-09 20:33:54 +02:00
Uoti Urpala 245773e569 cleanup: remove left over access_mpcontext.h (from GUI)
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.
2012-01-09 19:27:43 +02:00
Uoti Urpala 62e3877417 ad_ffmpeg: pass packet side data from libavformat
Pass avpacket->side_data when using a libavcodec audio decoder
together with libavformat demuxer (this was already done for video).
2012-01-08 23:32:40 +02:00
wm4 685fbf25fe mixer: keep user volume setting when --softvol is used
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.
2012-01-07 16:42:30 +01:00
wm4 03ba61c3bf core: uninit video output when audio file is played
Playing a video and then an audio file only left the VO window on screen.
2011-12-23 16:24:00 +01:00
Uoti Urpala 2e1cdcb9e6 configure, build: remove --disable-libav support
Remove support for building the player without libavcodec and
libavformat. These libraries are now always required.
2011-12-11 07:48:26 +02:00
Uoti Urpala ff6c06ea7a core: minor hrseek tweak (affects vo_vdpau deint frames)
Remove no longer necessary tests from hrseek code. As a result each
field of vo_vdpau framerate-doubling deinterlace modes is now
considered as a possible seek target.
2011-12-06 08:41:12 +02:00
Uoti Urpala 253f62c564 core, vo: new window refresh logic, add slow-video OSD redraw
Remove code refreshing window contents after events such as resize
from vo_vdpau, vo_gl and vo_xv. Instead have them simply set a flag
indicating that a refresh is needed, and have the player core perform
that refresh by doing an OSD redraw. Also add support for updating the
OSD contents over existing frames during slow-but-not-paused playback.

The VOs now also request a refresh if parameters affecting the picture
change (equalizer settings, colormatrix, VDPAU deinterlacing setting).
Even previously the picture was typically redrawn with the new
settings while paused because new OSD messages associated with setting
changes triggered a redraw, but this did not happen if OSD was turned
off.

A minor imperfection is that now window system events can trigger a
single one-frame step forward when using vo_xv after pausing so that
vo_xv does not yet have a copy of the current image. This could be
fixed but I think it's not important enough to bother.
2011-12-06 07:47:35 +02:00
Uoti Urpala ad0348cf0a core, vo: modify OSD redraw architecture, support EOSD
Previously the core sent VFCTRL_REDRAW_OSD to change OSD contents over
the current frame. Change this to VFCTRL_REDRAW_FRAME followed by
normal EOSD and OSD drawing calls, then vo_flip_page(). The new
version supports changing EOSD contents for libass-rendered subtitles
and simplifies the redraw support code needed per VO. vo_xv doesn't
support EOSD changes because it relies on vf_ass to render EOSD
contents earlier in the filter chain.

vo_xv logic is additionally simplified because the previous commit
removed the need to track the status of current and next images
separately (now each frame is guaranteed to become "visible" soon
after we receive it as "next", with no VO code running in the interval
between).
2011-12-06 05:03:39 +02:00
Uoti Urpala c9553ce82f vo: do final frame draw only near page flip
Separate passing a new frame to VOs using the new API into two steps.
The first, vo_draw_image(), happens after a new frame is available
from the filter chain. In constrast to old behavior, now the frame is
not actually rendered yet at this point (though possible slice draw
calls can already reach the VO before). The second step,
vo_new_frame_imminent(), happens when we're close enough to the
display time of the new frame that we'll commit to flipping it as the
next action and will not change the OSD over the previous frame any
more.

This new behavior fixes a previous problem with vo_vdpau and vo_gl in
the situation where the player is paused after decoding a new frame
but before flipping it; previously changing OSD in that state would
switch to the new frame as a side effect. It would also allow an easy
way to fix extra output files produced with something like "--vo=png
--frames=1" with precise seeking, but this is not done yet.

The code now relies on a new mp_image from the filter chain staying
valid even after the vf_vo put_image() call providing it returns. In
other words decoders/filters must not deallocate or otherwise
invalidate their output frame between passing it forward and returning
from the decode/filter call.
2011-12-06 02:55:13 +02:00
Uoti Urpala 8d6fc26bb9 Merge branch 'screenshot' (early part) 2011-11-25 23:59:23 +02:00
wm4 01cf896a2f core: add infrastructure to get screenshots from VOs
Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot
directly from the VO. If VO support is available, screenshots will be
taken instantly (no more 1 or 2 frames delay). Taking screenshots when
hardware decoding is in use will also work (vdpau). Additionally, the
screenshots will now use the same colorspace as the video display.
Change the central MPContext to be allocated with talloc so that it
can be used as a talloc parent context.

This commit does not yet implement the functionality for any VO (added
in subsequent commits).

The old screenshot video filter is not needed anymore if VO support is
present, and in that case will not be used even if it is present in
the filter chain. If VO support is not available then the filter is
used like before. Note that the filter still has some of the old
problems, such as delaying the screenshot by at least 1 frame.
2011-11-25 23:56:28 +02:00
Uoti Urpala 7b9908dda8 options, core/hrseek: add --hr-seek-demuxer-offset
Some demuxers do not accurately seek to a keyframe before a given
time but instead start too late. This means that precise seeks cannot
work either. Most notably the libavformat mpeg demuxer exhibits this
behavior depending on the file being played (with the internal mpeg
demuxer precise seeks don't work at all). Add new option
--hr-seek-demuxer-offset which can be used as a workaround with such
demuxers. The value of the option is subtracted from the seek target
position given to the demuxer when doing a precise seek.
2011-11-14 20:24:39 +02:00
Uoti Urpala 0aa8df2b7d core/hrseek: support precise seeks in audio-only case
Before, precise seeking only worked if there was a video stream; in
the audio-only case playback always started from the demuxer seek
position. Add code to cut away samples from the demuxer seek position
to the seek target position.
2011-11-14 20:24:39 +02:00
wm4 e3f5043233 core, demux: fix --identify chapter output with ordered chapters
Information about individual chapters was printed during demuxer
opening phase, and total chapter count (ID_CHAPTERS) was printed
according to mpctx->demuxer->num_chapters. When playing a file with
ordered chapters, this meant that chapter information about every
source file was printed individually (even though only the chapters
from the first file would be used for playback) and the total chapter
count could be wrong. Remove the printing of chapter information from
the demuxer layer and print the chapter information and count actually
used for playback in core print_file_properties().

Also somewhat simplify the internal chapters API and remove possible
inconsistencies.
2011-10-25 22:09:33 +03:00
Uoti Urpala 8b5efd6455 libmenu: remove OSD menu functionality (--menu)
Something like the OSD menu functionality could be useful. However the
current implementation has several problems and would require a
relatively large amount of work to get into good shape. As far as I
know there are few users of the existing functionality. Nobody is
working on the existing code and keeping it compiling at all while
changing other code would require extra work. So delete the menu code
and some related code elsewhere that's used by nothing else.
2011-10-25 07:05:47 +03:00
Uoti Urpala 377ae044e2 terminal output: show libav version numbers in verbose mode 2011-10-01 20:03:49 +03:00
Uoti Urpala 159102e0cb core: fix --sstep
The --step option had broken at some point. Probably nobody uses it,
but it was easy to fix.
2011-09-04 22:12:51 +03:00
Uoti Urpala b948dd3461 cosmetics: mplayer.c: minor tweaks 2011-09-04 22:08:26 +03:00
Uoti Urpala 83fc5b6004 options: move libass-related options to struct 2011-09-03 14:26:14 +03:00
Uoti Urpala 9fe2fa599b core: remove bad workaround for files without FPS set
Commit dde8b753e4 merged an mplayer1 change (r31328) that set
correct_pts to true if FPS was not set (on the assumption that
correct-pts mode could provide proper timing without FPS). As the
merge commit noted this change was somewhat questionable, as the
option shouldn't really change after things have already been
initialized. After recent changes it can cause an outright crash
(assert in ds_get_packet2() from 9c7c4e5b7d fails). Remove the hack.
Also only print a warning about not having FPS if correct_pts is not
set (in correct_pts mode not having FPS shouldn't be a real problem,
as everything is based on timestamps anyway).
2011-08-25 02:45:13 +03:00
Uoti Urpala 9c7c4e5b7d core, demux, vd_ffmpeg: pass side data from demux_lavf to vd_ffmpeg
Pass the libavformat packet side_data field from demux_lavf to
vd_ffmpeg. Libavcodec/libavformat use this field for palette data, and
passing it is required for the playback of some paletted video codecs.

The implementation works by giving vd_ffmpeg a copy of the struct
demux_packet used to store the video packet (from which it can access
the avpacket field). The definition of struct demux_packet is moved to
new file demux_packet.h so that vd_ffmpeg.c can use it without
including all of demuxer.h.
2011-08-20 20:25:43 +03:00
Uoti Urpala 1cb179855e dvdnav: fix crash caused by missing line from 58834653c0
The committed version of 58834653c0 ("dvdnav: make
mp_dvdnav_save_smpi() more robust") was somehow missing one line which
caused a crash with dvdnav. Add it back.
2011-08-10 23:26:48 +03:00
harklu d4b8d1486a core: allocate OSD text buffers dynamically
The OSD text buffers (mp_osd_msg_t.text and osd_state.text) used to be
static arrays, with the buffer sizes spread all over the code as magic
constants. Make the buffers dynamically allocated and remove the
arbitrary length limits.
2011-08-09 03:28:58 +03:00
Uoti Urpala b4c90d78f0 options: support --leak-report (double dash form)
The special option --leak-report is manually checked so didn't
automatically get double-dash support. Update the test.
2011-08-08 07:58:21 +03:00
Uoti Urpala c6141b03f4 core: minor audio-only+timeline fix for chapter handling
Remove outdated "!mpctx->sh_video" checks in chapter seeking and
naming functions left over from when timeline functionality did not
support audio-only case.
2011-08-08 07:42:28 +03:00
Uoti Urpala 0fd7e6ec93 cleanup: reformat mplayer.c
I had delayed reformatting mplayer.c as I wanted to split it, but
since I didn't come up with a good way to do that I'll clean up the
messy formatting now.
2011-08-07 03:58:48 +03:00