Commit Graph

38383 Commits

Author SHA1 Message Date
wm4 8161d45408 gl_video: fix refcounting 2014-06-18 02:13:38 +02:00
wm4 c048b5db02 options: allow adding multiple files with --audio-file
At least 1 person expected that this works this way.
2014-06-18 01:58:05 +02:00
wm4 c48dd85821 sd_lavc: improve bitmap subtitle timing
Until now, bitmap subtitles were decoded at "some" point, and then
simply replaced the old subtitle. Although the subtitle is selected
by time (PTS), it could happen that a subtitle was replaced too early.
One consequence is that this might lead to flicker even if the
subtitles are timed to follow each other without a gap (although most
subtitles are explicitly timed to introduce such a gap). With this
commit the past 4 subtitles are kept (instead of 1), so that the
correct one can be picked by time. This should fix the aforementioned
cases, but more importantly will allow demuxing/decoding and video
display to be somewhat asynchronous.

Still missing: somehow making sure the correct range of decoded
subtitles is available, instead of just passing along whatever comes
from the demuxer, and hoping that 4 queued subtitles are enough. But it
should certainly be good enough for now.

This removes a check that resets the subtitles if the PTS is 5 minutes
before the end of the current subtitle; this is probably not needed.
2014-06-18 01:57:57 +02:00
wm4 a28e2a7432 video: correct spelling: mp_image_params_equals -> mp_image_params_equal
The type is struct mp_image_params, so the "params" should have a "s".
"equals" shouldn't, because it's plural for 2 params. Important.
2014-06-17 23:30:27 +02:00
wm4 efa6b09b65 video: remove redundant function
mp_image_params_from_image() is now trivial and can be removed.
2014-06-17 23:26:53 +02:00
wm4 2827ff1eab DOCS/contribute.md: move instructions for sending patches to the top
Separate to not confuse git history tracking.
2014-06-17 23:18:13 +02:00
wm4 ed1250b080 DOCS: remove coding-style.md to contribute.md
I wonder if this is better. The intention is to make the instructions
for sending patches more visible.
2014-06-17 23:15:39 +02:00
wm4 90cd5aa8c8 vo: make draw_image and vo_queue_image transfer image ownership
Basically a cosmetic change. This is probably more intuitive.
2014-06-17 23:05:50 +02:00
Alessandro Ghedini 84eebc6e4e build: check for 64bit stdatomic.h operations too
This fixes the build on platform where the atomic calls can't be turned into
lock-free instructions and thus need the external libatomic library (e.g. mips).
2014-06-17 22:44:51 +02:00
wm4 8ffef4be92 demux_mkv: add S_DVBSUB
Probably works; untested.
2014-06-17 22:44:27 +02:00
wm4 f76b3f8d19 encode: disable playback framedropping
--framedrop is intended for playback only, and does nothing good with
encoding. It would just randomly drop frames.
2014-06-17 22:44:19 +02:00
wm4 d107cae0e7 video: check image parameters
Make sure every video filter has valid parameters for input and output.
(This also ensures we don't take possibly invalid decoder output, or
feed invalid decodr/filter output to VOs.)

Also, the updated image size check now (almost) works like the
corresponding check in FFmpeg.
2014-06-17 22:44:13 +02:00
wm4 72aac9ae8a video: introduce failure path for image allocations
Until now, failure to allocate image data resulted in a crash (i.e.
abort() was called). This was intentional, because it's pretty silly to
degrade playback, and in almost all situations, the OOM will probably
kill you anyway. (And then there's the standard Linux overcommit
behavior, which also will kill you at some point.)

But I changed my opinion, so here we go. This change does not affect
_all_ memory allocations, just image data. Now in most failure cases,
the output will just be skipped. For video filters, this coincidentally
means that failure is treated as EOF (because the playback core assumes
EOF if nothing comes out of the video filter chain). In other
situations, output might be in some way degraded, like skipping frames,
not scaling OSD, and such.

Functions whose return values changed semantics:

  mp_image_alloc
  mp_image_new_copy
  mp_image_new_ref
  mp_image_make_writeable
  mp_image_setrefp
  mp_image_to_av_frame_and_unref
  mp_image_from_av_frame
  mp_image_new_external_ref
  mp_image_new_custom_ref
  mp_image_pool_make_writeable
  mp_image_pool_get
  mp_image_pool_new_copy
  mp_vdpau_mixed_frame_create
  vf_alloc_out_image
  vf_make_out_image_writeable
  glGetWindowScreenshot
2014-06-17 22:43:43 +02:00
wm4 973c1fa570 gl_lcms: use thread-safe lcms API, require lcms2 2.6
The error log callback was not thread-safe and not library-safe. And
apparently there were some other details that made it not library-safe,
such as a global lcms plugin registry.

Switch the the thread-safe API provided by lcms2 starting with 2.6.
Remove our approximate thread-safety hacks.

