This has the same (useless) definition as frame stepping in audio-only
mode: one frame means one playloop iteration. (It's relatively useless,
because one playloop iteration has a random duration. But it makes
--frames=1 work, which is useful again.)
Add new properties "dwidth" and "dheight", which contain the video
size as known by the VO (not necessarily what the VO makes out of them,
i.e. without window scaling and panscan).
Some time ago, all old special-cased commands (like "volume 1" to change
volume by one) have been removed. These commands are still emulated
using simple text replacement. This emulation is done to not break
everyone's input.conf, especially because the input.conf provided by
standard mplayer* still uses the old commands.
Every use of a deprecated command prints a replacement warning, which
was visible only with -v. Make these warnings visible by default.
There's actually not much reason to do this, but since commands like
"volume 5 1" don't work anymore, it's better to be verbose about this.
Also simplify the replacement for "vo_fullscreen".
Normal text was set to gray foreground color. This didn't work for
terminals with white background.
Instead of setting a color for normal text, reset the color attributes.
This way, only errors and warnings are formatted differently.
Also change the default color for MSGL_HINT from bold white to yellow.
A recent change accidentally set the flags options to -1 (probably
confusing it with the defasult value?), which mistakenly set all flags
and rejected all option values (except 0).
We consider FFmpeg 1.x and Libav 0.9.x releases compatible. Support
for FFmpeg 0.9.x and Libav 0.8.x is considered infeasible and has been
dropped in the previous commits. The bits that break compatibility are
mainly the CodecID renaming (trivial, but would require nasty hacks
everywhere), the avcodec_encode_video2() function (missing in older
releases, mandatory in newer ones), and the resampler changes (older
releases miss lib{av,sw}resample, newer versions removed the
libavcodec resampler).
Remove some other compatibility bits that were needed to for releases
for which we drop support.
The comment about Libav 0.9 in compat/libav.h is incorrect and should
have been 0.8 (the symbol is present in Libav 0.9).
The old names have been deprecated a while ago, but were needed for
supporting older ffmpeg/libav versions. The deprecated identifiers
have been removed from recent Libav and FFmpeg git.
This change breaks compatibility with Libav 0.8.x and equivalent
FFmpeg releases.
Move them into per-instance structs. This should get rid of all global
variables in mplayer.c (not counting those referenced by cfg-mplayer.h).
In core/input/ar.c, just remove checking the slave_mode variable. I'm
not sure what this code was supposed to achieve, but slave mode is
broken, slave mode is actually infeasible on OSX (ar.c is completely OSX
specific), and the correct way of doing this would be to disable this
input device per command line switch.
Missing entries cause avcodec_descriptor_get() to return NULL, and in
turn mp_codec_from_av_codec_id() will return NULL. This shouldn't
happen, and avcodec_descriptor_get() returning NULL for a valid codec is
clearly a bug.
But make it more robust anyway, and use the decoder's name if this
happens, because I doubt maintainance of the AVCodecDescriptor table
in ffmpeg/Libav will always be perfect and reliable.
Latest nvidia drivers ignore the application setting, so this switch
makes even less sense than before. It's still possible to control this
with VO specific suboptions.
Separate the video output options from the big MPOpts structure and also only
pass the new mp_vo_opts structure to the vo backend.
Move video_driver_list into mp_vo_opts
The spdif decoder was hardcoded to assume that the spdif output is
capable of accepting high (>1.5Mbps) bitrates. While this is true
for modern HDMI spdif interfaces, the original coax/toslink system
cannot deal with this and will fail to work.
This patch adds an option --dtshd which can be enabled if you use
a DTS-capable receiver behind a HDMI link.
Removes almost every global variabel in vo.h and puts them in a special struct
in MPOpts for video output related options.
Also we completly remove the options/globals pts and refresh rate because
they were unused.
When paused, --cursor-autohide worked with a precision of 500ms, which
is the main loop's default sleep time when paused. Cursor hiding is
polled in x11_common, and the main loop never called the X11 code at
the right time. Fix this by allowing the VO to set a time when it
should be called next.
Emulate percentage-seeks (SEEK_FACTOR) as normal time-seeks if possible.
This fixes some issues with (let's call it) low quality implementations
of SEEK_FACTOR (e.g. demux_mkv basically interprets this as byte-seek,
and also seeking to 99.9% makes it seek back to the start).
For weird MPEG formats the demuxer level SEEK_FACTOR is still used.
These formats, which can have timestamp resets, are identified by
setting demuxer->ts_resets_possible to true.
Also, have get_current_pos_ratio() follow the same rules, and calculate
the percentage position with the file position if timestamp resets are
possible.
This actually fixes percentage-seeks in .ts files with demux_lavf.c.
This kind of seek is not really used now, but it will be more important
when we add a progress bar.
Note: seeking in chained ogg files is still completely broken. The main
issue is that ffmpeg doesn't provide a sane API for dealing with
timestamp resets, and trying to do byte seeks with ogg confuses demuxer
and decoder (or something like this) and just does random things.
(Tested with two concatenated flac-in-ogg files).
OPT_BASE_STRUCT defines which struct the OPT_ macros (like OPT_INT etc.)
reference implicitly, since these macros take struct member names but no
struct type. Normally, only cfg-mplayer.h should need this, and other
places shouldn't be bothered with having to #undef it.
(Some files, like demux_lavf.c, still store their options in MPOpts. In
the long term, this should be removed, and handled like e.g. with VO
suboptions instead.)
Change the option definition macros so that they cause compiler warnings
if the type of the referenced option struct member doesn't match the
type implied by the macro. The compiler warning printed isn't very
telling, but it's better than silently invoking undefined behavior by
violating the C strict aliasing rules.
Also fix some minor cases that violate the type rules. For the option
"no-aspect" we have to add a new option type to handle it properly.
Some option types are hard to check, so we don't in these cases.
VFCAP_OSD was used to determine at runtime whether the VO supports OSD
rendering. This was mostly unused. vo_direct3d had an option to disable
OSD (was supposed to allow to force auto-insertion of vf_ass, but we
removed that anyway). vo_opengl_old could disable OSD rendering when a
very old OpenGL version was detected, and had an option to explicitly
disable it as well.
Remove VFCAP_OSD from everything (and some associated logic). Now the
vo_driver.draw_osd callback can be set to NULL to indicate missing OSD
support (important so that vo_null etc. don't single-step on OSD
redraw), and if OSD support depends on runtime support, the VO's
draw_osd should just do nothing if OSD is not available.
Also, do not access vo->want_redraw directly. Change the want_redraw
reset logic for this purpose, too. (Probably unneeded, vo_flip_page
resets it already.)
Use floats instead of integers in the range 0-100. Currently, the OSD
is currently made up of 46 elements so no change should be visible, but
rendering of the bar will be changed later to use vector drawings (using
pixel coordinates) instead of glyphs. This commit is for preparation.
The percent position is used for the OSD, the status line, and for the
OSD bar (shown on seeks). By default, the PTS of the last demuxed packet
was used to calculate it. This led to a "jumpy" display when the
percentage value (casted to int) was changing. The reasons for this were
the presence of video frame reordering (packet PTS is not monotonic), or
getting PTS values from different streams (like audio/subs).
Since these rely on PTS values and correct file durations anyway,
simplify it by calculating it with the current playback position in
mplayer.c instead.
This allowed making the player switch the monitor video mode when
creating the video window. This was a questionable feature, and with
today's LCD screens certainly not useful anymore. Switching to a random
video mode (going by video width/height) doesn't sound too useful
either.
I'm not sure about the win32 implementation, but the X part had several
bugs. Even in mplayer-svn (where x11_common.c hasn't been receiving any
larger changes for a long time), this code is buggy and doesn't do the
right thing anyway. (And what the hell _did_ it do when using multiple
physical monitors?)
If you really want this, write a shell script that calls xrandr before
and after calling mpv.
vo_sdl still can do mode switching, because SDL has native support for
it, and using it is trivial. Add a new sub-option for this.
The message reads: "Screenshot: filename", where the filename is what
mpv passes to fopen(). It will also show error messages when saving the
screenshot fails.
This means a commands like "seek 13:00 absolute" actually behaves like
"--start=13:00", instead of interpreting the argument as fraction as
with normal float options. This is probably slightly closer to what
you'd expect.
As a consequence, the seek argument's type changes from float to double
internally.
Apparently the intention was parsing numbers reliably in presence of
non-C locales. mpv is always in C locale, and not being in C locale
would probably break even more things, so remove this code.
You can just use --wid=0 if you really want this.
This only worked/works for X11, and even then it might interact badly
with most desktop environments. All the option did was setting --wid to
0, and the property did nothing.
"End of file" was printed to the terminal instead of "Quit" when exiting
with the "quit" slave command (closing the window and such). Note that
it will still print EOF when it exists because the end of the playlist
is reached.
Do some other (not strictly related) simplifications.
Was very complicated to use, and its uses have been removed in the
previous commits.
(While this feature sounded kind of useful, it could be rewritten in
a much simpler way, like storing presets as strings, and then using
the option parser to apply a preset. The removed code did some major
pointer juggling to handle raw values, which made it hard to use.)
For all suboptions, "flat" options were available by separating the
parent option and the sub option with ":", e.g. "--rawvideo:w=123". Drop
this syntax and use "-" as separator. This means even suboptions are
available as normal options now, e.g. "--rawvideo-w=123". The old syntax
doesn't work anymore.
Note that this is completely separate from actual suboptions. For
example, "-rawvideo w=123:h=123" still works. (Not that this syntax is
worth supporting, but it's needed anyway, for for other things like vf
and vo suboptions.)
As a consequence of this change, we also have to add new "no-" prefixed
options for flag suboptions, so that "--no-input-default-bindings"
works. ("--input-no-default-bindings" also works as a consequence of
allowing "-input no-default-bindings" - they are handled by the same
underlying option.)
For --input, always use the full syntax in the manpage. There exist
suboptions other than --input (like --tv, --rawvideo, etc.), but since
they might be handled differently in the future, don't touch these yet.
M_OPT_PREFIXED becomes the default, so remove it. As a minor unrelated
cleanup, get rid of M_OPT_MERGE too and use the OPT_SUBSTRUCT() macro in
some places.
Unrelated: remove the duplicated --tv:buffersize option, fix a typo in
changes.rst.
`--fs-screen` allows to decide what display to go fullscreen into. The
semantics of `--screen` changed and now it is only used to select the windowed
display when starting the application.
This is useful for people using mpv with an external TV. They will start
windowed on their laptop's screen and switch to fullscreen on the TV.
@wm4 worked on the x11 and w32 parts of the code. All is squashed in one
commit for history clarity.
Being able to insert newline characters ("\n") is useful for
--osd-status-msg, and possibly also for anything that prints to the
terminal. Espcially --term-osd-esc looks relatively useless without
being able to specify escapes.
Maybe parsing escapes should happen during command line / config parsing
instead (for all options).
This was supposed to be fixed in f897138, but there's another corner
case. Basically, set_osd_function() reset the OSD time, which is not
nice at all and breaks the logic of letting OSD elements disappear when
they're not wanted anymore. Fix this by adding a separate timer for
this.
Additionally, make sure the OSD bar is _really_ always updated when
visible. Also, redraw the OSD only if the OSD bar actually changes to
prevent redrawing too often (every vo_osd_changed() will flag that the
OSD should be redrawn, even if nothing changes).
Increase robustness against out of bound chapter numbers. Normally
these functions expect that the callers sanitize the chapter number.
This went wrong at least in add_seek_osd_messages() (which displayed
a chapter "-1" when chapters were not available). Make these functions
a bit friendler and add some reasonable checks and fallbacks, which
fixes the mentioned chapter seeking case as well.
Printed "error parsing option profile-desc=..." when using that inside
of profile sections. This happened because we now check the presence of
an option before setting it, and profile-desc is not an option, but
special cased in the config parser.
This affects the "show_progress" command, by defualt on the 'P' key.
If there are complaints, I'll probably remove it again. (It looks
relatively annoying, but it also valueable information... sort of.)
Until now, setting a property that is not available (e.g. deinterlacing
if not using vdpau and no deinterlacing filter is inserted) silently
failed (except for a messager on the terminal). Instead show on the OSD
that the property is unavailable.
Seeks can be performed with OSD bar invisible (e.g. "osd-msg seek ..."
command), and then an already visible bar won't be updated. But the bar
will stick around until the OSD text is hidden. This is confusing, so
change it that the bar is updated. (Making the bar disappear on such
seeks would require much more changes, so we're lazy and go with this
commit.)
Commit 4a40eed "options: change handling of "no-" options" generally
improved the handling of automatically added negation options
(recognizing "--no-opt", even though only "--opt" is declared in the
option list).
Unfortunately, one corner case was missed, which broke the option
"--input=no-default-bindings" (other suboptions, e.g. VO suboptions,
were not affected, and this is the only option where this mattered).
Instead of increasing the complexity further, use a completely different
approach: add the "--no-" options at runtime, and make them behave like
real options. This approach could be considered slightly less elegant,
because the code now has to worry about some option implementation
details rather than leaving it to the parser, but all in all the new
code is simpler and there are less weird corner cases to worry about.
The seek bar appeared to be "stuck" to the start of the current chapter.
This is a regression from 630a2b1. This commit assumed that hrseek_pts
would always contain the hrseek target time (when hrseek_active==true).
But this is not always the case: when playing timeline stuff (e.g.
ordered chapters), hrseek framedropping is abused to handle an obscure
corner case, and then hrseek_pts contains something completely unrelated
to the current playback time. See the added comment in mplayer.c and
commit c1232c9.
Fix this by trying something else to get a correct time "during"
hr-seeks. mpctx->restart_playback looks ideal, because it's set while
audio is being synced / audio buffers being filled, so we know that the
audio time is probably bogus while it is set. Let's hope this is
correct.
Do this to reduce conflicts with <linux/input.h>, which contains some
conflicting defines.
This changes the meaning of MP_KEY_DOWN:
KEY_DOWN is renamed to MP_KEY_DOWN (cursor down key)
MP_KEY_DOWN is renamed to MP_KEY_STATE_DOWN (modifier for key down state)
int64_t was accidentally used with "%lld" format specifiers, which is
incorrect (even though long long int is always 64 bits, the type behind
int64_t can be different, e.g. it can be long int on 64 bit platforms).
Instead of putting codec header data into WAVEFORMATEX and
BITMAPINFOHEADER, pass it directly via AVCodecContext. To do this, we
add mp_copy_lav_codec_headers(), which copies the codec header data
from one AVCodecContext to another (originally, the plan was to use
avcodec_copy_context() for this, but it looks like this would turn
decoder initialization into an even worse mess).
Get rid of the silly CodecID <-> codec_tag mapping. This was originally
needed for codecs.conf: codec tags were used to identify codecs, but
libavformat didn't always return useful codec tags (different file
formats can have different, overlapping tag numbers). Since we don't
go through WAVEFORMATEX etc. and pass all header data directly via
AVCodecContext, we can be absolutely sure that the codec tag mapping is
not needed anymore.
Note that this also destroys the "standard" MPlayer method of exporting
codec header data. WAVEFORMATEX and BITMAPINFOHEADER made sure that
other non-libavcodec decoders could be initialized. However, all these
decoders have been removed, so this is just cruft full of old hacks that
are not needed anymore. There's still ad_spdif and ad_mpg123, bu neither
of these need codec header data. Should we ever add non-libavcodec
decoders, better data structures without the past hacks could be added
to export the headers.
Also move the lang field into the general stream header. (SH_COMMON is
an old hack to "share" code between audio/video/sub headers.)
There should be no functional changes, other than not printing stream
info in verbose mode or with slave mode. (The frontend already prints
stream info, and this is just a leftover when individual demuxers did
this, and slave mode remains broken.)
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
Simplify --no-config and make it a normal flag option, and doesn't take
an argument anymore. You can get the same behavior by using --no-config
and then --include to explicitly load a certain config file.
Make --no-config work for input.conf as well. Make it so that
--input:conf=file still works in this case. As a technically unrelated
change, the file argument now works as one would expect, instead of
making it relatively to "~/.mpv/". This makes for simpler code and
easier to understand option semantics. We can also print better error
messages.
Doesn't have much of a purpose for normal playback. You can get
milliseconds display with --osd-fractions. It's also possible to build
a custom status line with --status-msg.
This gives more space on the status line and, in my opinion, is a bit
less annoying.
OPT_MAKE_FLAGS() used to emit two options (one with "no" prefixed),
but that has been long removed by special casing flag options in the
option parser. OPT_FLAG_ON() used to imply that there's no "no-"
prefixed option, but this hasn't been the case for a while either.
(Conceptually, it has been replaced by OPT_FLAG_STORE().)
Remove OPT_FLAG_OFF, which was unused.
There were two option syntax variations:
"old": -opt value
"new": --opt=value
"-opt=value" was invalid, and "--opt value" meant "--opt=" followed by
a separate option "value" (i.e. interpreted as filename). There isn't
really any reason to do this. The "old" syntax used to be ambiguous
(you had to call the option parser to know whether the following
argument is an option value or a new option), but that has been removed.
Further, using "=" in the option string is always unambiguous.
Since the distinction between the two option variants is confusing,
just remove the difference and allow "--opt value" and "-opt=value".
To make this easier, do some other cleanups as well (e.g. avoid having
to do a manual lookup of the option just to check for M_OPT_PRE_PARSE,
which somehow ended up with finally getting rid of the m_config.mode
member).
Error reporting is still a mess, and we opt for reporting too many
rather than too few errors to the user.
There shouldn't be many user-visible changes. The --framedrop and
--term-osd options now always require parameters.
The --mute option is intentionally made ambiguous: it works like a flag
option, but a value can be passed to it explicitly ("--mute=auto"). If
the interpretation of the option is ambiguous (like "--mute auto"), the
second string is interpreted as separate option or filename. (Normal
flag options are actually ambiguous in this way too.)
Now setting a value with "=" is not required anymore in config files.
This should work analogous to command line arguments. Putting an entry
"opt=value" into the config file is like "--opt=value" on the command
line, and "opt" is like "--opt=" and "--opt".
Normally, all flag options can be negated by prepending a "no-", for
example "--no-opt" becomes "--opt=no". Some flag options can't actually
be negated, so add a CONF_TYPE_STORE option type to disallow the "no-"
fallback.
Do the same for choice options. Remove the explicit "no-" prefixed
options, add "no" as choice.
Move the handling of automatic "no-" options from parser-mpcmd.c to
m_config.c, and use it in m_config_set_option/m_config_parse_option.
This makes these options available in the config file. It also
simplifies sub-option parsing, because it doesn't need to handle "no-"
anymore.
This could write .edl files in MPlayer's format. Support for playing
these files has been removed from mplayer2 quite a while ago. (mplayer2
can play its own, "new" .edl format, but does not support writing it.)
Since this is a rather obscure functionality, and it's not really clear
how it should behave (e.g. what should it do if a new file is played),
and wasn't all that great to begin with (what if you made a mistake?
the "edl_mark" command sucks for editing), get rid of it.
Suggestions how to reimplement this in a nicer way are welcome. If it's
just about retrieving timecodes, this in input.conf will do:
KEY print_text "position: ${=time-pos}"
This fixes a problem that happened with syncplay.pl [1] when ad_mpg123
was in use, and get_current_time() returning a bogus time position.
This only happens during seeking; the reported time is correct after the
seek is done.
The audio PTS as returned by playing_audio_pts() is simply bogus during
hr-seek. With ad_ffmpeg, it was actually set to MP_NOPTS_VALUE during
seeking, so get_current_time() did a fallback to the video PTS. However,
ad_mpg123 is different and explicitly decodes some audio when resetting
on seek (reasons why it does this unknown and uninvestigated; apparently
it's to reinit libmpg123). As a result, the audio PTS was set to the
start position of the seek (or something similar), which could be very
different from the seek target time.
This confused syncplay. It got the bogus time because it spams the
player with read commands to the "time-pos" property, so this corner
case was hit.
Fix this by making get_current_time() return the seek target time if
hr-seek is active. This should make behavior the same as before commit
3f949cf "mplayer: prefer audio PTS over video PTS for status line".
[1] http://syncplay.pl
When doing a framestep while there is no more video, nothing happened,
and audio continued to play. When advancing to the next file, the player
was paused. Fix it so that it always pauses (except on very low frame
rate video, which is yet another corner case).
We also change the meaning of framestepping a bit: in audio only mode,
framstepping unpauses for a single playloop iteration. This is probably
not useful at all, but makes the code a bit more simpler/uniform.
Just like the previous commit, this matters most for audio files with
cover art, for which this special case is the normal case.
mpctx->delay is used to control audio/video sync. If more audio than
video has been played, it grows larger, meaning A/V desync is happening.
This logic is a bit broken when video has ended, and audio is still
playing. In that case, it tries to read additional video frames from the
video decoder (because even if you don't feed new packets to the
decoder, it could still return delayed frames). For that, the code to
determine whether frames should be dropped is invoked
(check_framedrop()). This function detects that video is behind audio (mpctx-
>delay growing big),
and attempts to issue a framedrop.
Reset mpctx->delay if there's no more video.
This fixes the the frame drop display "counting up" on each playloop
iteration when playing audio files with cover art. These files are
basically audio+video files with a single video frame. When playing
these files the the corner case of having run out of video while audio
is still playing is the normal case.
Also reset mpctx->last_av_difference. This is not updated anymore if
video ends (since update_avsync() sets it, but it's not called if
video_left is false). This removes the "stuck" A/V sync value when video
ends. With audio files containing cover art we would display a
meaningless value over the duration of the whole file otherwise.
These were memory leaks in theory, though not in practice (all memory is
free'd on exit anyway). However, it was still annoying when leak
reporting is enabled.
I'm not sure if there was an actual leak in check_autorepeat(), maybe
not.
Explicitly advancing the playlist with input commands ("playlist_next")
didn't jump back to the first file, if the current file was the last on
the playlist and looping was enabled.
Fix this and make the behavior with explicit input and playback EOF the
same.
Also add a minor feature: if looping is enabled, and the current file is
the first on the playlist, going back one entry jumps to the last
playlist entry (without changing loop count).
Fixes#22.
Should be dead code. Stream selection is handled either during
demuxer initialization, or via DEMUXER_CTRL_SWITCH_*.
(If there were actually situations where this code did something, it
was probably broken anyway.)
Allow negative times. Timestamps can be negative, and we actually
display negative time for other reasons too, such as when waiting for
the old audio to drain with gapless audio.)
Avoid overflows with relatively large time values. (We still don't
handle values too large for int64_t.)
This functionality looked smart but created problems with some kinds of
multi touch events. Moreover some events coming from the windows server – like
hovering a corner for window resize – didn't cause the player to wake up
immediately.
The "correct" non hacky way to implement async event polling with cocoa would
be having the vanilla cocoa event loop driving the player and setting up mpv's
terminal FDs as event sources for the cocoa event loop.
Fixes#20
Remove screenshot_force and associated logic. Always try to use the
screenshot video filter before trying taking screenshots with the VO,
which means that --vf=screenshot now takes the role of --vf=screenshot_force.
(To make this clear, not adding a video filter is still the recommended
way to take screenshots; we just change how VF screenshots are forced.)
Preferring VO over VF and having --vf=screenshot_force used to make
sense when not all VOs supported screenshots, and some VOs had somewhat
broken screenshots (like vo_xv taking screenshots with OSD in it). But
all these issues are fixed now, so just get rid of the cruft.
Move things that are used by vo_xv only into vo_xv, same for vo_x11.
Rename some functions exported by x11_common, like vo_init to
vo_x11_common. Make functions not used outsode of x11_common.c private
to that file. Eliminate all global variables defined by x11_common
(except error handler and colormap stuff).
There shouldn't be any functional changes, and only code is moved
around. There are some minor simplifications in the X11 init code, as
we completely remove the ability to initialize X11 and X11+VO
separately (see commit b4d9647 "mplayer: do not create X11 state in player frontend"),
and the respective functions are conflated into vo_x11_init() and
vo_x11_uninit().
The "http:" protocol has been switched to use ffmpeg's HTTP
implementation some time ago. One problem with this was that many HTTP
specific options stopped working, because they were obviously
implemented for the internal HTTP implementation only.
Add the missing things. Note that many options will work for ffmpeg
only, as Libav's HTTP implementation is missing these. They will
silently be ignored on Libav.
Some options we can't fix:
--ipv4-only-proxy, --prefer-ipv4, --prefer-ipv6
As far as I can see, not even libavformat internals distinguish
between ipv4 and ipv6.
--user, --passwd
ffmpeg probably supports specifying these in the URL directly.
If we detect Libav, always use the old builtin vobsub decoder (in
spudec.c). Note that we do not want to use it for newer ffmpeg, as
spudec.c can't handle the vobsub packets as generated by the .idx
demuxer, and we want to get rid of spudec.c in general anyway.
Now, when backgrounded, mpv plays and outputs messages to stdout, but
statusline is not output.
Background<->foreground transitions are detected by signals and polling
the process groups.
This was disabled in 4ea60a3 and 70c455a, when all options were still
forced file local, and resetting fullscreen was annoyingly reset when
switching to the next file. mpv keeps all options by default, so this
isn't needed anymore.
-x/-y were rather useless and obscure. The only use I can see is
forcing a specific aspect ratio without having to calculate the aspect
ratio float value (although --aspect takes values of the form w:h).
This can be also done with --geometry and --no-keepaspect. There was
also a comment that -x/-y is useful for -vm, although I don't see how
this is useful as it still messes up aspect ratio.
-xy is mostly obsolete. It does two things: a) set the window width to
a pixel value, b) scale the window size by a factor. a) is already done
by --autofit (--autofit=num does exactly the same thing as --xy=num, if
num >= 8). b) is not all that useful, so we just drop that
functionality.
--autofit=WxH sets the window size to a maximum width and/or height,
without changing the window's aspect ratio.
--autofit-larger=WxH does the same, but only if the video size is
actually larger than the window size that would result when using
the --autofit=WxH option with the same arguments.
Now all numbers in the --geometry specification can take percentages.
Rewrite the parsing of --geometry, because adjusting the sscanf() mess
would require adding all the combinations of using and not using %. As
a side effect, using % and pixel values can be freely mixed.
Keep the aspect if only one of width or height is set. This is more
useful in general.
Note: there is one semantic change: --geometry=num used to mean setting
the window X position, but now it means setting the window width.
Apparently this was a mplayer-specific feature (not part of standard X
geometry specifications), and it doesn't look like an overly useful
feature, so we are fine with breaking it.
In general, the new parsing should still adhere to standard X geometry
specification (as used by XParseGeometry()).
This also means the option is verified on program start, not when the VO
is created. The actual code becomes a bit more complex, because the
screen width/height is not available at program start.
The actual parsing code is still the same, with its unusual sscanf()
usage.
Drop queued frames on seek. Reset the internal state of some filters
that seem to need it as well: at least vf_divtc still produced some
frames using the previous PTS.
This fixes weird behavior with some filters on seeking. In particular,
this could lead to A/V desync or apparent lockups due to the PTS of
filtered frames being too far away from audio PTS.
This commit does only the minimally required work to fix these PTS
related issues. Some filters have state dependent on previously filtered
frames, and these are not automatically reset with this commit (even
vf_divtc and vf_softpulldown reset the PTS info only). Filters that
actually require a full reset can implement VFCTRL_SEEK_RESET.
Format changes within a file can e.g. happen in MPEG-TS streams. This
fix also fixes encoding of such files, because ao_lavc is not capable of
reconfiguring the audio stream.
This printed per-frame statistics into a file, like bitrate or frame
type. Not very useful and accesses obscure AVCodecContext fields
(danger of deprecation/breakage), so get rid of it.
This was a "broken misfeature" according to Libav developers. It wasn't
implemented for modern codecs (like h264), and has been removed from
Libav a while ago (the AVCodecContext field has been marked as
deprecated and its value is ignored). FFmpeg still supports it, but
isn't much useful due to aforementioned reasons.
Remove the code to enable it.
It's not easy to tell whether the OSD/subs are empty, or if something is
drawn. In general you have to use osd_draw() with a custom callback. If
nothing is visible, the callback is never invoked. (The actual reason
why this is so "hard" is the implementation of osd_libass.c, which
doesn't allow separating rendering and drawing of OSD elements, because
all OSD elements share the same ASS_Renderer.)
To simplify avoiding copies, make osd_draw_on_image() instead of the
caller use mp_image_make_writeable(). Introduce osd_draw_on_image_p(),
which works like osd_draw_on_image(), but gets the new image allocation
from an image pool. This is supposed to be an optimization, because it
reduces the frequency of large allocations/deallocations for image data.
The result of this is that the frequency of copies needed in conjunction
with vf_sub, screenshots, and vo_lavc (encoding) should be reduced.
vf_sub now always does true pass-through if no subs are shown.
Drop the pts check from vf_sub. This didn't make much sense.
mplayer's video chain traditionally used FourCCs for pixel formats. For
example, it used IMGFMT_YV12 for 4:2:0 YUV, which was defined to the
string 'YV12' interpreted as unsigned int. Additionally, it used to
encode information into the numeric values of some formats. The RGB
formats had their bit depth and endian encoded into the least
significant byte. Extended planar formats (420P10 etc.) had chroma
shift, endian, and component bit depth encoded. (This has been removed
in recent commits.)
Replace the FourCC mess with a simple enum. Remove all the redundant
formats like YV12/I420/IYUV. Replace some image format names by
something more intuitive, most importantly IMGFMT_YV12 -> IMGFMT_420P.
Add img_fourcc.h, which contains the old IDs for code that actually uses
FourCCs. Change the way demuxers, that output raw video, identify the
video format: they set either MP_FOURCC_RAWVIDEO or MP_FOURCC_IMGFMT to
request the rawvideo decoder, and sh_video->imgfmt specifies the pixel
format. Like the previous hack, this is supposed to avoid the need for
a complete codecs.cfg entry per format, or other lookup tables. (Note
that the RGB raw video FourCCs mostly rely on ffmpeg's mappings for NUT
raw video, but this is still considered better than adding a raw video
decoder - even if trivial, it would be full of annoying lookup tables.)
The TV code has not been tested.
Some corrective changes regarding endian and other image format flags
creep in.
Instead of using a callback to "capture" the image next time the filter
function is called, do it the other way around: on every filter
invocation, create a reference to the image, and return it if a
screenshot is requested. This also fixes the 1-frame delay when taking
screenshots with the filter.
This also allows simplifying screenshot.c.
VFCAP_TIMER disables any additional waiting done by mpv in the
playloop. Remove VFCAP_TIMER, but re-use the idea for vo_image and
vo_lavc.
This means --untimed doesn't have to be passed when using --vo=image.
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
Deprecate the hardware specific video codec entries (like ffh264vdpau).
Replace them with the --hwdec switch, which requests that a specific
hardware decoding API should be used. The codecs.conf entries will be
removed at a later time, but for now they are useful for testing and
compatibility.
Instead of --vc=ffh264vdpau, --hwdec=vdpau should be used.
Add a fallback if hardware decoding fails. Most hardware decoders
(including vdpau) support only a subset of h264, and having such a
fallback is supposed to enable a better user experience.
Simplify the decoder pixel format handling by making it handle only
the case vd_lavc needs: a video stream always decodes to a single
pixel format.
Remove the handling for multiple pixel formats, and remove the
codecs.conf pixel format declarations that are left.
Remove the handling of "ambiguous" pixel formats like YV12 vs. I420 (via
VDCTRL_QUERY_FORMAT etc.). This is only a problem if the video chain
supports I420, but not YV12, which doesn't seem to be the case anywhere,
and in fact would not have any advantage.
Make the "flip" flag a global per-codec flag, rather than a pixel format
specific flag. (Some ffmpeg decoders still return a flipped image, so
this has to be done manually.) Also fix handling of the flip operation:
do not overwrite the global flip option, and make the --flip option
invert the codec flip option rather than overriding it.
Slices allowed filtering or drawing video in horizontal bands or
blocks. This allowed working on the video in smaller units. In theory,
this could bring a performance win by lowering cache pressure, as you
didn't have to keep the whole video frame in cache while filtering,
only the slice.
In practice, the slice code path was barely used for the following
reasons:
- Multithreaded decoding with ffmpeg didn't use slices. The ffmpeg
slice callback was disabled, because it can be called from another
thread, and the mplayer video chain is not thread-safe.
- There was nothing that would turn "full" images into appropriate
slices, so slices were rarely used.
- Most filters didn't actually support slices.
On the other hand, supporting slices lead to code duplication and more
complex code in general. I made some experiments and didn't find any
actual measurable performance improvements when using slices. Even
ffmpeg removed slices based filtering from libavfilter in favor of
simpler code.
The most broken thing about the slices code path is that slices can't
be queued, like it is done for images in vo.c.
This function sucks and apparently is not very portable (at least on
mingw, the configure check fails). Also remove the emulation of that
function from osdep/strsep*, and remove the configure check.
Ensure that even if a seek is inaccurate it will not show video from
outside the defined timeline. Previously, seeking to the beginning of
a segment could show frames from before the start of the segment if
the seek was done in inaccurate mode and the demuxer seeked to an
earlier position. Now hr-seek machinery is used to skip at least the
frames that should not be part of playback timeline at all.
Now external subtitles essentially use the playback time, instead of
the segment time.
This is more useful when using external subtitles with mkv ordered
chapters. The previous behavior is not necessarily incorrect, and e.g.
makes it easier to use subtitles directly extracted from ordered
chapters segments. But we consider the new behavior more useful.
Also see commit 06e3dc8.
This is simpler and more useful. We could add a new switch for the old
functionality, but that would probably be more confusing than helpful.
When passing only a single file to the command line, this commit
shouldn't change behavior.
(Classic mplayer provided both features by duplicating the loop
functionality in the "playtree".)
When the last frame is displayed, and a frame step command is issued,
playback ands and advances to the next file. But before this commit,
the next file was played unpause. Fix this, and make sure pause is
kept.
Before this commit, the --osd-* options (like --osd-font-size etc.)
configured both the OSD and subtitle font. Make them separate, and add
--sub-text-* options (like --sub-text-size etc.). Now --osd-* affects
the OSD font only, and --sub-text-* unstyled text subtitles only.
This is better than having just the operating system type decide the
wakeup period, as e.g. when compiling for Win32/cygwin, a wakeup period
of 0.5 would work perfectly fine.
Instead, the default wakeup period is now only decided by availability
of a working select() system call (which is the case on cygwin but not
mingw and MSVC) AND a vo that can provide an event file descriptor or a
similar hack (vo_corevideo). vos that cannot do either need polling for
event handling and now can set the wakeup period to 0.02 in the vo code.
Add `mp_find_config_file` to search different known paths and use that in
ass_mp to look for the fontconfig configuration file.
Some incidental changes spawned by this feature where:
* Buffer allocation for the strings containing the paths is now performed
with talloc. All of the allocations are done on a NULL context, but it still
improves readability of the code.
* Move the OSX function for lookup inside of a bundle: this code path was
currently not used by the bundle generated with `make osxbundle`. The plan
is to use it again in a future commit to get a fontconfig config file.
Even if this is not so bad as other files, I need to add some stuff so...
why not!?
`uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace core/path.h`
`uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace core/path.c`
The header was unchanged by the tool.
Keep the currently displayed subtitles even when the user cycles through
subtitle tracks, and the subtitle is decoded by libavcodec (such as
vobsubs). Do this by not clearing the subtitles on reset(). reset() is
also called on seek, so check the start PTS whether the subtitle should
really be displayed (there's already an end PTS). Note that sd_ass does
essentially something similar.
The existing code has checks for whether the PTS reported by the demuxer
is invalid (MP_NOPTS_VALUE). I don't know under what circumstances this
can happens, so fall back to the old behavior if the PTS is invalid.
This slightly improves display of the current playback time in files
with sparse video packets (like video tracks containing a slow MJPG
slideshows as in [1]), or audio files with cover art image attachments.
While the video PTS is always "stuck" at the last frame displayed or
the last seek, audio is usually continuous. Given sane samplerates and
working audio drivers (to query how much of the current audio buffer has
been played), the audio PTS should always be more reliable.
[1] http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/rtpodcast/Rooster_Teeth_Podcast_191.m4a
ffmpeg pretends that image attachments (such as contained in ID3v2
metadata) are video streams. It injects the attached pictures as packets
into the packet stream received with av_read_frame().
Add the --audio-display option to allow configuring whether attached
pictures should be displayed. The default behavior doesn't change
(images are displayed).
Identify video streams, that are actually image attachments, with "[P]"
in the terminal output.
Modify the default stream selection such that real video streams are
preferred over attached pictures. (This is just for robustness; I do not
know of any samples where images are added before actual video streams
and could lead to bad default stream selection with the old code.)
This caused errors like:
core/mplayer.c:4308:5: error: implicit declaration of function 'pthread_win32_thread_detach_np' [-Werror=implicit-function-declaration]
It turns out a pthread.h include was missing. It's not clear why this
used to work (or rather, why it happens only sometimes). Possibly some
libraries or system headers recursively include pthread.h under certain
circumstances or configurations.
Fix missing quoting in configure, which led to broken terminal output.
Closes#6.
libavformat wants to read a full ~400KB of data to determine whether
it's really AAC. This causes slow startup with AAC web radio streams [1]
(possible due to a broken initial packet). There are similar issues
with other file formats.
Make the probe "score" (libavformat's mechanism for testing file
formats) configurable with the -lavfdtops:probescore option. This allows
lowering the amount of data read on probing. If the probe score is below
the probescore option value, demux_lavf will try to get a higher score
by feeding more data to libavformat, until the required score or the
max. probe size is reached.
Remove the lavf_preferred demuxer entry. This had a purpose in
mplayer-svn, but now there doesn't seem to be any good reason for it
to exist. Make sure that our native "good" demuxers are above
demux_lavf in demuxer_list[] instead (so that they are preferred).
[1] http://lr2mp0.latvijasradio.lv:8000
ffmpeg recently added a demuxer that can read vobsubs (pairs of .sub and
.idx files). Get rid of the internal vobsub reader, and use the ffmpeg
demuxer instead.
Sneak in an unrelated manpage change (autosub default).
This affects streams loaded with -subfile and -audiofile. They could get
out of sync when they were deselected, and the main file was seeked. Add
code to seek external files when they are selected (see
init_demux_stream()).
Use avformat_seek_file() under certain circumstances. Both av_seek_frame()
("old" API) and avformat_seek_file() ("new" API) seem to be broken with
some formats. At least the vobsub demuxer doesn't implement the old API
(and the old API doesn't fallback to the new API), while the fallback
from new API to old API gives bad results. For example, seeking forward
with small step sizes seems to fail with the new API (tested with
Matroska by trying to seek 1 second forward relative to priv->last_pts).
Since only subtitle demuxers implement the new API anyway, checking
whether iformat->read_seek2 is set to test whether the old API is not
supported gives best results. This is a hack at best, but makes things
work.
Remove backwards seeking on seek failure. This was annoying, and only
was there to compensate for obscure corner cases (see 1ad332). In
particular, files with completely broken seeking that used to skip back
to the start on every seek request may now terminate playback.
Do this only if demux_lavf is used. Using demux_mpg and the ffmpeg DVD
subtitle decoder doesn't work. The problem is probably that demux_mpg
doesn't join split sub packets, while demux_lavf does. The internal
DVD sub decoder (spudec.c) can, while ffmpeg's dvdsub can't. I do not
know whether this is the actual problem.
If DVD playback is used, create "fake" vobsub-style text extradata
(like .idx files) to pass resolution and palette information to the
ffmpeg decoder. We could use the "palette" AVOpt and avcodec_set_dimensions()
instead, but it's actually simpler this way. Note that the decoder
doesn't parse any other fields. Also note that DVD playback still uses
demux_mpg by default, so this code is inactive unless -demuxer lavf is
specified. This is mainly preparation for the case when we manage to get
rid of demux_mpg for DVD playback.
The option sub-forced-only was accidentally renamed back to
forcedsubsonly in commit 72205635ab, causing a segfault in
mp_property_generic_option due to missing option.
Button 3 and 4 are mapped to the mouse wheel. Double click events for
them annoying and not useful at all.
I don't know about buttons 5-19; for all I know these could be mapped
to wheels as well. Even if not, double click events are probably not
very important for these. Disable double clicks for these as well.
Remove the options --utf8 and --unicode which had no effect any more
(what they once did should be doable with --subcp). The only use of
corresponding variables left in code was subreader.c code using
sub_utf8 as a flag indicating whether iconv conversion was active.
Change the code to test the existence of iconv context instead.
Conflicts:
DOCS/man/en/options.rst
core/cfg-mplayer.h
sub/sub.c
sub/sub.h
sub/subreader.c
Merged from mplayer2 commit ea7311.
Note: --unicode was already removed
When the cache fill status goes below a certain threshold, automatically
pause the player. When the cache is filled again, unpause again.
This is intended to help with streaming from http. It's better to pause
a while, rather than exposing extremely crappy behavior when packet
reads during decoding block the entire player.
In theory, we should try to increase the cache if underruns happen too
often. Unfortunately, changing the cache implementation would be very
hard, because it's insane code (forks, uses shared memory and "volatile"
etc.). So for now, this just reduces the frequency of the stuttering if
the network is absolutely too slow to play the stream in realtime.
This commit is separate from the previous one to separate our own
changes from changes merged from mplayer2 (as far as that was possible).
Make it easier for stream implementations to request being cached. Set
a default cache size in stream.c, and remove them from various stream
implementations. Only MS streaming support sets a meaningful cache size.
Make querying cache size saner. This reduces the amount of #ifdefs
needed.
Code enabling the cache by default for network streams did that by
modifying the value of the "cache" option. This wasn't sane, as
multiple streams may be created and all share the same options. Change
the code to not modify options but store data in the stream instance
instead.
Conflicts:
core/mplayer.c
demux/demux.c
stream/cache2.c
stream/network.c
stream/network.h
stream/pnm.c
stream/stream.c
stream/stream_rtp.c
Merged from mplayer2 commit e26070. Note that this doesn't solve any
actual bug, as the playlist crashing bug has been fixed before.
Since the global cache size option value is not overwritten anymore, the
option doesn't need to be restored on end of playback (M_OPT_LOCAL).
Based on a patch by qyot27. Add export LC_ALL=C on top of version.sh to
make the output locale independent.
Note that the build time will not be updated on every "make" invocation,
but only when the git revision is updated. This is a good thing, as
repeated make invocations should not rebuild the binary. (This would
break "sudo make install" too.)
libavdevice supports various "special" video and audio inputs, such
as screen-capture or libavfilter filter graphs.
libavdevice inputs are implemented as demuxers. They don't use the
custom stream callbacks (in AVFormatContext.pb). Instead, input
parameters are passed as filename. This means the mpv stream layer has
to be disabled. Do this by adding the pseudo stream handler avdevice://,
whose only purpose is passing the filename to demux_lavf, without
actually doing anything.
Change the logic how the filename is passed to libavformat. Remove
handling of the filename from demux_open_lavf() and move it to
lavf_check_file(). (This also fixes a possible bug when skipping the
"lavf://" prefix.)
libavdevice now can be invoked by specifying demuxer and args as in:
mpv avdevice://demuxer:args
The args are passed as filename to libavformat. When using libavdevice
demuxers, their actual meaning is highly implementation specific. They
don't refer to actual filenames.
Note:
libavdevice is disabled by default. There is one problem: libavdevice
pulls in libavfilter, which in turn causes symbol clashes with mpv
internals. The problem is that libavfilter includes a mplayer filter
bridge, which is used to interface with a set of nearly unmodified
mplayer filters copied into libavfilter. This filter bridge uses the
same symbol names as mplayer/mpv's filter chain, which results in symbol
clashes at link-time.
This can be prevented by building ffmpeg with --disable-filter=mp, but
unfortunately this is not the default.
This means linking to libavdevice (which in turn forces linking with
libavfilter by default) must be disabled. We try doing this by compiling
a test file that defines one of the clashing symbols (vf_mpi_clear).
To enable libavdevice input, ffmpeg should be built with the options:
--disable-filter=mp
and mpv with:
--enable-libavdevice
Originally, I tried to auto-detect it. But the resulting complications
in configure did't seem worth the trouble.
This is consistent with the demuxer/decoder info output mpv already has,
and is also generally useful to know, especially if using
--ao=codec1,codec2,... syntax.
This caused e.g. "--alang=" (without anything following) to be printed
in the terminal output when the file specified no language for the
track. Introduced by commit 9085b8.
MPlayer/mplayer2 still show DVD subtitles in gray. Depending on who you
ask, this can be considered a bug or a feature. Include rendering in
gray as explicit feature, so the user can decide what is better.
This affects all indexed sub bitmaps entering the OSD rendering path.
Currently, this means all image subs are affected by this option, but
nothing else.
Apparently the -spugauss option was popular. The code originally
implementing this is gone (scaler stuff in spudec.c). Reimplement it
using libswscale to scale and blur image subtitles if the --sub-gauss
option is set.
The code does some rather lazy padding to allow the blur to spread
pixels past the original image bounding box. (This problem exists with
normal bilinear scaling too, but is barely noticable.)
Technically, this doesn't just blur subtitles, but anything RGBA (or
indexed) that enters the OSD rendering path. But only image subtitles
produce these OSD formats currently, so no explicit check is done to
prevent blurring in other cases.
Until now, screenshots with the video filter didn't add subs (unclear
whether that was an oversight or feature). Fix this and make behavior
when taking screenshots with vf_screenshot more consistent with VO
screenshots.
The change in vf_screenshot is needed, because add_subs() checks this
flag to decide whether it's allowed to mutate the image.
This commit has another user visible side effect. When taking a
screenshot each frame (using the "each-frame" mode of the screenshot
command), a normal screenshot command will stop the each-frame mode.
mp_image has this confusing distinction between the w/h and width/height
fields. w/h are the actual width and height, while width/height have a
very special meaning inside the video filter code: it's the actually
allocated width, which is also used for stride padding.
Screenshot related code abused the w/h fields to store the aspect
corrected size. Some code confused the role of w/h and width/height.
Fix these issues. For aspect corrected size, display_w/h are used, while
width/height should never be used outside vf.c internals and related
code.
This also fixes an actual bug when taking screenshots of anamorphic
video with vf_screenshot, as well as using vo_image with such videos.
Enable printf format warnings for set_osd_[t]msg.
Remove the pointless assertion in mplayer.c (the assertion proved that
the following NULL check is probably pointless, but leave that check
anyway for robustness - it's not really clear whether it's needed).
The playback status symbol in the OSD status display on video (such as
displayed when seeking or with the show_progress input command)
sometimes kept displaying the last seek, without resetting the symbol.
(For example: disable the OSD, seek, enable the OSD, run show_progress;
but also other cases.)
The main reason for that was the code clearing the OSD bar is also
responsible for clearing the osd_function (which stores the playback
symbol). If no OSD bar was set, the osd_function was never reset.
Fix by always setting the timer for clearing the OSD bar and the
osd_function whenever the osd_function is set. Clearing the OSD bar
when it wasn't set is OK. If the OSD bar is set some time after
osd_function is set, the timer is overwritten - that's a good thing,
as it makes both disappear from the screen at exactly the same time.
Always reset osd_function to 0 and determine the playback status
explicitly from mpctx->paused when displaying the status on screen.
Do not load codecs.conf files located in $PREFIX/etc/mpv/ or ~/.mpv/.
There really is no use for this, other than possibly breaking things.
It's still possible to use --codecs-file explicitly to load an external
config file, and this option can be used in ~/.mpv/config.
While we're at it, remove the global codecs_file variable, and another
unused variable.
Only some choices have an additional integer range. For those which
do, printing the choices only would be confusing.
E.g. --cursor-autohide accepts the choices "always", "no", or an
integer value. The help text printed on option parse errors should
print the accepted integer range additional to "always" and "no".
Make more aspects of the OSD font customizable. This also affects the
font used for unstyled subtitles (such as SRT), or when using the
--no-ass option. This adds back some customizability that was lost with
commit 74e7a1 (osd: use libass for OSD rendering).
Removed options:
--ass-border-color
--ass-color
--font
--subfont
--subfont-text-scale
Added options:
--osd-color
--osd-border
--osd-back-color
--osd-shadow-color
--osd-font
--osd-font-size
--osd-border-size
--osd-margin-x
--osd-margin-y
--osd-shadow-offset
--osd-spacing
--sub-scale
The font size is now specified in pixels as it would be rendered on a
window with a height of 720 pixels. OSD and subtitles are always scaled
with the window height, so specifying or expecting an absolute font
size doesn't make sense.
Such scaled pixel units are used to specify font border etc. as well.
(Note: the font size is directly passed to libass. How the fonts are
actually rasterized is outside of our control, but in theory ASS font
sizes map to "script" pixels and then are scaled to screen size.)
The default settings should be about the same, with slight difference
due to rounding to the new scales.
The OSD and subtitle fonts are not separately configurable. It has
limited use and would double the number of newly added options, which
would be more confusing than helpful. It could be easily added later,
should the need arise.
Other small details that change:
- ASS_Style.Encoding is not set to -1 for subs anymore
(assuming subs use VSFilter direction in -no-ass mode too)
- use a different WrapStyle for OSD
- ASS forced styles are not applied to OSD
This accepts HTML-style hex colors in the form #RRGGBB. It's also
possible to provide an alpha component with #AARRGGBB. Each 2-digit
group is a hex number, which gives the color value from 0-255 (e.g.
There is existing code in subassconvert.c, which parses HTML-style
color values in SRT subs. This is not used: it's probably better if
option parsing is completely separate from code specific to certain
subtitle formats, even if a little code is duplicated.
When a video filter returned inf as PTS, the player crashed. One
reason for this was that decode_audio() was called with a negative
minlen parameter, which at some point caused it to call a memory
allocation function with a ridiculous value, triggering an out of
memory code path in talloc.c. (talloc.c has been modified to abort()
on out of memory situations.)
Fix this by sanity checking minlen in decode_audio(). (The check
against outbuf->len always succeeded, because it's an unsigned
comparison.)
Make an existing sanity check in mplayer.c more robust: check for NaN
too, which happens if the video PTS is inf.
This happened with "-vf pullup,softpulldown" (but is not triggered when
the following commit is applied).
ao_play() can fail; in that case a negative error code is returned.
This error code is returned by write_to_ao() in turn. The function
fill_audio_out_buffers(), which calls write_to_ao(), doesn't check for
any error codes, and will likely trigger the assertion following the
function call. Change write_to_ao() to return 0 on failure to hopefully
prevent crashes when AOs fail.
The language string was dynamically allocated, which completely fails
if the cache is forked (which it usually is). Change it back to a fixed
length string, like the original code had it.
Most of these are reimar fixing issues found by Coverity static
analyzer, and possibly some more cleanup commits independent from
this.
Since these commits are rather noisy, squash them all together.
Try to make code a bit clearer.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35294 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
audio/out/ao_alsa.c
Check the correct variable for NULL.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35323 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove pointless unreachable code (the loop condition already checks
the 0xff case).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35325 b3059339-0415-0410-9bf9-f77b7e298cf2
Fix typo that might have caused reading beyond the string end.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35326 b3059339-0415-0410-9bf9-f77b7e298cf2
Do not needlessly use "long" types.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35331 b3059339-0415-0410-9bf9-f77b7e298cf2
Use AV_RB32 to avoid sign extension issues and validate offset before using it.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35332 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove nonsense casts.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35343 b3059339-0415-0410-9bf9-f77b7e298cf2
Fix crash in case sh_audio allocation failed.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35348 b3059339-0415-0410-9bf9-f77b7e298cf2
Fix potential NULL dereference.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35351 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
libmpcodecs/ad_ffmpeg.c
Note: Slightly modified.
Fix malloc failure check to check the correct variable.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35353 b3059339-0415-0410-9bf9-f77b7e298cf2
Avoid code duplication and pointless casts.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35363 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
stream/tv.c
Error out if an invalid channel list name was specified
instead of continuing and reading outside array bounds
all over the place.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35364 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
stream/tv.c
Make array "static const".
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35365 b3059339-0415-0410-9bf9-f77b7e298cf2
Properly free resources even when encountering many
parse errors.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35367 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
parser-cfg.c
Avoid leaks in error handling.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35380 b3059339-0415-0410-9bf9-f77b7e298cf2
Do not do sign comparisons on "char" type which can be both signed or unsigned.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35381 b3059339-0415-0410-9bf9-f77b7e298cf2
Free cookies file data after parsing it.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35382 b3059339-0415-0410-9bf9-f77b7e298cf2
http_set_field only makes a copy of the string, so we still need to
free it.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35383 b3059339-0415-0410-9bf9-f77b7e298cf2
check4proxies does not modify input URL, so mark it const.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35390 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove proxy "support" from stream_rtp and stream_upd, trying
to use a http proxy for UDP connections makes no sense.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35394 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
stream/stream_rtp.c
stream/stream_udp.c
Add url_new_with_proxy function to reduce code duplication and memleaks.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35395 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
stream/pnm.c
stream/stream_live555.c
stream/stream_nemesi.c
stream/stream_rtsp.c
Fix off-by-one errors in file descriptor validity checks.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35402 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove pointless cast.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35403 b3059339-0415-0410-9bf9-f77b7e298cf2
Abort when opening the file failed instead of calling
"write" with an invalid descriptor.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35404 b3059339-0415-0410-9bf9-f77b7e298cf2
Remove pointless local variable.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35411 b3059339-0415-0410-9bf9-f77b7e298cf2
Conflicts:
stream/http.c
The --start and --end switch now accept a chapter number. The chapter
number is prefixed with '#', e.g. "--start=#2" jumps to chapter 2.
The chapter support might be able to replace --chapter completely, but
for now I am not sure how well this works out with e.g. DVDs and BDs,
and a separate --chapter option is useful interface-wise.
(This was supposed to be added in 51503a, but apparently the fixup
commit adding it was lost in a rebase. This might also be the reason
for the mess-up fixed in 394285.)
The option type m_option_type_rel_time was completely broken. It
interpreted everything starting with a number as percent position. This
is because sscanf() semantics are idiotic (trailing string doesn't need
to be matched), and due to my own idiocy this was overlooked when
testing. Fix by considering sscanf() evil and not using it.
(bstr_sscanf() is a straight wrapper around sscanf()).
Even if the percent code was fixed, there was another bug: it always
interpreted times as negative (starting from end for --start). Fix the
basic logic.
Enable autoprobing for demux_mf, so that image files can be directly
displayed with e.g. "mpv file.jpg --pause". (The --pause switch is
needed to prevent the window from closing immediately.)
Since demux_mf doesn't have any real file format probing and goes by
file extension only, move the demuxer down the demuxer list to ensure
it's checked last. (ffmpeg's demux_mf equivalent, "image2", probes by
file extensions too, and there doesn't seem to be anything that can
probe typical image file formats from binary data.)
Remove the --mf "w" and "h" suboptions. Don't pass the width/height to
the video stream header. Both of these are useless, because the decoder
reads the real image size at a later point from the file headers.
Remove setting the BITMAPINFOHEADER as well, as vd_lavc doesn't need
this.
Enable --correct-pts by default. This fixes displaying a single image
with vo_vdpau (as mentioned by uau).
Keep around a pointer to the sh_video stream header instead of
accessing demuxer->video->sh_video. Fixes a crash when deselecting the
video track.
Note that the format probing is incorrect when opening images from HTTP
locations. File extensions don't have to match the actual file format.
A correct implementation would require to check the MIME type, or to
probe the binary data correctly.
Make demux_lavf not error out if no video or audio track is present.
This allows opening subtitle files with the demuxer.
Improve the test whether subtitles read from demuxers must do explicit
packet reads. (I'm not sure whether always doing these reads could have
bad effects, such as reading too many audio and video packets at once,
so be conservative.)
The computation for the A/V sync value was inside print_status(). Move
it into its own function; this makes things simpler and gets rid of some
minor dead code.
The --keep-open option causes mpv not to close the current file.
Instead, it will pause, and allow the user to seek around. When
seeking beyond the end of the file, mpv does a precise seek back to
the previous last known position that produced video output.
In some corner cases, mpv might not be able to produce video output at
all, despite having created a VO. (Possibly when only 1 frame could be
decoded, but the video filter chain queues frames. Then a VO would be
created, without sending an actual video frame to the VO.) In these
cases, the VO window will not redraw, not even OSD.
Based on a patch by coax [1].
[1] http://devel.mplayer2.org/ticket/210#comment:4
sub_remove remove an external subtitle track, for whatever this may be
needed.
sub_reload removes and re-adds an external subtitle track.
Also rename sub_load to sub_add, because that seems to be more in line
with sub_remove.
"--autosub-match" is close to "--autosub", and reflects what this
option does slightly better. Replace the magic number option values
with choices:
--sub-fuzziness=0 becomes --autosub-match=exact
--sub-fuzziness=1 becomes --autosub-match=fuzzy
--sub-fuzziness=2 becomes --autosub-match=all
Rename the -ss option to -start, and -endpos to -length. Add a -end
option. The -end option always specifies an absolute end time, as
opposed to -endpos/-length.
All these options (--start, --end, --length) now accept relative times.
Percent positions (e.g. "--start=30%") are interpreted as fractions of
the file duration. Negative times (e.g. "--start=-1:00) are interpreted
relative to the end of the file. Chapters (e.g. "--start=#3") yield the
chapter's time position.
The chapter support might be able to replace --chapter completely, but
for now I am not sure how well this works out with e.g. DVDs and BDs,
and a separate --chapter option is useful interface-wise.
Using --no-msgcolor, error messages that happened before "really"
parsing the command line were still printed in color. Add the
CONF_PRE_PARSE flag to make this option take effect as early as
possible.
The -zoom option enabled scaling with vo_x11. Remove the -zoom option,
and make its behavior default. Since vo_x11 has to use libswscale for
colorspace conversion anyway, which doesn't do actual extra scaling when
vo_x11 is run in windowed mode, there should be no speed difference with
this change.
The code removed from vf_scale attempted to scale the video to d_width/
d_height, which matters for anamorphic video and the --xy option only.
vo_x11 can handle these natively. The only case for which the removed
vf_scale code could matter is encoding with vo_lavc, but since that
didn't set VOFLAG_SWSCALE, nothing actually changes.
It's silly to print a warning if an optional config file is missing.
Don't print anything at the default message level if an input config
is not found.
Unfortunately, the behavior is the same for explicitly passed input
config files (with --input=conf=file.conf).
Using --loop=inf on an unseekable file would put mpv (and all other
mplayers as well) into an endless loop, trying to seek to the start of
the file on each playback loop iteration. When the seek fails, playback
simply remains in the at-end-of-file state, and tries to issue a new
seek command for looping.
Fix by checking if the seek command fails, and abort looping in this
case. For that, queue_seek() is replaced with seek(). Due to the
circumstances, these two calls happen to be equal in this case: the
seek is absolute (i.e. no seek coalescing done), and the execution of
queued seeks is right after the loop code anyway.
In this example, only f1.mkv was looped: mpv f1.mkv f2.mkv --loop=2
This is because the playloop actually changes the global option value,
assuming it would be reset when going to the next file. When mpv was
changed to not reset options between files, this assumption was broken.
Normally, we always want to enable encoding, as it uses stock ffmpeg
APIs and has no other dependencies or disadvantages.
However, supporting older releases of ffmpeg and Libav (which equal to
outdated git snapshots fix security and crash fixes applied) force us
to disable some advanced ffmpeg API usage, which includes encoding.
This removes the rather complicated configure and Makefile parts
related to auto-detecting available languages for manpages and locales.
We don't have non-English manpages or any locales, so this is
pointless. It didn't even work: configure --language=all created an
invalid config.mak that would cause "make install" to fail.
Remove installation of locales. There are no translations at all which
could be installed. Should there ever be someone who is interested in
adding translations, this can be added back in a simpler way.
Rename the --enable-translation configure option to --enable-gettext.
This is what this option really does: enable gettext() use. This may
be interesting for people who want to experiment with localizing mpv,
but is entirely useless for normal use.
Remove detection of the binary codecs directory in configure.
Put MP_EXPAND_ARGS() in compiler.h, even though it's not compiler
dependent. Both mp_talloc.h and mp_common.h need it, while mp_common.h
includes mp_talloc.h. This is the least annoying solution.
Finish renaming directories and moving files. Adjust all include
statements to make the previous commit compile.
The two commits are separate, because git is bad at tracking renames
and content changes at the same time.
Also take this as an opportunity to remove the separation between
"common" and "mplayer" sources in the Makefile. ("common" used to be
shared between mplayer and mencoder.)
Tis drops the silly lib prefixes, and attempts to organize the tree in
a more logical way. Make the top-level directory less cluttered as
well.
Renames the following directories:
libaf -> audio/filter
libao2 -> audio/out
libvo -> video/out
libmpdemux -> demux
Split libmpcodecs:
vf* -> video/filter
vd*, dec_video.* -> video/decode
mp_image*, img_format*, ... -> video/
ad*, dec_audio.* -> audio/decode
libaf/format.* is moved to audio/ - this is similar to how mp_image.*
is located in video/.
Move most top-level .c/.h files to core. (talloc.c/.h is left on top-
level, because it's external.) Park some of the more annoying files
in compat/. Some of these are relicts from the time mplayer used
ffmpeg internals.
sub/ is not split, because it's too much of a mess (subtitle code is
mixed with OSD display and rendering).
Maybe the organization of core is not ideal: it mixes playback core
(like mplayer.c) and utility helpers (like bstr.c/h). Should the need
arise, the playback core will be moved somewhere else, while core
contains all helper and common code.