Commit Graph

688 Commits

Author SHA1 Message Date
wm4 876a3bafc5 osd: cleanup: make OSDTYPE_ constants private to OSD code
No need to have them everywhere. The only exception/annoyance is
MAX_OSD_PARTS, which is now basically duplicated (and at runtime
initialization is checked with an assert()).
2016-03-08 22:01:57 +01:00
wm4 75a36662cb osd, lua: manage multiple ASS overlays set with set_osd_ass() calls
Until now, there was only 1 global ASS overlay that could be set by all
scripts. This was often perceived as bug when multiple scripts tried to
set their own ASS overlay.

This was kind of hard to solve because the script could set its own ASS
PlayResX/Y, which makes it impossible to share a single ASS_Renderer for
multiple scripts. The OSC unfortunately makes use of this feature (and
unfortunately can't be fixed because it's a POS), so we're stuck with
this complication.

Implement the worst-case solution and fix this by creating separate ASS
track and renderer objects for each script that wants to set an ASS
overlay.

The z-order is decided by the order the scripts set their text first.
This is essentially random, unless you do it at script init, and you
pass scripts in a specific order. Script initialization is currently
serialized (as a feature), so the first loaded script gets lowest
Z-order.

The Lua script API interestingly remains the same. (And also will remain
undocumented, unsupported, and potentially volatile.)
2016-03-08 22:00:02 +01:00
wm4 ed254f29a9 osd: restructure and move ASS objects into its own struct
All ASS objects used by the OSD renderer go into struct ass_state.