Note that lcms basically provides 2 APIs now, the old functions, and
the thread-safe alternatives whose names end with THR. Some functions
don't change, because they already have a context of some sort. Care
must be taken not to accidentally use old APIs.
2014-06-16 18:02:52 +02:00
xylosper 858d6d93cb build: add '--enable-libmpv-static' option
Signed-off-by: wm4 <wm4@nowhere>
2014-06-16 18:02:50 +02:00
wm4 ae1b1a68cb cache: avoid race condition between cache wakeup and idling
When the reader is out of data, it tries to wake up the cache thread to
get more data. In theory, there's a small race condition, which could
cause the cache to miss the wakeup and idle before reaction.

Most certainly didn't cause real issues, because even if this extremely
unlikely race condition happens, the cache won't idle for longer than
1 second (the hardcoded cache idle time).
2014-06-16 01:00:59 +02:00
wm4 eca0fcb77a vo_opengl: simplify redraw callback OSD handling
OSD used to be not thread-safe at all, so a track was used to get it
redrawn. This mostly reverts commit 6a2a8880, because OSD not being
thread-safe was the non-trivial part of it.

Mostly untested, because this code path is used on OSX only, and I don't
have OSX.
2014-06-16 01:00:59 +02:00
wm4 c5e13cce52 discnav: make OSD path explicitly thread-safe
The main issue was actually that the OSD callback locked the subtitle
decoder, which does not necessarily work, because the OSD code is
already allowed to lock it. The state was already protected by
unsetting the callback (which involes the OSD lock). So, in summary,
this is probably just a cleanup.
2014-06-16 01:00:53 +02:00
wm4 c54174b40e sub: prefer ffmpeg microdvd converter over internal one
We certainly don't want to maintain and improve the internal converter,
but we still need the internal one for Libav. (In the Libav case,
demux_subreader.c will be used to read the MicroDVD file.)
2014-06-15 21:10:38 +02:00
wm4 716285782d video/out: change aspects of OSD handling
Let the VOs draw the OSD on their own, instead of making OSD drawing a
separate VO driver call. Further, let it be the VOs responsibility to
request subtitles with the correct PTS. We also basically allow the VO
to request OSD/subtitles at any time.

OSX changes untested.
2014-06-15 20:53:15 +02:00
wm4 d88aca6fb2 vo_vaapi: fix a crash on the init error handling path
No X display or libva can't be initialized -> crash.
2014-06-15 16:58:31 +02:00
Alexander Preisinger 73121dbcc1 wayland: move subsurfaces to wayland vo
Subsurfaces are only used by the wayland vo. Thats why it makes sense to move
all osd and subsurface specific parts to the vo_wayland.c

Also destroy the subsurfaces and subcompositor properly.
2014-06-15 14:46:27 +02:00
Alexander Preisinger f14b45588e wayland: attach NULL surface on osd creation
When using the EGL output the subsurfaces have no buffer attached and the size
seems to be infinite. Fix this by attaching a NULL buffer.

Fixes #846
2014-06-15 14:27:12 +02:00
Amos Onn 8593c4f70b ao_pcm: fix message strings
Signed-off-by: wm4 <wm4@nowhere>
2014-06-15 09:25:15 +02:00
Stefano Pigozzi f645e8921c cocoa: add fallback for automatic GPU switching
Not all the hardware supports kCGLPFASupportsAutomaticGraphicsSwitching
(apparently all Mid-2010 and before MacBooks do not work with it), so fallback
to not asking for this attribute in the GL pixel format.
2014-06-15 08:20:06 +02:00
Stefano Pigozzi 1927f4535c cocoa: allow automatic gpu switching
Fixes #820
2014-06-15 08:19:55 +02:00
Stefano Pigozzi c3d17ece7b cocoa: switch to CGL APIs for GL context creation
CGL APIs are lower level thus giving us better control and more options for
the context creation.
2014-06-15 08:18:48 +02:00
wm4 3a998e5b1e demux: use position as signed integer
Seeing (uint64_t)-1 as value when position was unset was annoying.
2014-06-14 22:18:29 +02:00
wm4 53d762e972 tv: if timestamp is unset, return NOPTS
Well, not sure if this really improves anything, but at least it's less
of a WTF to the playback core than always returning the same timestamp
for every frame.
2014-06-14 22:17:55 +02:00
wm4 dfd93a108c tv: remove some non-sense
There's really no need to convert this to float and then back. This is
mostly of cosmetic nature, double precision was probably enough to avoid
rounding.
2014-06-14 21:29:40 +02:00
wm4 1d920047ab tv: fix compilation without clock_gettime, don't claim to be MPlayer
mp_msg() doesn't exist anymore in this form. Oops.
2014-06-14 21:26:17 +02:00
wm4 63266d4372 sub: add --sub-scale-with-window option
Implements the feature requested in #839 and #186.
2014-06-14 19:17:31 +02:00
wm4 a9fd52e493 gl_w32: remove unused variable 2014-06-14 19:17:25 +02:00
Philip Sequeira a7293b92f4 build: version string as native str type for each Python version
Should resolve the "mpv b'...'" issue on Python 3 without breaking
things on Python 2.

