summaryrefslogtreecommitdiffstats
path: root/sub
Commit message (Collapse)AuthorAgeFilesLines
* sub: fix srt subs and other caseswm42015-07-071-0/+1
| | | | Oops.
* sub: protect ASS_Renderer statewm42015-07-064-3/+16
| | | | | | | | | | | | | | | | | | | 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.
* demux: merge extradata fieldswm42015-06-211-2/+2
| | | | | | | 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.
* player: use an array for stream ID options and suchwm42015-05-221-2/+2
| | | | This makes the code slightly more generic.
* sub: add .sup file extension for subtitle autoloadingwm42015-05-181-1/+1
|
* path: make mp_path_join accept normal C stringswm42015-05-091-3/+3
| | | | | Instead of bstr. Most callers of this function do not need bstr. The bstr version of this function is now mp_path_join_bstr().
* Update license headersMarcin Kurczewski2015-04-1313-59/+49
| | | | Signed-off-by: wm4 <wm4@nowhere>
* mp_image: remove redundant flags fieldwm42015-04-101-2/+2
| | | | | | | 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.
* mp_image: remove redundant chroma_x/y_shift fieldswm42015-04-101-3/+3
|
* mp_image: get rid of chroma_width/height fieldswm42015-04-091-5/+4
| | | | | | | 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).
* sub: don't truncate timestamps to intwm42015-04-081-1/+1
| | | | | Realistically probably no problem at all since they're in ms and usually start from 0, but whatever.
* sub: unprefer libavcodec's MicroDVD converterwm42015-04-081-1/+1
| | | | | | | | | | 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.
* player: load .ac3 files as external fileswm42015-04-021-1/+1
| | | | Fixes #1759.
* sub: add --sub-text-bold optionwm42015-04-013-0/+3
| | | | This was basically requested.
* video: move colorspace overrides to vf_format, simplifywm42015-03-311-3/+5
| | | | | | | | | | | | | | | | | | | 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.
* vo_opengl: draw subtitles directly onto the videoNiklas Haas2015-03-262-0/+3
| | | | | | | | | | | | | | | | 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>
* video: uninline memcpy_pic functionswm42015-03-201-1/+0
| | | | | | | | | 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.
* osd: simplify an aspect of change detection handlingwm42015-03-186-24/+14
| | | | | | | | | | | | | | | | | | 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.
* sub: this isn't needed eitherwm42015-03-032-5/+0
|
* sd_lavc: remove mp4 vobsub extradata hackwm42015-03-031-35/+0
| | | | | The proper fix is now available in all supported FFmpeg and Libav releases.
* sd_ass: replace a deprecated libass API callwm42015-02-251-1/+1
|
* sub: fully update plaintext subtitle styles at runtimewm42015-02-242-6/+13
| | | | | | | | | | | | | | | 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).
* sub: move mp_ass_configure() codewm42015-02-243-60/+57
| | | | | sd_ass.c is the only user, and the function is starting to become extremely "special". No other changes.
* osd: force alignment for OSD barwm42015-02-241-1/+2
| | | | | | | | 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.
* osd: always reset style paramswm42015-02-241-11/+8
| | | | | | | 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.
* sub: apply text subtitle style overrides more eagerlywm42015-02-241-1/+3
| | | | | | | | | | 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.
* libass: remove redundant checks for LIBASS_VERSIONBen Boeckel2015-02-243-25/+0
| | | | Since 0.12.1 is the minimum, just assume it in the code too.
* find_subfiles: Add 'vtt' to subtitle extensionsJaime Marquínez Ferrándiz2015-02-181-1/+1
|
* sub: mess with styling defaults, change --ass-use-margins behaviorwm42015-02-163-15/+24
| | | | | | | | | | | | | | | | | | | 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.
* osd: customizable subtitle and OSD positionwm42015-02-163-0/+11
| | | | | | 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.
* osd: make it possible to have different subtitle vs. OSD defaultswm42015-02-162-26/+43
| | | | | | | | 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.
* sd_ass: fix some corner cases in tag strippingwm42015-02-121-5/+14
| | | | This behavior is implied by VSFilter.
* player: add external audio file auto-loadingwm42015-02-022-40/+62
| | | | | | Apparently some people want this. Not enabled by default. Fixes #967.
* ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAILBen Boeckel2015-01-271-1/+1
| | | | | The macro actually returns the *available* space in the array, not how much is actually filled in.
* sd_lavc: apply fallback to video resolution only for vobsubswm42015-01-061-14/+11
| | | | | | | | | | | | | | | | | | 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.
* csputils: replace float[3][4] with a structwm42015-01-063-14/+14
| | | | | 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.
* csputils: move image_params -> csp_params into a functionwm42015-01-061-2/+1
| | | | | | | | | 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).
* csputils: get rid of mp_csp_detailswm42015-01-063-8/+7
| | | | It used to be central, but now it's just unneeded.
* sub: add option to not scale subtitles with windowwm42015-01-051-0/+5
| | | | | | | | | | | | | --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.)
* sd_lavc: ignore image subtitles with unknown duration after 1 minutewm42014-12-221-0/+3
| | | | | | | | 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.
* sd_lavc: compensate for a stupid libavcodec API issuewm42014-12-211-1/+4
| | | | | | | | | 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.
* player: add option not to use OSD/fontconfigwm42014-11-251-0/+3
| | | | | | | 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.
* draw_bmp: make code more obvious, remove assertionwm42014-11-211-3/+3
| | | | | | | 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.
* sub: load .mks files as external subtitleswm42014-11-061-1/+1
|
* sub: remove osd_get_sub()wm42014-11-012-8/+0
| | | | | Trades one strange thing against another, but seems slightly less strange.
* osd: slightly change default styleMartin Herkt2014-10-231-3/+3
| | | | | Wider vertical margins, slightly thicker border and larger font size should be an improvement.
* sd_lavc: strictly letter-box PGS subtitleswm42014-10-212-3/+8
| | | | | | | | | | | | | | 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.
* sub: adjustments to --ass-style-override optionwm42014-10-171-4/+7
| | | | | | | | | | 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)
* osd: properly redraw external overlays when they are setwm42014-10-141-0/+1
|
* Add some missing "const"swm42014-10-103-6/+6
| | | | | | | 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).
* sub: round scaled subtitleswm42014-10-021-4/+4
| | | | | | | | | 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.
* command: allow using ASS tags on OSD messageswm42014-09-183-2/+17
| | | | | | | | | | | 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.
* demux: gracefully handle packet allocation failureswm42014-09-161-2/+4
| | | | Now the packet allocation functions can fail.
* img_convert: sanitizer: avoid invalid left-shiftsBen Boeckel2014-09-141-4/+4
| | | | | | | (a << 24) is not in the valid int range when a is 255, so use an unsigned instead. Signed-off-by: wm4 <wm4@nowhere>
* sanitizer: avoid divide-by-zero instancesBen Boeckel2014-09-141-2/+4
| | | | | | | | 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>
* sub: fix possible deadlock with --no-sub-ass and similarwm42014-09-061-0/+2
| | | | | | | | | | | | | | | 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.
* Move compat/ and bstr/ directory contents somewhere elsewm42014-08-295-5/+5
| | | | | | | | | 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.
* sd_lavc: remove ineffective codewm42014-08-241-4/+1
| | | | | | | | | 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.
* osd+osc: Add left-arrow to osd-fontChrisK22014-08-211-0/+0
| | | | | For use as playlist navigation button in OSC, now the osd-font carries all symbols needed by the OSC.
* sub: add option to workaround broken mkv fileswm42014-08-141-1/+1
| | | | See additions to options.rst.
* sub: call sub_reset() on seeks onlywm42014-08-141-9/+3
| | | | | | | | | | | | | | | | | 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.)
* ass: remove some pointless ifdefferywm42014-07-221-4/+0
| | | | | This will print compiler warnings about unused variables with older libass versions, but that's harmless.
* Revert "Remove DVD and Bluray support"wm42014-07-152-0/+19
| | | | | | This reverts commit 4b93210e0c244a65ef10a566abed2ad25ecaf9a1. *shrug*
* Remove DVD and Bluray supportwm42014-07-142-19/+0