Preparation for the following commit.
2016-03-08 22:00:02 +01:00
wm4 f5bfe01932 osd: refactor how mp_ass_render_frame() is called
Instead of passing an explicit cache to the function, the res parameter
is used. Also, instead of replacing its contents, sub bitmaps are now
appended to it (all assuming the format doesn't actually change).

This is preparation for the following commits.
2016-03-08 21:59:55 +01:00
wm4 5fa45fb564 osd, lua: remove weird OSD scaling
Do not scale OSD mouse input to the ASS OSD script resolution. The
original idea of this mechanism was that the user doesn't have to care
about the actual resolution of anything, and can just use the OSD
resolution consistently. But this made things worse.

Remove the implicit scaling, and always use the screen resolution.
(Except with --vo=xv, where additional scaling is forced upon
everything.)

Drop get_osd_resolution(). There is no replacement. Rename
get_screen_size() and get_screen_margins() to use "osd" instead of
"screen". For anything but --vo=xv these are equivalent, but with
--vo=xv the OSD resolution has additional implicit scaling.

Add code to osc.lua which emulates the old behavior.

Note that none of the changed functions were public API, so implicit
breakage of scripts which used it is just going to happen.
2016-03-07 22:22:18 +01:00
wm4 b7617f42d8 osd: remove unused osd_coords_to_video()
Used to be used for dvdnav.
2016-03-07 22:20:35 +01:00
wm4 05b2cd08dc sub: make preloading more robust
Subtitles can be preloaded, which means they're fully read and copied
into ASS_Track. This in turn is mainly for the sake of being able to do
subtitle seeking (when it comes down to it, subtitle seeking is the
cause for most trouble here).

Commit a714f8e92 broke preloaded subtitles which have events with
unknown duration, such as some MicroDVD samples. The event list gets
cleared on every seek, so the property of being preloaded obviously gets
lost.

Fix this by moving most of the preloading logic to dec_sub.c. If the
subtitle list gets cleared, they are not considered preloaded anymore,
and the logic for demuxed subtitles is used.

As another minor thing, preloadeding subtitles did neither disable the
demux stream, nor did it discard packets. Thus you could get queue
overflows in theory (harmless, but annoying). Fix this by explicitly
discarding packets in preloaded mode.

In summary, now the only difference between preloaded and normal
demuxing are:
1. a seek is issued, and all packets are read on start
2. during playback, discard the packets instead of feeding them to the
   subtitle decoder

This is still petty annoying. It would be nice if maintaining the
subtitle index (and maybe a subtitle packet cache for instant subtitle
presentation when seeking back) could be maintained in the demuxer
instead. Half of all file formats with interleaved subtitles have
this anyway (mp4, mkv muxed with newer mkvmerge).
2016-03-06 15:17:59 +01:00
wm4 a714f8e928 sd_ass: always clear subtitles on seek if duration unknown
Although there is logic to prune subtitles as soon as they get too old
in this mode, this is not done for the _currently_ shown subtitles. Thus
explicitly clearing subtitles on seek is required to avoid duplicate
subtitles in certain cases when seeking.
2016-03-05 13:08:38 +01:00
wm4 740b7013ba sd_ass: always handle subtitles with unknown duration
Deals with broken mkv subtitle tracks generated by tvheadend. The subs
are srt, but without packet durations.

We need this logic for CCs anyway. CCs in particular will be unaffected
by this change because they are also marked with unknown duration. It
could be that there are actual demuxers outputting CCs - in this case,
we rely on the fact that they don't set a (meaningless) packet duration
(or we'd have to work that around).
2016-03-05 00:16:23 +01:00
wm4 3f60548df4 sub: pass all attachments to the subtitle decoder
Commit 8d4a179c made subtitle decoders pick up fonts strictly from the
same source file (i.e. the same demuxer).

It breaks some fucked up use-case, and 2 people on this earth complained
about the change because of this. Add it back.

This copies all attached fonts on each subtitle init. I considered
converting attachments to use refcounting, but it'd probably be much
more complex.

Since it's slightly harder to get a list of active demuxers with
duplicate removed, the prev_demuxer variable serves as a hack to achieve
almost the same thing, except in weird corner cases. (In which fonts
could be added twice.)
2016-03-03 18:48:56 +01:00
wm4 041c9f1782 lavc_conv: fix Libav srt subtitles
Use the mp_lavc_set_extradata() function instead of setting up the
extradata manually. This takes care of the corner case when
extradata_len is 0.

This apparently fixes #2888.
2016-02-29 18:20:27 +01:00
wm4 da24cb9e3e sub: always clip subtitles against segment end
This happens only if the new segment wasn't read yet.

This is not quite proper and a problem with dec_sub.c internals.
Ideally, it'd wait with rendering until a new enough segment has been
read. Normally, the new segment is available immediately, so the end
will be automatically clipped by switching to the right segment in the
exact moment it's supposed to become effective.

Usually shouldn't cause any problems, though.
2016-02-20 16:42:32 +01:00
wm4 0af5335383 Rewrite ordered chapters and timeline stuff
This uses a different method to piece segments together. The old
approach basically changes to a new file (with a new start offset) any
time a segment ends. This meant waiting for audio/video end on segment
end, and then changing to the new segment all at once. It had a very
weird impact on the playback core, and some things (like truly gapless
segment transitions, or frame backstepping) just didn't work.

The new approach adds the demux_timeline pseudo-demuxer, which presents
an uniform packet stream from the many segments. This is pretty similar
to how ordered chapters are implemented everywhere else. It also reminds
of the FFmpeg concat pseudo-demuxer.

The "pure" version of this approach doesn't work though. Segments can
actually have different codec configurations (different extradata), and
subtitles are most likely broken too. (Subtitles have multiple corner
cases which break the pure stream-concatenation approach completely.)

To counter this, we do two things:
- Reinit the decoder with each segment. We go as far as allowing
  concatenating files with completely different codecs for the sake
  of EDL (which also uses the timeline infrastructure). A "lighter"
  approach would try to make use of decoder mechanism to update e.g.
  the extradata, but that seems fragile.
- Clip decoded data to segment boundaries. This is equivalent to
  normal playback core mechanisms like hr-seek, but now the playback
  core doesn't need to care about these things.

These two mechanisms are equivalent to what happened in the old
implementation, except they don't happen in the playback core anymore.
In other words, the playback core is completely relieved from timeline
implementation details. (Which honestly is exactly what I'm trying to
do here. I don't think ordered chapter behavior deserves improvement,
even if it's bad - but I want to get it out from the playback core.)

There is code duplication between audio and video decoder common code.
This is awful and could be shareable - but this will happen later.

Note that the audio path has some code to clip audio frames for the
purpose of codec preroll/gapless handling, but it's not shared as
sharing it would cause more pain than it would help.
2016-02-15 21:04:07 +01:00
wm4 8aeaa34a5c sub: move sub decoder init to a function
Preparation for timeline rewrite.
2016-02-15 20:26:22 +01:00
wm4 0287736119 sub: remove always-true check
Confuses Coverity with FORWARD_NULL on the mp_err() at the end of the
function. These pointers are never NULL.

Fixes CID 1350059.
2016-02-12 15:58:48 +01:00
wm4 155f7fac9d sub: implement "sub-seek 0"
For bitmap subs, implement it properly. For libass, you need newest git
master.

Fixes #2791.
2016-02-04 22:48:13 +01:00
wm4 8a9b64329c Relicense some non-MPlayer source files to LGPL 2.1 or later
This covers source files which were added in mplayer2 and mpv times
only, and where all code is covered by LGPL relicensing agreements.

There are probably more files to which this applies, but I'm being
conservative here.

A file named ao_sdl.c exists in MPlayer too, but the mpv one is a
complete rewrite, and was added some time after the original ao_sdl.c
was removed. The same applies to vo_sdl.c, for which the SDL2 API is
radically different in addition (MPlayer supports SDL 1.2 only).

common.c contains only code written by me. But common.h is a strange
case: although it originally was named mp_common.h and exists in MPlayer
too, by now it contains only definitions written by uau and me. The
exceptions are the CONTROL_ defines - thus not changing the license of
common.h yet.

codec_tags.c contained once large tables generated from MPlayer's
codecs.conf, but all of these tables were removed.

From demux_playlist.c I'm removing a code fragment from someone who was
not asked; this probably could be done later (see commit 15dccc37).

misc.c is a bit complicated to reason about (it was split off mplayer.c
and thus contains random functions out of this file), but actually all
functions have been added post-MPlayer. Except get_relative_time(),
which was written by uau, but looks similar to 3 different versions of
something similar in each of the Unix/win32/OSX timer source files. I'm
not sure what that means in regards to copyright, so I've just moved it
into another still-GPL source file for now.

screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but
they're all gone.
2016-01-19 18:36:06 +01:00
Aman Gupta f9cefbfec4 vd_lavc: feed A53_CC side data packets into the demuxer for eia_608 decoding 2016-01-18 12:14:52 -08:00
Aman Gupta ed3e5330ec lavc_conv: pass real_time=1 option to ffmpeg for eia_608 decoder 2016-01-18 12:13:42 -08:00
Aman Gupta 1781bf26f1 ass_mp: add mp_ass_flush_old_events() 2016-01-18 12:12:34 -08:00
wm4 0ed170ec0b sub: fix memory leaks
demux_lavf.c leaked the complete subtitle data if it was put through
iconv.

lavc_conv.c leaked AVCodecContext.subtitle_header (set by libavcodec),
which is fixed by using avcodec_free_context(). It also leaked the
subtitle that was decoded last.
2016-01-18 11:46:28 +01:00
wm4 20991a95b8 osd: make osd-width/height properties watchable 2016-01-15 22:54:08 +01:00
wm4 671df54e4d demux: merge sh_video/sh_audio/sh_sub
This is mainly a refactor. I'm hoping it will make some things easier
in the future due to cleanly separating codec metadata and stream
metadata.

Also, declare that the "codec" field can not be NULL anymore. demux.c
will set it to "" if it's NULL when added. This gets rid of a corner
case everything had to handle, but which rarely happened.
2016-01-12 23:48:19 +01:00
Dmitrij D. Czarkoff ea442fa047 mpv_talloc.h: rename from talloc.h
This change helps avoiding conflict with talloc.h from libtalloc.
2016-01-11 21:05:55 +01:00
wm4 0915a8497b sub: read subtitles until their timestamps are past video
Change >= to >, because if the timestamps are equal, further subtitle
packets with the same timestamps could be required (e.g. ASS).
2016-01-11 20:37:16 +01:00
wm4 1f38c2107d sd_ass: fix memory leaks with --sub-ass=no
This affects only the codepath which forcibly disables any ASS tags.
2016-01-04 15:29:29 +01:00
wm4 ad072b17ce sub: do not check for duplicates if --sub-clear-on-seek is set 2015-12-31 16:43:57 +01:00
wm4 b47bf06f97 sub: change how subtitles are read
Slightly change how it is decided when a new packet should be read.
Switch to demux_read_packet_async(), and let the player "wait properly"
until required subtitle packets arrive, instead of blocking everything.
Move distinguishing the cases of passive and active reading into the
demuxer, where it belongs.
2015-12-29 01:35:52 +01:00
wm4 9b3daa4974 sub: remove packet list thing
Just a simplification. This packet list lost its function a dozen of
commits ago or so.
2015-12-28 23:31:23 +01:00
wm4 4c1deb680d sub: do charset conversion in demux_lavf.c
Just so I can remove a few lines from dec_sub.c.

This is slightly inelegant, as the whole subtitle file has to be read
into memory, converted at once in memory, and then provided to
libavformat in an awkward way by creating a memory stream instead of
using demuxer->stream. It also won't be possible to force the charset on
subtitles in binary container formats - but this wasn't exposed before,
and we just hope this won't be ever needed. (One motivation was fixing
broken files with non-UTF8 muxed.) It also won't be possible to change
the charset on the fly, but this was not exposed either.
2015-12-28 23:23:30 +01:00
wm4 d85753b79e sub: refactor initialization
Just simplify by removing parts not needed anymore. This includes
merging dec_sub allocation and initialization (since things making
initialization complicated were removed), or format support queries (it
simply tries to create a decoder, and if that fails, tries the next
one).
2015-12-27 02:13:06 +01:00
wm4 50c379e2d8 sub: minor refactor how video FPS for MicroDVD is set
So that the video FPs is not required at initialization, and can be set
later.

(As for whether this MicroDVD crap is worth the trouble to handle it
"correctly": MicroDVD files are unfortunately still around, and in at
least one case using the video FPS seemed to help indeed.)
2015-12-27 02:13:06 +01:00
wm4 190dea149a sub: destroy/recreate ASS_Renderer when disabling/enablings subs
Keeping ASS_Renderers around for a potentially large number of subtitle
tracks could lead to excessive memory usage, especially since the libass
cache is broken (caches even unneeded data), and might consume up to
~500MB of memory for no reason.
2015-12-26 18:35:36 +01:00
wm4 8d4a179c14 sub: always recreate ASS_Renderer on subtitle decoder reinit
This includes the case of switching ordered chapter boundaries. It will
now be recreated on each timeline part switch. This shouldn't be much of
a problem with modern libass. (Older libass versions use fontconfig for
memory fonts, and will be very slow to reinitialize memory fonts.)
2015-12-26 18:34:18 +01:00
wm4 ce8524cb47 sub: cache subtitle state per track instead of per demuxer stream
Since commit 6d9cb893, subtitle state doesn't survive timeline switches
(ordered chapters etc.). So there is no point in caching the state per
sh_stream anymore (which would be required to deal with multiple
segments). Move the cache to struct track.

(Whether it's worth caching the subtitle state just for the situation
when subtitle tracks get reselected is questionable. But for now, it's
nice to have the subtitles immediately show up when reselecting a
subtitle.)
2015-12-26 18:32:27 +01:00
wm4 6d9cb89333 sub: clear subtitle list when crossing timeline boundary
When crossing timeline boundaries (such as switching to a new segment or
chapter with ordered chapters), clear the internal text subtitle list.
This breaks the sub-seek command, but is otherwise not too harmful.
Fixes Sub-OC-test-final7.mkv. (The internal text subtitle list is
basically a cache to make subtitles show up at the right time when
seeking back.)

I suspect this was caused by 76fcef61. The sample file times subtitles
slightly before the video frame when it should show up. This is to avoid
problems with subtitles showing up a frame later than intended. It also
means that a subtitle which is supposed to show up on the start of a
timeline part boundary actually might first be shown in a different
part. Since we now manipulate the packet timestamps, instead of
manipulating timestamps after the subtitle decoder, this means this
subtitle event would have 2 timestamps, which our code of course does
not handle.

If the two parts come one after another, this would actually work (since
the subtitle would have the same timestamps in the old and new part),
but it breaks if the new part (which follows the old part in the
physical file) is has a completely different start time in the timeline.

Essentially, the trick used to time subtitles correctly is incompatible
with the way we cache subtitles (to make them survive seeks).

The simple solution is just clearing the cached subtitles when crossing
chapter boundaries.
2015-12-25 12:28:01 +01:00
wm4 bbb65ed84b sub: use macros to remove code duplication
Meh.
2015-12-24 17:32:10 +01:00
wm4 30074f8440 sub: merge bitmap render functions into one for each kind
Merge blend_src8_alpha and blend_src16_alpha into blend_src_alpha, and
the same for blend_const_alpha.

One thing that changes is that the vertical loop is now shared for both
code paths.

I think this is slightly easier to read, and it's a bit shorter as well.
2015-12-24 17:24:55 +01:00
wm4 a042dcc700 sub: remove "inaccurate" code path
The "accurate" one always has been enabled, and I can't find much
evidence that the "inaccurate" one is much faster on my particular
machine anyway.
2015-12-24 17:08:02 +01:00
wm4 3973a953df sub: find GBRP format automatically when rendering to RGB
This removes the need to define IMGFMT_GBRAP, which fixes compilation
with the current Libav release.

This also makes it automatically pick up a GBRP format with the same bit
width. (Unfortunately, it seems libswscale does not support conversion
to AV_PIX_FMT_GBRAP16, so our code falls back to 8 bit, removing
precision for video covered by subtitles in cases this code is used.)

Also, when the source video is e.g. 10 bit YUV, upsample to 16 bit.
Whether this is good or bad, it fixes behavior with alpha. Although I'm
not sure if the alpha range is really correct ([0,2^16-1] vs.
[0,255*256]). Keep in mind that libswscale doesn't even agree with the
way we do it.
2015-12-24 16:42:21 +01:00
wm4 6bec6ac558 sub: better alpha blending when rendering to alpha surfaces
This actually treats destination alpha correctly, and gives much better
results than before. I don't know if this is perfectly correct yet,
though. Slight difference with vo_opengl behavior suggests it might not
be.

Note that this does not affect VOs with true alpha support. vo_opengl
does not use this code at all, and does the alpha calculations in OpenGL
instead.
2015-12-24 14:43:23 +01:00
Aman Gupta f8b09658f4 dec_sub: avoid segfault on sub_init_decoder failure
Broken by commit 687b552d.

Signed-off-by: wm4 <wm4@nowhere>
2015-12-22 13:00:05 +01:00
wm4 f1a2610c4f sd_ass: handle --sub-clear-on-seek correctly with non-ASS subs
Converted subtitles use a different method to avoid adding repeated
packets as duplicate subtitle events. The state for this mechanism must
be cleared as well if --sub-clear-on-seek is used.
2015-12-20 10:14:14 +01:00
wm4 c01935986c lavc_conv: fix invalid write
Well shit. Restructure it such that the returned list is always NULL-
terminated with the same mechanism.
2015-12-19 21:21:36 +01:00
wm4 0a0bb9059f video: switch from using display aspect to sample aspect
MPlayer traditionally always used the display aspect ratio, e.g. 16:9,
while FFmpeg uses the sample (aka pixel) aspect ratio.

Both have a bunch of advantages and disadvantages. Actually, it seems
using sample aspect ratio is generally nicer. The main reason for the
change is making mpv closer to how FFmpeg works in order to make life
easier. It's also nice that everything uses integer fractions instead
of floats now (except --video-aspect option/property).

Note that there is at least 1 user-visible change: vf_dsize now does
not set the display size, only the display aspect ratio. This is
because the image_params d_w/d_h fields did not just set the display
aspect, but also the size (except in encoding mode).
2015-12-19 20:45:36 +01:00
wm4 5dd5dc66c1 sub: remove unused video width/height headers
Apparently, this was replaced by the SD_CTRL_SET_VIDEO_PARAMS set
dimensions. But I can't find out when this happened - possibly, these
fields were never used by sd_lavc.c, and only by the (long removed)
MPlayer dvdsub decoder.
2015-12-18 03:59:52 +01:00
wm4 00135a87f0 sub: rename sd_lavc_conv.c to lavc_conv.c
The previous commit turned sd_lavc_conv from a sd_driver to
free-standing functions. Do the rename to reflect this change
separately to avoid confusing git's content tracking. (Or did
git solve this, making separating renames and content changes
unnecessary?)
2015-12-18 03:59:52 +01:00
wm4 687b552db1 sub: remove subtitle filter chain concept
It was stupid. The only thing that still effectively used it was
sd_lavc_conv - all other "filters" were the subtitle decoder/renderers
for text (sd_ass) and bitmap (sd_lavc) subtitles.

While having a subtitle filter chain was interesting (and actually
worked in almost the same way as the audio/video ones), I didn't
manage to use it in a meaningful way, and I couldn't e.g. factor
secondary features like fixing subtitle timing into filters.

Refactor the shit and drop unneeded things as it goes.
2015-12-18 03:52:57 +01:00
wm4 2c7db48195 sub: do not clear subtitle list on seeking
This affects non-ASS text subtitles (those which go through libavcodec's
subtitle converter), which are muxed with video/audio. (Typically srt
subs in mkv.)

The problem is that seeking in the file can send a subtitle packet to
the decoder multiple times. These packets are interlaved with video,
and thus can't be all read when opening the file. Rather, subtitle
packets can essentially be randomly skipped or repeated (by seeking).
Until recently, this was solved by scanning the libass event list for
duplicates. Then our builtin srt-to-ass converter was removed, and
the problem was handled by fully clearing the subtitle list on each
seek.

This resulted in sub-seek not working properly for this type of file.
Since the subtitle list was cleared on seek, it was not possible to
do e.g. sub-seeks to subtitles before the current playback position.

Fix this by not clearing the list, and intead explicitly rejecting
duplicate packets. We use the packet file position was unique ID for
subtitles; this is confirmed working for most file formats (although
it is slightly risky - new demuxers may not necessarily set the file
position to something unique, or at all).

The list of seen packets is sorted, and the lookup uses binary search.
This is to avoid quadratic complexity when subtitles are added in
bulks, such as when opening a text subtitle file.

In some places, the code has to be adjusted to pass through the packet
file position correctly.
2015-12-18 03:52:57 +01:00
wm4 04af005c35 sd_ass: remove dead code
With the FFmpeg subtitle decoder used for _all_ non-ASS text subtitle
format, this code is simply unused now.

Ironically, the FFmpeg subtitle decoder does not handle things correctly
in a bunch of cases. Should it turn out they actually matter, they will
have to hack back.

The extend_event one is a candidate, although even though there were
allegedly files which need it, I couldn't get samples from the user who
originally reported such files. As such, extend_event was only confirmed
to handle trailing events with no (endless) duration like with MicroDVD
and LRC, but FFmpeg "fudges" these anyway, so no special handling is
needed.

This code also had logic to handle seeking with muxed srt subtitles,
which made the sub-seek command work. But this has been broken before
this commit already. Currently, seeking with muxed srt subs will clear
all subtitles, as the broken FFmpeg ASS format output by the libavcodec
subtitle converters does not check for duplicates. Since the subtitles
are all cleared, ass_step_sub() can not work properly and sub-seek can
not seek to already seen subtitles.
2015-12-17 01:17:26 +01:00
wm4 74c11f0c84 sub: detect charset in demuxer
Slightly simpler, and removes the need to pre-read all subtitle packets.

This still does the subtitle charset conversion on the packet level
(instead converting when parsing the file), so in theory this still
could provide a way to change the charset at runtime. But maybe even
this should be removed, as FFmpeg is somewhat likely to get its own
charset detection and conversion mechanism in the future. (Would have
to keep the subtitle file in memory to allow changing the charset on
the fly, I guess.)
2015-12-17 01:17:23 +01:00
wm4 e798cf1ff6 sub: remove sd_srt.c
The FFmpeg subtitle converter does the same. There used to be some
deficiencies in FFmpeg's code, but it seems at least some of them have
been fixed. There also used to be the timestamp issue (see previous
commit messages), but this doesn't matter anymore. So no reason to
keep this code - get rid of it.
2015-12-15 21:05:48 +01:00
wm4 cab942acae sub: remove sd_microdvd.c
This can be dropped for the same reasons as in the previous commits. It
removes MicroDVD conversion support on Libav, although MicroDVD files
couldn't be read in the first place ever since demux_subreader.c was
removed.
2015-12-15 21:05:48 +01:00
wm4 c7985fe5f7 sub: remove sd_lavf_srt.c
This restored timestamps when demuxing srt subtitles in Libav, which
was important for avoiding slightly overlapping subtitles. Since the
way this works was changed, there is no real reason to maintain proper
timestamps anymore on this level - this can be dropped without issues.
2015-12-15 21:05:48 +01:00
wm4 29226e6a99 sub: remove sd_movtext.c
libavcodec's movtext-to-ass converter does the same and has more
features. On Libav, this commit disables mp4 subtitle display.
2015-12-15 21:05:48 +01:00
wm4 45ae0716be csputils: rename "yuv2rgb" functions
They're not necessarily restricted to YUV aka YCbCr.

vo_direct3d.c and demux_disc.c (DVD specific code) changes untested.
2015-12-09 00:23:36 +01:00
wm4 c2d0d7818f csputils: remove obscure int_bits matrix scaling
This has no reason to be there. Put the functionality into another
function instead. While we're at it, also adjust for possible accuracy
issues with high bit depth YUV (matters for rendering subtitles into
screenshots only).
2015-12-09 00:08:00 +01:00
wm4 3d66a5d14e sub: increase gap/overlap fixing threshold to 210ms
Don't ask why.
2015-12-07 23:48:59 +01:00
wm4 970606e491 sd_ass: slightly better heuristic for applying --sub-fix-timing
Fixes a reported sample, that has a sign interrupted by a few frames
(for which --sub-fix-timing would remove the wanted gap).

The list of tags in has_overrides() is taken from libass. It has a
similar function (which even checks whether the tag are within the { }
delimiters). Unfortunately, this function is not public, so we just have
a simpler one which does roughly the same. It doesn't matter that this
function sometimes returns false positives.
2015-12-06 18:22:30 +01:00
wm4 7d7ea72854 sub: another minor simplification 2015-12-06 18:17:14 +01:00
wm4 48ed48f7b8 sub: minor simplifications
The awkward "preprocess" step of putting the subtitles through single
filters before doing something else was made unnecessary by the recent
changes.

(Fun fact: I originally planned to move these extra things, like fixing
subtitle gaps/overlaps, to filters - but this would suffer from various
complications, and moving them to the renderers seems much simpler.)
2015-12-05 23:56:53 +01:00
wm4 94c062d0d2 sub: move subtitle FPS adjustment to sd_ass.c
I feel like it's better there. Note that there is no reduced
functionality, as bitmaps subs (i.e. not handled by sd_ass.c) were never
fully read on init, and thus never went through sub_read_all_packets().

On the other hand, this might lead to confusion, as --sub-fps etc. will
now also affect muxed subtitles (which makes not much sense).
2015-12-05 23:56:28 +01:00
wm4 04934e86dd sub: move --sub-fix-timing handling to renderer
Instead of messing with the subtitle packet timestamps, do it on output.
We work on the libass event list. If there is an unwanted gap or
overlap, we render the timestamp at another position where there is no
gap or overlap.

This is somewhat more robust, and even works with demuxed subs (to some
degree - depends whether the subs are prefected soon enough).

It's active even for native ASS subs. I wonder if this is a problem with
extended type setting. If it is, the heuristic that tries to avoid
interrupting such cases has to be improved.

While it probably would be ideal to do this after the subtitle decoder,
certain aspects are at least currently handled better in this place.
2015-12-05 23:56:07 +01:00
wm4 ff1eaea3e7 sd_lavc: remove small gaps between subtitles
Just like with text subtitles. Move the magic constants to a common
place too.
2015-12-05 23:55:56 +01:00
wm4 9a240dc82e sd_lavc: discard empty subtitles and improve sub_seek behavior
Image subtitles often use a "signaling" packet to set the end time of
the previous subtitle. As far as the libavcodec API is concerned, such
packets decode to empty AVSubtitles. Discard these after the end time of
the previous subtitle has been set.

Keep track of the per-subtitle end time better. This is for the sake of
improving sub_step/sub_seek. Without this, it would seek to the sub
before the previous sub, if the current sub has ended displaying.
2015-12-05 23:55:35 +01:00
wm4 a7cf091519 sd_lavc: implement sub_step/sub_seek
Works roughly the same as the one in sd_ass for text subtitles. While
sub_step is very uninteresting, it comes for free with the support for
sub_seek.

The implementation is taken from ass_step_sub() from libass, with some
modifications
2015-12-05 23:55:22 +01:00
wm4 a2e7642d3c sub: allow feeding bitmap subs in advance
Until now, feeding packets to the decoder in advance was done for text
subtitles only. This was possible because libass buffers all subtitle
data anyway (in ASS_Track). sd_lavc, responsible for bitmap subs, does
not do this. But it can buffer a small number of subtitle frames ahead.
Enable this.

Repurpose the sub_accept_packets_in_advance(). Instead of "can take all
packets" it means "can take 1 packet" now. (The old meaning is still
needed locally in dec_sub.c; keep it there.) It asks the decoder whether
there is place for at least 1 subtitle packet. sd_lavc implements it and
returns true if its internal fixed-size subtitle queue still has a free
slot. (The implementation of this in dec_sub.c isn't entirely clean.
For one, decode_chain() ignores this mechanism, so it's implied that
bitmap subtitles do not use the subtitle filter chain in any advanced
way.)