Also, remove redundant wait for process.
2014-06-14 10:11:07 +02:00
wm4 f193d25844 video: cosmetics: reformat image format names table 2014-06-14 10:06:23 +02:00
wm4 a9538e17ad video: synchronize mpv rgb pixel format names with ffmpeg names
This affects packed RGB formats up to 16 bits per pixel. The old mplayer
names used LSB-to-MSB order, while FFmpeg (and some other libraries) use
MSB-to-LSB.

Nothing should change with this commit, i.e. no bit order or endian bugs
should be added or fixed. In some cases, the name stays the same, even
though the byte order changes, e.g. RGB8->BGR8 and BGR8->RGB8, and this
affects the user-visible names too; this might cause confusion.
2014-06-14 10:03:04 +02:00
wm4 6ab72f9760 video: automatically strip "le" and "be" suffix from pixle format names
These suffixes are annoying when they're redundant, so strip them
automatically. On little endian machines, always strip the "le" suffix,
and on big endian machines vice versa (although I don't think anyone
ever tried to run mpv on a big endian machine).

Since pixel format strings are returned by a certain function and we
can't just change static strings, use a trick to pass a stack buffer
transparently. But this also means the string can't be permanently
stored by the caller, so vf_dlopen.c has to be updated. There seems
to be no other case where this is done, though.
2014-06-14 09:58:48 +02:00
Alessandro Ghedini 6842d4bde5 build: fix generation of zsh completion
The Perl script must be run *after* the mpv executable is generated. Also use
an absolute path to it.
2014-06-13 12:27:01 +02:00
wm4 85cd114e54 tv: add missing header for clock_gettime
Not sure how this symbol becomes visible in glibc (probably accidental
or mandatory recursive inclusion via the other standard or Linux-
specific headers), but normally this include file is needed to get the
symbol.
2014-06-13 12:26:32 +02:00
wm4 b7bedbbc36 options: remove some more stuff
The "classic" sub-option stuff is not really needed anymore. The only
remaining use can be emulated in a simpler way. But note that this
breaks the --screenshot option (instead of the "flat" options like
--screenshot-...). This was undocumented and discouraged, so it
shouldn't affect anyone.
2014-06-13 02:18:26 +02:00
wm4 a64e099efc options: remove some unneeded stuff
No options pointing to global variables are in use anymore, so that part
can be removed.
2014-06-13 02:16:47 +02:00
wm4 e00aad18cb command: redo the property type
Instead of absuing m_option to store the property list, introduce a
separate type for properties. m_option is still used to handle data
types. The property declaration itself now never contains the option
type, and instead it's always queried with M_PROPERTY_GET_TYPE. (This
was already done with some properties, now all properties use it.)

This also fixes that the function signatures did not match the function
type with which these functions were called. They were called as:

   int (*)(const m_option_t*, int, void*, void*)

but the actual function signatures were:

   int (*)(m_option_t*, int, void*, MPContext *)

Two arguments were mismatched.

This adds one line per property implementation. With additional the
reordering of the parameters, this makes most of the changes in this
commit.
2014-06-13 02:11:39 +02:00
wm4 6a4a5595d8 options: remove OPT_FLAG_CONSTANTS
This means use of the min/max fields can be dropped for the flag option
type, which makes some things slightly easier. I'm also not sure if the
client API handled the case of flag not being 0 or 1 correctly, and this
change gets rid of this concern.
2014-06-13 02:10:45 +02:00
wm4 09a61ba03a options: remove use of an inverted option value
Now MPOpts.sub_fix_timing corresponds to the commandline switch
directly, instead of storing the inverted value.
2014-06-13 02:06:03 +02:00
wm4 98a31d5937 options: turn --idx, --forceidx into --index
Also clarify the semantics.

It seems --idx didn't do anything. Possibly it used to change how the
now removed legacy demuxers like demux_avi used to behave. Or maybe
it was accidental.

--forceidx basically becomes --index=force. It's possible that new
index modes will be added in the future, so I'm keeping it
extensible, instead of e.g. creating --force-index.
2014-06-13 02:05:37 +02:00
wm4 a7a14be088 vd_lavc: use option parser for skip suboptions 2014-06-13 02:03:45 +02:00
wm4 f3582c4993 input.conf: make ESC quit when encoding 2014-06-13 02:03:14 +02:00
wm4 5fed3a253e demux: use av_malloc for packets
Probably "needed" to get the correct alignment, although I'm not aware
of actual breakages or performance issues.

In fact we should probably always just allocate AVPackets, but for now
use the simple fix.
2014-06-13 02:03:10 +02:00
wm4 7e7ff4b0ea demux: simplify packet resizing
Actually we don't need to resize packets; we just need to make them
shorter.
2014-06-13 02:02:30 +02:00
Rudolf Polzer ee2e91dce1 encode: get rid of the recursion that led to a deadlock.
Instead, the recursive call has been flattened away by instead
overwriting a parameter and continuing.
2014-06-12 11:42:00 +02:00