Also fix 2 bugs in the sd_lavc queue handling. Subtitles must be checked
in reverse, because the first entry will often have endpts==NOPTS, which
would always match. alloc_sub() must cycle the queue buffer, because it
reuses memory allocations (like sub.imgs) by design.
2015-12-05 23:54:00 +01:00
wm4 8bf34950c1 sub: remove unused function, move another one
mp_ass_default_track() was not used by anything anymore (commit 5a89150a
got rid of it). mp_ass_add_default_styles() is used by sd_ass.c only.
2015-11-29 17:55:02 +01:00
wm4 2b990ac810 osd: fix and cleanup font style management
Commit 2b07d3eb merged progbar and OSD text renderer into one ASS_Track,
but it confused the styles. Specifically, if both progbar and OSD are
visible, the create_ass_track() call made by the progbar code will reset
the style adjusted by the OSD text code.

Change create_ass_track() not to add any styles. Instead let the caller
manage the styles. They are now referenced by name, and lazily added if
they don't exist yet. This is also much cleaner.
2015-11-29 17:55:02 +01:00
wm4 2b07d3eb47 osd: use the same ASS_Renderer for OSD text and progbar
Reduces memory usage and startup times. The implementation is a bit
weird, because both OSD parts have conflicting requirements on the used
ASS styles.
2015-11-28 19:24:31 +01:00
wm4 d2efa56d48 sd_ass: fix secondary subtitle mode
If a second subtitle is shown, it should be forced to display on top
of the screen. This was working only if --no-ass was passed, because
otherwise the subtitle was rendered normally (i.e. usually on the
bottom).
2015-11-22 22:06:56 +01:00
wm4 5a89150a46 player: remove OSD subtitle render path
This was used with --no-sub-ass (aka --no-ass). This option (which is
not yet removed) strips all styling from the subtitles, and renders them
as plaintext only. For some reason, it originally seemed convenient to
reuse all the OSD text rendering code (osd_libass.c). While this was
indeed simple, it had a bad influence on the rest of the code. For
example, it had to decide whether to go through the OSD code path, or
the proper subtitle renderer in sd_ass.c.

Kill the OSD subtitle renderer. Reimplement --no-sub-ass and also
"secondary" subtitles in sd_ass.c. fill_plaintext() contains some rather
minor code duplication with osd_libass.c for setting up a dummy
ASS_Event and escaping the stripped text. Since sd_ass.c already has to
handle "normal" text subtitles, and has code for stripping ASS tags,
this remains all relatively simple.

Remove all the unnecessary crap from the rest of the code.
2015-11-17 01:56:23 +01:00
wm4 85450d06a1 player: use demuxer ts offset to simplify timeline ts handling
Use the demux_set_ts_offset() added in the previous commit to base each
timeline segment to use timestamps according to its relative position
within the overall timeline. As a consequence we don't need to care
about these timestamps anymore, and everything becomes simpler.

(Another minor but delicious nugget of sanity.)
2015-11-16 23:17:33 +01:00
wm4 05be95c8ce sub: remove an unneeded old hack for MicroDVD
This happens to be handled in a better way in another place now.
2015-11-16 16:23:28 +01:00
wm4 cf18922d19 sub: remove use of semi-deprecated libass field
In newer libass version, this does nothing, and will be removed on the
next API/ABI bump.
2015-10-28 23:49:13 +01:00
wm4 3c081dfd93 Replace deprecated av_free_packet() calls
av_free_packet() got finally deprecated. Use av_packet_unref() instead,
which has almost the same semantics, has existed for a while, and is
available in all FFmpeg and Libav versions we support.
2015-10-28 23:48:56 +01:00
wm4 d1a46c2c32 options: remove --use-text-osd 2015-10-24 19:09:35 +02:00
wm4 252dcdcc99 sd_lavc: take care of AVPicture deprecation 2015-10-23 20:14:08 +02:00
wm4 dd08018e9e sub: adjust behavior on mismatching video/subtitle aspect mismatch
If the aspect ratio of the video resolution and the subtitle resolution
(the implied subtitle coordinate system) mismatch, the subtitles
obviously can't be overlayed over the video perfectly. Either you get
video that can't be covered by subtitles, or the subtitles could go
beyond the video. We don't want to stretch the subtitle to compensate
for the aspect ratio, because it would look terrible.

Until now, mpv used to fit the subtitle rectangle into the video
rectangle (letterboxing/pillarboxing). This looks odd with some sample
files with subtitle canvas being wider than the video. Also, mpc-hc
displays them in a better way. vlc stretches them, which looks bad.
While you probably can't win this game with all those broken files
around, pick the mpc-hc method to handle this.
2015-10-21 23:07:39 +02:00
wm4 1a1ac76d2a sd_lavc: extend subtitle resolution if images go outside
Helps with broken vobsubs, which have an incorrect resolution header
set.

So we just extend the subtitle resolution to the video size, if the
video size is larger. This helps somewhat with readability, or makes
them visible at all. It should be a pretty safe change, because normally
no sub pictures are supposed to go outside of the area. It should make a
difference with broken files only.

The sample in question had a video resolution of 1888x1072, and a
subtitle resolution of 720x480. Note that always using video resolution
as subtitle resolution would break other files.
2015-10-21 21:33:02 +02:00
wm4 b4491c00c4 Take care of libavcodec convergence_duration deprecation
This AVPacket field was a hack against the fact that the duration field
was merely an int (too small for things like subtitle durations). Newer
libavcodec drops this field and makes duration 64 bit.
2015-09-29 18:43:28 +02:00
wm4 8782354e6d player: rename and move find_subfiles.c
This was in sub/, because the code used to be specific to subtitles. It
was extended to automatically load external audio files too, and moving
the file and renaming it was long overdue.
2015-09-20 18:05:06 +02:00
wm4 f287ccf017 player: add opus to list of external audio file extensions
Fixes #2336.
2015-09-20 18:00:21 +02:00
wm4 7c73f70b89 osd: delay libass initialization as far as possible
Until now, most OSD objects created the associated ASS_Renderer instance
as soon as possible, even if nothing was going to be rendered. Maybe
this was even intentional.

Change this for the sake of lowering resource usage, and strictly
initialize ASS_Renderer only when it's really needed.

For the OSC, initialization has to be forced, because of the insane
mechanism for translating mouse coordinates to OSD coordinates.
2015-09-07 14:26:01 +02:00
wm4 eabc530945 sub: always try to use libavcodec text subtitle converter
Drop the whitelist. It's annoying to maintain. Instead, accept any
subtitle decoder. Since this code path will now also be taken by bitmap
subtitle decoders not whitelisted by sd_lavc.c, add a warning when
bitmap subtitles are decoded. (To reduce or increase potential user
confusion.)

To some degree, a whitelist is needed to distinguish text and bitmap
subtitles. FFmpeg has an API to distinguish them in a generic way to
some degree, but Libav doesn't. So we just stick with this for now.
2015-09-01 23:48:14 +02:00
wm4 c61675320b sd_ass: assume negative durations are unknown durations, and handle them
The FFmpeg can officially not distinguish between unknown subtitle
durations, and subtitle durations being 0. (It documents the value 0
meaning unknown duration.)

In practice, at least the LRC demuxer signals unknown subtitle durations
with a negative value.

Assume negative durations mean unknown duration. Show subtitles with
unknown duration forever. Unless there's a subtitle event following it;
then reset the duration so that it ends on the new subtitle event.

Fixes #2244.
2015-08-27 23:45:02 +02:00
wm4 f792f56440 player: remove higher-level remains of DVD/BD menu support
Nobody wanted to restore this, so it gets the boot.

If anyone still wants to volunteer to restore menu support, this would
be welcome. (I might even try it myself if I feel masochistic and like
wasting a lot of time for nothing.) But if it does get restored, it
should be done differently. There were many stupid things about how it
was done. For example, it somehow tried to pull mp_nav_events through
all the layers (including needing to "buffer" them in the demuxer),
which was needlessly complicated. It could be done simpler.

This code was already inactive, so this commit actually changes nothing.
Also keep in mind that normal DVD/BD playback still works.
2015-08-03 23:49:14 +02:00
wm4 11f2be2bcc charset_conv: make it possible to return an allocated string as guess
uchardet is written in C++, and thus doesn't appreciate the value of
using static strings, and internally stores the guessed charset as
allocated std::string. Add a minimal hack to deal with this. (I don't
appreciate that the code is potentially harder to understand by
returning either a static or allocated string, but I do appreciate for
not having to litter the existing code with strdups.)
2015-08-01 23:49:37 +02:00
wm4 57043d9269 sub: add option for stretching image subtitles to screen
Probably makes users happy who want bitmap subtitles to show up in the
screen margins, and stops them from doing idiotic crap with vf_expand.

Fixes #2098.
2015-07-18 14:36:17 +02:00
wm4 daf32e2d2d sub: fix srt subs and other cases
Oops.
2015-07-07 01:26:26 +02:00
wm4 385febe276 sub: protect ASS_Renderer state
Each subtitle track gets its own decoder instance (sd_ass). But they use
a shared ASS_Renderer. This is done mainly because of fontconfig.
Initializing fontconfig is very slow when using it with memory fonts, so
there's a practical need to cache this memory font state, which is done
by not creating separate ASS_Renderers. This is very dirty and very
evil, but we probably can't get rid of it any time soon.

The shared ASS_Renderer was not properly synchronized. While the program
logic guarantees that only one sd_ass instance is visible at a time,
there are other interactions that require synchronization. In
particular, I suspect concurrent execution of mp_ass_configure_fonts()
and sd_ass.get_bitmaps cause issues in a newer libass development
branch.

So here's a shitty hack that hopefully fixes things, hopefully only
until libass becomes less dependent on fontconfig.
2015-07-06 21:55:37 +02:00
wm4 be882175d8 demux: merge extradata fields
MPlayer traditionally had completely separate sh_ structs for
audio/video/subs, without a good way to share fields. This meant that
fields shared across all these headers had to be duplicated. This commit
deduplicates essentially the last remaining duplicated fields.
2015-06-21 18:06:14 +02:00
wm4 ae46833836 player: use an array for stream ID options and such
This makes the code slightly more generic.
2015-05-22 21:00:24 +02:00
wm4 21cb1f7075 sub: add .sup file extension for subtitle autoloading 2015-05-18 10:28:01 +02:00
wm4 04c02796bd path: make mp_path_join accept normal C strings
Instead of bstr. Most callers of this function do not need bstr. The
bstr version of this function is now mp_path_join_bstr().
2015-05-09 15:26:47 +02:00
Marcin Kurczewski f43017bfe9 Update license headers
Signed-off-by: wm4 <wm4@nowhere>
2015-04-13 12:10:01 +02:00
wm4 37a71e57d4 mp_image: remove redundant flags field
Because gcc (and clang) is a goddamn PITA and unnecessarily warns if
the universal initializer for structs is used (like mp_image x = {})
and the first member of the struct is also a struct, move the w/h
fields to the top.
2015-04-10 21:06:25 +02:00
wm4 41151122e7 mp_image: remove redundant chroma_x/y_shift fields 2015-04-10 21:02:16 +02:00
wm4 be259be15c mp_image: get rid of chroma_width/height fields
They are redundant. They were used by draw_bmp.c only, and only in a
special code path that 1. used fixed image formats, and 2. had image
sized perfectly aligned to chroma boundaries (so computing the chroma
width/height is trivial).
2015-04-09 21:11:20 +02:00
wm4 7a65c44922 sub: don't truncate timestamps to int
Realistically probably no problem at all since they're in ms and usually
start from 0, but whatever.
2015-04-08 22:19:51 +02:00
wm4 78fe1d3a2c sub: unprefer libavcodec's MicroDVD converter
Prefer the builtin one again. libavcodec still uses the ASS packet
format that uses inline timestamps, so the packet timestamps are
ignored. This again leads to additional rounding of timestamps, because
the ASS storage format only has 10ms resolution (instead of 1ms
resolution like libass). This again can lead to unintentional overlaps
when converting subtitles. The internal MicroDVD converter avoids this,
because it always uses packet timestamps.
2015-04-08 22:18:20 +02:00
wm4 19f56e2097 player: load .ac3 files as external files
Fixes #1759.
2015-04-02 23:15:12 +02:00
wm4 f9db94ab71 sub: add --sub-text-bold option
This was basically requested.
2015-04-01 22:58:12 +02:00
wm4 27715b7dd1 video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format.
They are rather obscure and not needed often, so it's better to get them
out of the way. In particular, this gets rid of the semi-complicated
logic in command.c (most of which was needed for OSD display and the
direct feedback from the VO). It removes the duplicated color-related
name mappings.

This removes the ability to write the colormatrix and related
properties. Since filters can be changed at runtime, there's no loss of
functionality, except that you can't cycle automatically through the
color constants anymore (but who needs to do this).

This also changes the type of the mp_csp_names and related variables, so
they can directly be used with OPT_CHOICE. This probably ended up a bit
awkward, for the sake of not adding a new option type which would have
used the previous format.
2015-03-31 00:09:03 +02:00
Niklas Haas 8c43e12b20 vo_opengl: draw subtitles directly onto the video
This has a number of user-visible changes:

1. A new flag blend-subtitles (default on for opengl-hq) to control this
   behavior.

2. The OSD itself will not be color managed or affected by
   gamma controls. To get subtitle CMS/gamma, blend-subtitles must be
   used.

3. When enabled, this will make subtitles be cleanly interpolated by
   :interpolation, and also dithered etc. (just like the normal output).

Signed-off-by: wm4 <wm4@nowhere>
2015-03-26 00:04:03 +01:00
wm4 5f2a8474ae video: uninline memcpy_pic functions
There's literally no reason why these functions have to be inline (they
might be performance critical, but then the function call overhead isn't
going to matter at all).

Uninline them and move them to mp_image.c. Drop the header file and fix
all uses of it.
2015-03-20 00:21:23 +01:00
wm4 51befc9deb osd: simplify an aspect of change detection handling
There was a somewhat obscure optimization in the OSD and subtitle
rendering path: if only the position of the sub-images changed, and not
the actual image data, uploading of the image data could be skipped. In
theory, this could speed up things like scrolling subtitles.

But it turns out that even in the rare cases subtitles have such scrolls
or axis-aligned movement, modern libass rarely signals this kind of
change. Possibly this is because of sub-pixel handling and such, which
break this.

As such, it's a worthless optimization and just introduces additional
complexity and subtle bugs (especially in cases libass does the
opposite: incorrectly signaling a position change only, which happened
before). Remove this optimization, and rename bitmap_pos_id to
change_id.
2015-03-18 13:15:20 +01:00
wm4 b3401e8972 sub: this isn't needed either 2015-03-03 15:19:33 +01:00
wm4 97940e0f48 sd_lavc: remove mp4 vobsub extradata hack
The proper fix is now available in all supported FFmpeg and Libav
releases.
2015-03-03 12:30:35 +01:00
wm4 eb0db4d6fd sd_ass: replace a deprecated libass API call 2015-02-25 16:48:01 +01:00
wm4 dbc5d7b7db sub: fully update plaintext subtitle styles at runtime
Update options like --sub-text-margin-y at runtime. These are somewhat
of a problem, because ass_set_selective_style_override() (intentionally)
does not override them. This should be fixed in libass (by providing
additional override modes), but for now this will do.

Also change the signature of mp_ass_configure(), so we can get access to
the track.

Additionally, drop the redundant setting of the style Alignment (it's
overwritten by mp_ass_set_style()).

See #1622 (again).
2015-02-24 16:17:10 +01:00
wm4 71cc322f13 sub: move mp_ass_configure() code
sd_ass.c is the only user, and the function is starting to become
extremely "special". No other changes.
2015-02-24 15:49:26 +01:00
wm4 53641a689d osd: force alignment for OSD bar
Overwrite the alignment applied by the OSD style. Additionally, remove
the initialization of the Alignment field in create_ass_track(); the
value is always overwritten by mp_ass_set_style() later.

Fixes #1626.
2015-02-24 14:40:06 +01:00
wm4 9fbcb56bee osd: always reset style params
There was some logic to set certain things on init only. Not sure why
this was done (saving some cheap calculations?) - but since the next
call would override these style settings by applying the usual subtitle
style, I don't think this was intended.
2015-02-24 14:36:14 +01:00
wm4 b629da9a40 sub: apply text subtitle style overrides more eagerly
Basically abuse the style override mechanism meant for ASS
(mp_ass_set_style()) to update text subtitle styling at runtime too.
This even has the advantage that the style will be overridden, even if
the text subtitle converted (like sd_lavc_conv.c) dares to add a fixed
style in the styles section.

Probably helps with #1622.
2015-02-24 11:39:25 +01:00
Ben Boeckel a0894974ff libass: remove redundant checks for LIBASS_VERSION
Since 0.12.1 is the minimum, just assume it in the code too.
2015-02-24 10:45:10 +01:00
Jaime Marquínez Ferrándiz aa98049877 find_subfiles: Add 'vtt' to subtitle extensions 2015-02-18 21:12:55 +01:00
wm4 2308b3a2a6 sub: mess with styling defaults, change --ass-use-margins behavior
Now --ass-use-margins doesn't apply to normal subtitles anymore. This is
probably the inverse from the mpv behavior users expected so far, and
thus a breaking change, so rename the option, that the user at least has
a chance to lookup the option and decide whether the new behavior is
wanted or not.

The basic idea here is:
- plain text subtitles should have a certain useful defalt behavior,
  like actually using margins
- ASS subtitles should never be broken by default
- ASS subtitles should look and behave like plaintext subtitles if
  the --ass-style-override=force option is used

This also subtly changes --sub-scale-with-window and adds the --ass-
scale-with-window option. Since this one isn't so important, don't
bother with compatibility.
2015-02-16 20:04:29 +01:00
wm4 14a24f35bf osd: customizable subtitle and OSD position
You can set in which "corner" the OSD and subtitles are shown. I'd
prefer it a bit more general (so you could set the alignment using
a factor), but the libass API does not provide this.
2015-02-16 20:04:02 +01:00
wm4 4c283d5f8d osd: make it possible to have different subtitle vs. OSD defaults
Until now, they used exactly the same defaults for the styling options.
The defaults were shared, so it was impossible to have different
defaults. Change this. This requires duplicating the full default
struct, even for settings that are the same. The list of options is
still shared, though.
2015-02-16 20:03:56 +01:00
wm4 545a0e59df sd_ass: fix some corner cases in tag stripping
This behavior is implied by VSFilter.
2015-02-12 12:19:39 +01:00
wm4 c07e046bfa player: add external audio file auto-loading
Apparently some people want this. Not enabled by default.

Fixes #967.
2015-02-02 21:23:12 +01:00
Ben Boeckel 2bbad06bfc ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAIL
The macro actually returns the *available* space in the array, not how
much is actually filled in.
2015-01-27 18:09:36 +01:00
wm4 64e86b5b4d sd_lavc: apply fallback to video resolution only for vobsubs
Commit 87c13de6 added a fallback to video resolution if the subtitle
resolution is unknown. Apparently this fixed some broken files with
vobsubs.

This broke some DVB subtitles. Apparently .ts captures with 1920x1080
video resolution and 720x576 subtitles do exist. The sample at hand had
some streams with 720x576 resolution and no sub resolution set, and some
streams with 1920x1080 resolution and sub resolution set (both against
the same 1920x1080 video). My conclusion is that 720x576 is the only
reasonable fallback for DVB (but I can't be sure).

The fallback is removed for PGS too. I don't know about the PGS case; it
seems the sub resolution must always be set, so it shouldn't matter.

Fixes #1425.
2015-01-06 18:05:20 +01:00
wm4 d42d60bc1e csputils: replace float[3][4] with a struct
Not being able to use the 3x3 part of the matrix was annoying, so split
it into a float[3][3] matrix and a separate float[3] constant vector.
2015-01-06 16:51:06 +01:00
wm4 5410a5b2c5 csputils: move image_params -> csp_params into a function
Although the line count increases, this is better for making sure
everything is handled consistently for all users of the mp_csp_params
stuff.

This also makes sure mp_csp_params is always initialized with
MP_CSP_PARAMS_DEFAULTS (for consistency).
2015-01-06 16:51:02 +01:00
wm4 a52ca8a2b0 csputils: get rid of mp_csp_details
It used to be central, but now it's just unneeded.
2015-01-06 16:50:58 +01:00
wm4 067bb9605c sub: add option to not scale subtitles with window
--sub-scale-by-window=no attempts to keep subs always at the same pixel
size.

The implementation is a bit all over the place, because it compensates
already done scaling by an inverse scale factor, but it will probably do
its job.

Fixes #1424. (The semantics and name of --sub-scale-with-window are
kept, and this adds a new option - the name is confusingly similar, but
it's actually analogue to --osd-scale-by-window.)
2015-01-05 19:18:08 +01:00
wm4 bdae2f8fa8 sd_lavc: ignore image subtitles with unknown duration after 1 minute
Most image subtitle formats implicitly terminate the current subtitle
event with the next event (e.g. a new packet read from the demuxer will
instruct the subtitle render to stop display). If the subtitle event is
just trailing, it will be displayed forever. So there's no proper way
of doing this and we just apply an heuristic to avoid annoyances.
2014-12-22 00:00:18 +01:00
wm4 1e3400e353 sd_lavc: compensate for a stupid libavcodec API issue
The libavcodec PGS decoder sets end_display_time to UINT32_MAX, in an
attempt to signal unknown end time (the API does not allow to signal
this properly, and this was a backwards compatible hack).

While we have no issues with the large value, our code wants to
distinguish between known and unknown end time explicitly.
2014-12-21 23:58:09 +01:00
wm4 26190dbe57 player: add option not to use OSD/fontconfig
Makeshift-solution for working around certain fontconfig issues.

With --use-text-osd=no, libass and fontconfig won't be initialized, and
fontconfig won't block everything with scanning for fonts.
2014-11-25 11:08:25 +01:00
wm4 9a724f62ce draw_bmp: make code more obvious, remove assertion
Silences a Coverity warning.

Also, drop the assert(); although it should be pretty much guaranteed
that things happen this way, it's still a bit fuzzy.
2014-11-21 05:56:55 +01:00
wm4 e36f4b6bc1 sub: load .mks files as external subtitles 2014-11-06 00:18:58 +01:00
wm4 3f3a6b13bd sub: remove osd_get_sub()
Trades one strange thing against another, but seems slightly less
strange.
2014-11-01 00:02:01 +01:00
Martin Herkt 6f958be325 osd: slightly change default style
Wider vertical margins, slightly thicker border and larger font
size should be an improvement.
2014-10-23 14:33:11 +02:00
wm4 bcc3d72995 sd_lavc: strictly letter-box PGS subtitles
Getting subtitle scaling and positioning right even if there are video
filters, which completely change the image (like cropping), doesn't seem
to have a single, correct solution. To some degree, the results are
arbitrary, so we may as well do what is most useful to the user.

In this case, if the PGS resolution aspect ratio and the video output
aspect ratio mismatch, letter-box it, instead of stretching the subs
over the video frame. (This will require additional fixes, should it
turn out that there are PGS subtitles which are stretched by design.)

Fixes #1205.
2014-10-21 11:37:32 +02:00
wm4 41b2927f39 sub: adjustments to --ass-style-override option
Now requires newest libass git. Since this feature wasn't part of a
libass release yet, I'm not bothering making the mpv code compatible
with as how it was previously implemented (it will just be disabled
with any older libass).

CC: @mpv-player/stable (because mpv-build uses libass git, and this
                        breaks the feature)
2014-10-17 02:06:08 +02:00
wm4 bf382270f2 osd: properly redraw external overlays when they are set 2014-10-14 18:33:31 +02:00
wm4 26bc6b4831 Add some missing "const"s
The one in msg.c was mistakenly removed with commit e99a37f6.

I didn't actually test the change in ao_sndio.c (but obviously "ap"
shouldn't be static).
2014-10-10 13:44:08 +02:00
wm4 2064fc2990 sub: round scaled subtitles
Simple fix for issue #1137.

Since all sub-bitmaps are packed on a larger texture, there's still a
"fall off" on the border due to the linear scaling. This could be
fixed by constraining each sub-bitmap to its own texture, or by
clamping on the shader level, but I don't care for now.
2014-10-02 00:06:08 +02:00
wm4 6c3d25e6f5 command: allow using ASS tags on OSD messages
We don't allow this by default, because it would be silly if random
external data (like filenames or file tags) could accidentally trigger
them.

Add a property that magically disables this ASS tag escaping.

Note that malicious input could still disable ASS tag escaping by
itself. This would be annoying but harmless.
2014-09-18 00:49:55 +02:00
wm4 caaeb15318 demux: gracefully handle packet allocation failures
Now the packet allocation functions can fail.
2014-09-16 18:11:00 +02:00
Ben Boeckel 9bfa38add6 img_convert: sanitizer: avoid invalid left-shifts
(a << 24) is not in the valid int range when a is 255, so use an
unsigned instead.

Signed-off-by: wm4 <wm4@nowhere>
2014-09-14 21:10:09 +02:00
Ben Boeckel 3f6212cd8d sanitizer: avoid divide-by-zero instances
Merges pull request #1094, with some minor changes. mpv expects IEEE,
and IEEE allows divisions by 0 for floats, so these shouldn't actually
be a problem, but do it anyway for the sake of clang.

Signed-off-by: wm4 <wm4@nowhere>
2014-09-14 21:07:30 +02:00
wm4 197f18402e sub: fix possible deadlock with --no-sub-ass and similar
This is a deadlock caused by a lock order issue: sub/osd.c locks the OSD
first, then the subtitle decoder lock. player/sub.c does the reverse.

Fix this by discussing away the requirement for locking (see below),
which allows us to drop the broken sub lock. sub_get_text() still
acquires and releases the sub decoder lock, but it's not held at the
same time as the OSD lock anymore, so it should be fine.

Originally, the sub lock was acquired because sub_get_text() returns a
pointer to a mutable string. We simply declare that it's ok to call it
unlocked, as long as only 1 thread accesses it, which works out fine in
this case.
2014-09-06 00:16:15 +02:00
wm4 68ff8a0484 Move compat/ and bstr/ directory contents somewhere else
bstr.c doesn't really deserve its own directory, and compat had just
a few files, most of which may as well be in osdep. There isn't really
any justification for these extra directories, so get rid of them.

The compat/libav.h was empty - just delete it. We changed our approach
to API compatibility, and will likely not need it anymore.
2014-08-29 12:31:52 +02:00
wm4 2c114db2f1 sd_lavc: remove ineffective code
It makes no sense to set the packet duration, because libavcodec doesn't
know the timebase. And in fact, no subtitle decoder accesses the packet
duration, except text subtitle converters, which are not relevant here.
So this code did nothing - drop it.

Also fix a blatantly incorrect comment.
2014-08-24 12:26:34 +02:00
ChrisK2 03f97e4cae osd+osc: Add left-arrow to osd-font
For use as playlist navigation button in OSC, now the osd-font
carries all symbols needed by the OSC.
2014-08-21 18:45:41 +02:00
wm4 d5940fabcd sub: add option to workaround broken mkv files
See additions to options.rst.
2014-08-14 23:59:35 +02:00
wm4 498644afaf sub: call sub_reset() on seeks only
sub_reset() was called on cycling subtitle tracks and on seeking. Since
we don't want that subtitles disppear on cycling, sd_lavc.c didn't clear
its internal subtitle queue on reset, which meant that seeking with PGS
subtitles could leave the subtitle on screen (PGS subtitles usually
don't have a duration set).

Call it only on seeking, so we can also strictly clear the subtitle
queue in sd_lavc.

(This still can go very wrong if you disable a subtitle, seek, and
enable it again - for example, if used with libavformat that uses "SSA"
style demuxed ASS subtitle packets. That shouldn't happen with newer
libavformat versions, and the user can "correct" it anyway by executing
a seek while the subtitle is selected.)
2014-08-14 23:53:53 +02:00
wm4 8f8d524112 ass: remove some pointless ifdeffery
This will print compiler warnings about unused variables with older
libass versions, but that's harmless.
2014-07-22 20:49:01 +02:00
wm4 23a7257cca Revert "Remove DVD and Bluray support"
This reverts commit 4b93210e0c.

*shrug*
2014-07-15 01:49:02 +02:00
wm4 4b93210e0c Remove DVD and Bluray support
It never worked well. Just remux your DVD and BD images to mkv.
2014-07-14 14:34:14 +02:00
wm4 f8c2dd1b78 build: include <strings.h> for strcasecmp()
It happens to work without strings.h on glibc or with _GNU_SOURCE, but
the POSIX standard requires including <strings.h>.

Hopefully fixes OSX build.
2014-07-10 08:29:32 +02:00
wm4 9a210ca2d5 Audit and replace all ctype.h uses
Something like "char *s = ...; isdigit(s[0]);" triggers undefined
behavior, because char can be signed, and thus s[0] can be a negative
value. The is*() functions require unsigned char _or_ EOF. EOF is a
special value outside of unsigned char range, thus the argument to the
is*() functions can't be a char.

This undefined behavior can actually trigger crashes if the
implementation of these functions e.g. uses lookup tables, which are
then indexed with out-of-range values.

Replace all <ctype.h> uses with our own custom mp_is*() functions added
with misc/ctype.h. As a bonus, these functions are locale-independent.
(Although currently, we _require_ C locale for other reasons.)
2014-07-01 23:11:08 +02:00
Kenneth Zhou cb250d490c Basic xdg directory implementation
Search $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS for config files.
This also negates the need to have separate user and global variants of
mp_find_config_file()

Closes #864, #109.

Signed-off-by: wm4 <wm4@nowhere>
2014-06-26 19:37:25 +02:00
wm4 0a55ee400a sd_lavc: fix stupidity
Reallocating an array while you still have pointers to it -> bad idea.

Recent regression.
2014-06-19 18:49:46 +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 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 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 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 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 99f5fef0ea Add more const
While I'm not very fond of "const", it's important for declarations
(it decides whether a symbol is emitted in a read-only or read/write
section). Fix all these cases, so we have writeable global data only
when we really need.
2014-06-11 00:39:14 +02:00
ChrisK2 9420eb5a07 osd: Center the volume icon in the osd font 2014-06-10 02:16:46 +02:00
wm4 b4c1699aaf sub: remove old style override option
Didn't work too well.
2014-06-05 01:10:48 +02:00
wm4 015399f696 sub: add --ass-style-override=force option
(The old "force" choice of that option is renamed to "force-default".)

This allows overriding native ASS script subtitle styles with the style
provided by the --sub-text-* options (like --sub-text-font etc.). This
is disabled by default, and needs to be explicitly enabled with the
--ass-style-override=force option and input property.

This uses in fact exactly the same options (--sub-text-*) and semantics
as the ones used to configure unstyled text subtitles.

It's recommended to combine this with this in the mpv config file:

ass-force-style="ScaledBorderAndShadow=1"   # work around dumb libass behavior

Also, adding a key binding to toggle this behavior should be added,
because overriding can easily break:

L cycle ass-style-override

This would cycle override behavior on Shift+L and allows quickly
disabling/enabling style overrides.

Note: ASS should be considered a vector format rather than a subtitle
format. There is no easy or reliable way to determine whether the style
of a given subtitle event can be changed without destroying visuals or
not. This patch relies on a simple heuristic, which often works and
often breaks.
2014-06-05 01:10:37 +02:00
wm4 c56520f232 osd/libass: use BorderStyle=4 for background
Avoids (some) overlaps. Hopefully fixes #822.
2014-06-01 23:53:24 +02:00
wm4 3075ea01db sub: fix undefined behavior in ASS color calculation (2)
Same problem as previous commit, fix by using the MP_ASS_RGBA() macro.
2014-05-10 10:44:16 +02:00
wm4 485d033b5f sub: fix undefined behavior in ASS color calculation
This might shift bits into the sign, which is undefined behavior. Making
the right operand unsigned was supposed to help with this, but it seems
it did nothing, and C99 makes the result type dependent on the left
operand only.
2014-05-10 10:44:16 +02:00
wm4 94441ed139 options: merge ---sub-auto-match with --sub-auto
There's no reason why these should be separate.
2014-05-04 10:31:24 +02:00
wm4 75d7d87e1b osd: make code C99
This used an unnamed union, which is allowed in GNU C and C11, but not
C99. This broke the build with some older compilers.

Replaces pull request #744.
2014-04-26 16:04:09 +02:00
wm4 5e4e248dc2 video: make mp_image use mp_image_params directly
Minor cleanup, so that we can stuff more information into
mp_image_params later.
2014-04-21 02:57:16 +02:00
wm4 956b01ec4e ass_mp: don't use --subcp for --ass-styles
The --ass-styles option is implemented by calling ass_read_styles().
This function can take a codepage (so libass will use iconv to convert
it). This was implemented before our --subcp option was changed, and
this code was not updated. Now libass fails opening iconv, because
--subcp is not always (and not by default) a valid iconv codepage.

Just always pass NULL, which means the file passed to --ass-styles must
be in UTF-8. The --ass-styles option is a fringe option anyway (and will
destroy your subtitles), so having codepage support for it isn't
important at all.
2014-03-31 18:44:44 +02:00
wm4 64c01a814c Remove some more unneeded version checks
All of these check against things that happened before the latest
supported FFmpeg/Libav release.
2014-03-16 13:19:28 +01:00
wm4 bb0290145a sub: remove old MPlayer DVD sub decoder
The DVD sub decoder in Libav 9 was broken/incomplete, so we kept the
MPlayer decoder around. Now it's not needed anymore.
2014-03-16 13:19:28 +01:00
wm4 86689f7bf2 demux_libass: change how external ASS subtitles are loaded
Instead of parsing the ASS file in demux_libass.c and trying to pass the
ASS_Track to the subtitle renderer, just read all file data in
demux_libass.c, and let the subtitle renderer pass the file contents to
ass_process_codec_private(). (This happens to parse full files too.)

Makes the code simpler, though it also relies harder on the (messy)
probe logic in demux_libass.c.
2014-03-15 22:17:51 +01:00
wm4 5606cf2948 sub: use new FFmpeg API to check MicroDVD FPS
Before this, it wasn't possible to distinguish MicroDVD subtitles
without FPS header, and subtitles with FPS header equal to FFmpeg's
fallback FPS.
2014-03-04 00:28:10 +01:00
wm4 bcceeec737 sd_ass: add a very simple and evil way to override ASS subtitle styles
--ass-style-override=force now attempts to override the 'Default' style.
May or may not work. In some situations it will work, but also mess up
seemingly unrelated things like signs typeset with ASS.
2014-03-01 02:18:03 +01:00
xylosper 87c13de656 sd_lavc: handle subtitles with no subtitle resolution set
Set subtitle resolution to video resolution when avctx->width and
avctx->height are zero.

This can happen with broken vobsubs that have no size set in their
.idx file (or Matroska extradata). At least with the test file provided
in issue #551, using the video resolution as fallback instead of what
guess_resolution() does is better.

Note that these files clearly are broken. It seems this particular
file was created by trying to use ffmpeg to transcode DVB subtitles
to vobsub, and ffmpeg "forgot" to set the subtitle resolution in the
destination file. On the other hand, ffmpeg DVB and PGS decoders set
the resolution on the first subtitle packet (or somewhere close), so
it's not really clear what to do here.

Closes #551.

Signed-off-by: wm4 <wm4@nowhere>

Patch by xylosper, rewritten commit message by wm4.
2014-02-14 16:38:31 +01:00
wm4 2a2dfd2327 sub: handle vobsub-in-mp4
The mplayer decoder (spudec.c) actually handled this. There was explicit
code for binary palettes (16 32 bit values), and the subtitle resolution
was handled by video resolution coincidentally matching the subtitle
resolution.

Whoever puts vobsub into mp4 should be punished.

Fixes the sample gundam_sample.mp4, closes github issue #547.
2014-02-13 22:54:47 +01:00
wm4 a17be5576f threads: add wrapper for initializing recursive mutexes
Damn this overly verbose pthread API.
2014-01-31 19:50:25 +01:00
wm4 46c9dfe2e7 sd_lavc: skip 0 sized sub-bitmaps
Not everything in the OSD path handles 0x0 sized sub-bitmaps well. At
least the code implementing --sub-gray had severe problems with it.

Fix this by skipping such bitmaps.
2014-01-29 16:52:40 +01:00
wm4 1e73da47da sub: fix crash with certain uses of --vf=sub
If, for some reason, the subtitle renderer attempts to render a
subtitle before SD_CTRL_SET_VIDEO_PARAMS was called, it passed a
value calculated from invalid values. This can happen with --vf=sub
and --start. The crash happens if 1. there was a subtitle packet that
falls into the timestamp of the rendered video frame, 2. the playloop
hasn't informed the subtitle decoder about the video resolution yet
(normally unneeded, because that is used for weird corner cases only,
so this code is a bit fuzzy), and 3. something actually requests a
frame to be drawn from the subtitle renderer, like with vf_sub.

The actual crash was due to passing NaN as pixel aspect to libass,
which then created glyphs with ridiculous sizes, involving a few
integer overflows and unchecked mallocs.

The sd_lavc.c and sd_spu.c cases probably don't crash, but I'm not
sure, and it's better fix them anyway.

Not bothering with sd_spu.c, this crap is for compatibility and will
be removed soon.

Note that this would have been no problem, had the code checked whether
SD_CTRL_SET_VIDEO_PARAMS was actually called. This commit adds such a
check (although it basically checks after using the parameters).

Regression since 49caa0a7 and 633fde4a.
2014-01-26 18:58:40 +01:00
wm4 4de73fd5c1 video/out: don't access aspdat in VOs
vo->aspdat is basically an outdated version of vo->params, plus some
weirdness. Get rid of it, which will allow further cleanups and which
will make multithreading easier (less state to care about).

Also, simplify some VO code by using mp_image_set_attributes() instead
of caring about display size, colorspace, etc. manually. Add the
function osd_res_from_image_params(), which is often needed in the case
OSD renders into an image.
2014-01-22 00:35:52 +01:00
wm4 6f520bb956 osd: fix dvdnav highlights
Broken by previous commit.
2014-01-18 16:40:39 +01:00
wm4 7f4a09bb85 sub: uglify OSD code path with locking
Do two things:
1. add locking to struct osd_state
2. make struct osd_state opaque

While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses
lots of osd_state (and osd_object) members. To make sure everything is
accessed synchronously, I prefer making osd_state opaque, even if it
means adding pretty dumb accessors.

All of this is meant to allow running VO in their own threads.
Eventually, VOs will request OSD on their own, which means osd_state
will be accessed from foreign threads.
2014-01-18 01:27:43 +01:00
wm4 92a9f11a0b sub: uglify sub decoder with locking
The plan is to make the whole OSD thread-safe, and we start with this.

We just put locks on all entry points (fortunately, dec_sub.c and all
sd_*.c decoders are very closed off, and only the entry points in
dec_sub.h let you access it). I think this is pretty ugly, but at least
it's very simple.

There's a special case with sub_get_bitmaps(): this function returns
pointers to decoder data (specifically, libass images). There's no way
to synchronize this internally, so expose sub_lock/sub_unlock functions.

To make things simpler, and especially because the lock is sort-of
exposed to the outside world, make the locks recursive. Although the
only case where this is actually needed (although trivial) is
sub_set_extradata().

One corner case are ASS subtitles: for some reason, we keep a single
ASS_Renderer instance for subtitles around (probably to avoid rescanning
fonts with ordered chapters), and this ASS_Renderer instance is not
synchronized. Also, demux_libass.c loads ASS_Track objects, which are
directly passed to sd_ass.c. These things are not synchronized (and
would be hard to synchronize), and basically we're out of luck. But I
think for now, accesses happen reasonably serialized, so there is no
actual problem yet, even if we start to access OSD from other threads.
2014-01-17 23:21:17 +01:00
wm4 14bd02a034 sd_lavc: use mp_lavc_set_extradata()
This includes the magical input padding required by libavcodec, which we
possibly didn't do before this commit.
2014-01-11 01:28:18 +01:00
wm4 cf02369aaf sub: fix frame based subtitle timestamp handling
Subtitle formats with frame based timing require using the video FPS to
compute proper subtitle timestamps. But it looks like the calculation to
do that was inversed.
2014-01-09 23:04:38 +01:00
Martin Herkt e62c917abf Fix subtitle delay inversion 2014-01-06 17:09:31 +01:00
wm4 7041d8cd37 vo: dropping subtitle files on the VO window adds them as subtitle files
Note that we don't try to be clever about detecting the files as
subtitles: we just check the file extension. We could go all the way and
check the files by opening them with a demuxer, but that would probably
do more bad than good.
2014-01-04 01:27:29 +01:00
wm4 963a3d2c64 osd_libass: use bstr_xappend()
Partially, just enough to drop mp_append_utf8_buffer().
2013-12-30 22:49:50 +01:00
wm4 3720b3f17d player: add --secondary-sid for displaying a second subtitle stream
This is relatively hacky, but it's Christmas, so it's ok. This does two
things: 1. allow selecting two subtitle tracks, and 2. include a hack
that renders the second subtitle always as toptitle. See manpage
additions how to use this.
2013-12-24 17:46:14 +01:00
wm4 eef36f03ea msg: rename mp_msg_log -> mp_msg
Same for companion functions.
2013-12-21 22:13:04 +01:00
wm4 eba5d025d2 msg: convert defines to enum
Also get rid of MSGL_HINT and the many MSGL_DBG* levels.
2013-12-21 22:13:04 +01:00
wm4 ad2199128d path lookup functions: mp_msg conversions
There's a single mp_msg() in path.c, but all path lookup functions seem
to depend on it, so we get a rat-tail of stuff we have to change. This
is probably a good thing though, because we can have the path lookup
functions also access options, so we could allow overriding the default
config path, or ignore the MPV_HOME environment variable, and such
things.

Also take the chance to consistently add talloc_ctx parameters to the
path lookup functions.

Also, this change causes a big mess on configfiles.c. It's the same
issue: everything suddenly needs a (different) context argument. Make it
less wild by providing a mp_load_auto_profiles() function, which
isolates most of it to configfiles.c.
2013-12-21 21:43:17 +01:00
wm4 33c8fd789d charset_conv: mp_msg conversions 2013-12-21 21:43:16 +01:00
wm4 3846fc7587 sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
wm4 92f9b51426 find_subfiles: mp_msg conversions 2013-12-21 20:50:13 +01:00