summaryrefslogtreecommitdiffstats
path: root/sub
Commit message (Collapse)AuthorAgeFilesLines
* player: add experimental stream recording featurewm42017-02-072-0/+16
| | | | | This is basically a WIP, but it can't remain in a branch forever. A warning is print when using it as it's still a bit "shaky".
* sub: add justify of subtitlesDan Oscarsson2017-02-014-0/+10
| | | | | | | | To make it easier for the eyes, multi line subtitles should be left justified (for most languages). This adds an option to define how subtitles are to be justified inpendently of how they are aligned. Also add option to enable --sub-justify to be applied on ASS subtitles.
* command: shorten long playlists on OSDwm42017-01-263-5/+30
| | | | | | | | | | | | A hacky, convoluted, half-working mess that attempts to cut off overlong playlists. It does so by relying on the ASS formatting rule that the font size is specified in the virtual PlayResY resolution. This means we can (normally) easily tell how many lines fit on the screen. On the other hand, this does not work if the text is wrapped. This as a kludge until a Better™ solution is available.
* osd: move some internal declarations to internal headerswm42017-01-263-10/+7
|
* sub: add option to force using video resolution for image subtitleswm42017-01-231-1/+1
| | | | Basically for debugging and dealing with broken files.
* sd_lavc: remove old broken heuristicwm42017-01-232-39/+10
| | | | | | | | | | | | | | | | | This core of this heuristic was once copied from MPlayer's spudec.c. I think it was meant for the case when the resolution field was missing or so. I couldn't find a file for which this actually does something. On the other hand, there are samples which actually have a smaller resolution than 720x576, and which are broken by this old hack. For subtitles that set no resolution (I'm not sure which codec/container that would be), there's still the fallback on video resolution. Just get rid of this hack. Also cleanup a bit. SD_CTRL_GET_RESOLUTION hasn't been used since DVD menu removal. get_resolution() is left with 1 call site, and would be quite awkward to keep, so un-inline it.
* Remove compatibility thingswm42016-12-072-8/+0
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.
* dec_sub: avoid full reinit on switches to the same segmentwm42016-11-091-2/+7
| | | | | | | | | | The previous commit means subtitles were reinitialized on every seek (even within a segment). This commit restores the old behavior. To check whether the segment changed at all, we don't reset the current start/end values. This assumes the decoder wrapper is always fed by a stream which doesn't mix segment and non-segment packets, which is currently always true.
* player: show subtitles on VO if --force-window is usedwm42016-10-263-0/+22
| | | | | | | | | | | | | | | | | | | | | If a VO is created, but no video is playing (i.e. --force-window is used), then until now no subtitles were shown. This is because VO subtitle display normally depends on video frame timing. If there are no video frames, there can be no subtitles. Change this and add some code to handle this situation specifically. Set a subtitle PTS manually and request VO redrawing manually, which gets the subtitles rendered somehow. This is kind of shaky. The subtitles are essentially sampled at arbitrary times (such as when new audio data is decoded and pushed to the AO, or on user interaction). To make a it slightly more consistent, force a completely arbitrary minimum FPS of 10. Other solutions (such as creating fake video) would be more intrusive or would require VO-level API changes. Fixes #3684.
* options: rename subtitle optionsDan Oscarsson2016-10-031-4/+4
| | | | | | | | | | | Rename the text subtitle options from --sub-text- to --sub- and --ass- options to --sub-ass-. The intention is to common sub options to prefixed --sub- and special ASS option be seen as a special version of sub options. The OSD options that work like the --sub- options are still named --osd-. Man page updated including a short note about renamed --sub-text-* and --ass-* options to --sub-* and --sub-ass-*.
* sd_ass: fix top alignment of secondary subtitleswm42016-09-251-3/+4
| | | | | | | | | | | Secondary subtitle streams (to be shown on the top of the screen along main subtitle stream) were shown with normal alignment. This is because we tell libass to override the alignment style (a relatively recent change, see commit 2f1eb49e). This would behave differently with old libass versions too. To escape the mess, just set the alignment explicitly with an override tag instead of modifying the style.
* osd: fix OSD redrawing after removing external overlayswm42016-09-201-0/+2
|
* options, command: simplify some option updateswm42016-09-191-0/+2
| | | | | | | Remove wrapper properties for OSD and video position updates, use the new mechanism for them. We can mark the options directly. Update behavior will work for more options (since I've casually marked more affected options than the old less direct mechanism covered).
* osd: fix OSD getting stuck with --blend-subtitles=yeswm42016-09-163-19/+18
| | | | | | | | | | | | | If --blend-subtitles=yes is given, vo_opengl will call osd_draw() multiple times, once for subtitles, and once for OSD. This meant that the want_redraw flag was reset before the OSD was rendered, which in turn meant that update_osd() was never called. It seems like removing the per-OSD object want_redraw wasn't such a good idea. Fix it by reintroducing such a flag for OSDTYPE_OSD only. Also, the want_redraw flag is now unused, so kill it. Another regression caused by commit 9c9cf125. Fixes #3535.
* osd: fix subtitle/overlay update problemswm42016-09-161-2/+6
| | | | | | | | | | | This could in theory lead to missed updates if subtitles were switched or external OSD overlays (via overlay-add) were updated. While the change IDs of each of those were consistent, switching between two separate OSD sources is not, and we have to explicitly trigger a change. Regression since commit 9c9cf125. The new code is actually better, because we do exactly what is needed, and don't just mess with the update ID for libass-based OSD.
* osd: slightly simplify update logicwm42016-09-154-27/+19
| | | | | | | | | | | | | | | | Remove the per-part force_redraw flags, and instead make the difference between flagging dirty state and returning it to the player frontend more explicit. The big issue is that 1. the OSD needs to know the dirty state, and it should be cleared strictly when it is re-rendered (force_redraw flag), and 2. the player core needs to be notified once, and the notification must be reset (want_redraw flag). The call in loadfile.c is replaced by making osd_set_sub() set the change flag. Increasing the change flag on dirty state (the force_redraw check in render_object()) should not be needed, because OSD part renderers set it correctly (at least now). Doing this just because someone pointed this out.
* sub: Add SD_CTRL_UPDATE_SPEEDVladimir Panteleev2016-09-132-0/+4
|
* sub: fix previous commit with older libass releaseswm42016-09-071-0/+2
|
* sub: actually apply text alignment options to non-ASS subtitleswm42016-09-071-0/+2
| | | | | | | | | | | This is a bug fix, and the text alignment functionality probably got lost sometime along the way. For ASS subtitles, this could have unintended consequences, so it's hard to get right - thus it's not applied to ASS subtitles. For other text subtitles, this should be fine, though. It still works on ASS subtitles as promised by the manpage if --no-sub-ass is used.
* sd_lavc: enable teletextwm42016-09-031-0/+11
| | | | | | | | | | | | Whitelisting supported codecs is (probably) still better than just allowing everything, given the weird FFmpeg API. I'm also assuming Libav doesn't even have the codec ID, but I didn't check. Also add a --teletext-page option, since otherwise it decodes every teletext page and shows them in succession. And yes, we can't use av_opt_set_int() - instead we have to set it as string. Because FFmpeg's option system is terrible.
* sd_lavc: always set decoder timebasewm42016-08-291-18/+2
| | | | | | | | Like it's done for audio and video. Just to be uniform. I'm sorry for deleting the anti-ffmpeg vitriol. It's still all true, but since we decided to always set the timebase, the crappiness is isolated to FFmpeg internals.
* sub: don't potentially discard too many subtitles on seekwm42016-08-143-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | The accepts_packet packet callback is supposed to deal with subtitle decoders which have only a small queue of current subtitle events (i.e. sd_lavc.c), in case feeding it too many packets would discard events that are still needed. Normally, the number of subtitles that need to be preserved is estimated by the rendering pts (get_bitmaps() argument). Rendering lags behind decoding, so normally the rendering pts is smaller than the next video frame pts, and we simply discard all subtitle events until the rendering pts. This breaks down in some annoying corner cases. One of them is seeking backwards: the VO will still try to render the old PTS during seeks, which passes a high PTS to the subtitle renderer, which in turn would discard more subtitles than it should. There is a similar issue with forward seeks. Add hacks to deal with those issues. There should be a better way to deal with the essentially unknown "rendering position", which is made worse by screenshots or rendering with vf_sub. At the very least, we could handle seeks better, and e.g. either force the VO not to re-render subs after seeks (ugly), or introduce seek sequence numbers to distinguish attempts to render earlier subtitles when a seek is done.
* mp_image: split colorimetry metadata into its own structNiklas Haas2016-07-032-23/+21
| | | | | | | | | | | | | | | | | | This has two reasons: 1. I tend to add new fields to this metadata, and every time I've done so I've consistently forgotten to update all of the dozens of places in which this colorimetry metadata might end up getting used. While most usages don't really care about most of the metadata, sometimes the intend was simply to “copy” the colorimetry metadata from one struct to another. With this being inside a substruct, those lines of code can now simply read a.color = b.color without having to care about added or removed fields. 2. It makes the type definitions nicer for upcoming refactors. In going through all of the usages, I also expanded a few where I felt that omitting the “young” fields was a bug.
* sub: remove unused sub_bitmaps.scaled fieldwm42016-07-032-5/+0
|
* sub: move RGBA scaling to vo_vaapiwm42016-07-032-66/+0
| | | | | | | | | vo_vaapi is the only thing which can't scale RGBA on the GPU. (Other cases of RGBA scaling are handled in draw_bmp.c for some reason.) Move this code and get rid of the osd_conv_cache thing. Functionally, nothing changes.
* sub: change how libass output is converted to RGBA in some caseswm42016-07-035-132/+103
| | | | | | | | | | | | | | | | | This affects VOs (or other code which render OSD) which does not support the LIBASS format, but only RGBA. Instead of having a converter stage in osd.c, make mp_ass_packer_pack() output directly in RGBA. In general, this is work towards refcounted subtitle images. Although we could keep the "converter" design, doing it this way seems simpler, at least considering the current situation with only 2 OSD formats. It also prevents copying & packing the data twice, which will lead to better performance. (Although I guess this case is not important at all.) It also fixes --force-rgba-osd-rendering when used with vo_opengl, vo_vdpau, and vo_direct3d.
* sub: move around some codewm42016-07-031-39/+60
| | | | | Put the packing code into separate functions. Preparation for the following commit.
* sub: pass preferred OSD format to subtitle rendererswm42016-07-039-18/+22
| | | | | | | | The intention is to let mp_ass_packer_pack() produce different output for the RGBA and LIBASS formats. VOs (or whatever generates the OSD) currently do not signal a preferred format, and this mechanism just exists to switch between RGBA and LIBASS formats correctly, preferring LIBASS if the VO supports it.
* sub: set ASS sub bitmap data to correct pointerwm42016-07-011-0/+3
| | | | | Point it to the copied data. Doesn't really matter at this point, but later it might have left dangling pointers.
* sub: pack libass bitmaps directly in sd_ass.c and osd_libass.cwm42016-06-306-54/+148
| | | | | | | | | | | | | | | | Change all producer of libass images to packing the bitmaps into a single larger bitmap directly when they're output. This is supposed to help working towards refcounted sub bitmaps. This will reduce performance for VOs like vo_xv, but not for vo_opengl. vo_opengl simply will pick up the pre-packed sub bitmaps, and skip packing them again. vo_xv will copy and pack the sub bitmaps unnecessarily - but if we want sub bitmap refcounting, they'd have to be copied anyway. The packing code cannot be removed yet from vo_opengl, because there are certain corner cases that still produce unpackad other sub bitmaps. Actual refcounting will also require more work.
* ass_mp.h: remove conditional inclusion guardswm42016-06-241-6/+2
| | | | | This file is only used when libass is enabled. (It used to be different, when code was more entangled.)
* bitmap_packet: let max=0 mean unlimitedwm42016-06-181-1/+0
| | | | | And remove the strange PACKER_MAX_WH define. This is more convenient for users which don't care about limits, such as sd_lavc.c.
* sd_lavc: fix sub-bitmap alignmentwm42016-06-181-1/+1
| | | | Ooops.
* sd_lavc: align sub-bitmaps for the sake of libswscalewm42016-06-182-7/+11
| | | | | | | Since there are not many sub-rectangles, this doesn't cost too much. On the other hand, it avoids frequent warnings with vo_xv. Also, the second copy in mp_blur_rgba_sub_bitmap() can be dropped.
* sd_lavc: fix typowm42016-06-181-1/+1
|
* sub, vo_opengl: use packed sub-bitmaps directly if availablewm42016-06-173-1/+30
| | | | | | | | | | | | | | | | | | The previous few commits changed sd_lavc.c's output to packed RGB sub- images. In particular, this means all sub-bitmaps are part of a larger, single bitmap. Change the vo_opengl OSD code such that it can make use of this, and upload the pre-packed image, instead of packing and copying them again. This complicates the upload code a bit (4 code paths due to messy PBO handling). The plan is to make sub-bitmaps always packed, but some more work is required to reach this point. The plan is to pack libass images as well. Since this implies a copy, this will make it easy to refcount the result. (This is all targeted towards vo_opengl. Other VOs, vo_xv, vo_x11, and vo_wayland in particular, will become less efficient. Although at least vo_vdpau and vo_direct3d could be switched to the new method as well.)
* sd_lavc: change hack against vobsubs with wrong resolutionwm42016-06-171-8/+9
| | | | | | | The sub-bitmaps get extended by --sub-gauss, so we have to compute the bounding box on the original subs. Not sure if this is really eqauivalent to what the code did before, and I don't have the sample anymore. (But this approach sure is a _shitty_ hack.)
* sub: fix --sub-gausswm42016-06-174-51/+37
| | | | | | | | | | | | | | | | | | | | Implement it directly in sd_lavc.c as well. Blurring requires extending the size of the sub-images by the blur radius. Since we now want sub_bitmaps to be packed into a single image, and we don't want to repack for blurring, we add some extra padding to each sub-bitmap in the initial packing, and then extend their size later. This relies on the previous bitmap_packer commit, which always adds the padding in all cases. Since blurring is now done on parts of a large bitmap, the data pointers can become unaligned, depending on their position. To avoid shitty libswscale printing a dumb warning, allocate an extra image, so that the blurring pass is done on two newly allocated images. (I don't find this feature important enough to waste more time on it.) The previous refactor accidentally broke this feature due to a logic bug in osd.c. It didn't matter before it happened to break, and doesn't matter now since the code paths are different.
* sub: move paletted image handling completely to sd_lavc.cwm42016-06-175-118/+87
| | | | | | | | | | | | | | | | | | | Until now, subtitle renderers could export SUBBITMAP_INDEXED, which is a 8 bit per pixel with palette format. sd_lavc.c was the only renderer doing this, and the result was converted to RGBA in every use-case (except maybe when the subtitles were hidden.) Change it so that sd_lavc.c converts to RGBA on its own. This simplifies everything a bit, and the palette handling can be removed from the common code. This is also preparation for making subtitle images refcounted. The "caching" in img_convert.c is a PITA in this respect, and needs to be redone. So getting rid of some img_convert.c code is a positive side- effect. Also related to refcounted subtitles is packing them into a single mp_image. Fewer objects to refcount is easier, and for the libass format the same will be done. The plan is to remove manual packing from the VOs which need single images entirely.
* sd_lavc: move AVSubtitle bitmap setup code into its own functionwm42016-06-171-34/+44
| | | | No functional changes.
* sd_lavc: work around bug in older ffmpeg releaseswm42016-05-101-2/+6
| | | | | | | | | | | | | | | Older ffmpeg releases don't have ffmpeg git commit 50401f5fb7d778583b03a13bc4440f71063d319d, which fixes ffmpeg's pkt_timebase check to reject its default "unset" timebase as invalid. The consequence was that all non-PGS bitmap subtitle timestamps were forced to 0. Of course this hit _only_ shitty distros using outdated/badly maintained ffmpeg releases, so this is not worth working around. I've already wasted a lot of time on analyzing this dumb issue, and it could be useful for bisecting, so don't drop pre-3.0 ffmpeg just yet. Fixes #3109.
* ass_process_chunk: Use llrint, not lrintRichard H Lee2016-05-101-2/+2
| | | | | | | | | libass's ass_process_chunk expects long long int for the timecode and durations arguments, thus should use llrint instead of lrint. This does not cause any problems on most platforms, but on cygwin, it causes strange subtitle behaviour, like subtitles not showing, getting stuck or old subtitles showing at the same time as new subtitles.
* osd: make osd_ass_0/1 defineswm42016-05-033-11/+9
| | | | So we can concatenate them with strings at compile time.
* sd_ass: minor consistency adjustmentwm42016-04-301-2/+2
|
* sd_add: replace --sub-ass=no with --ass-style-override=stripwm42016-04-301-1/+2
| | | | | | --sub-ass=no / --ass=no still work, but --ass-style-override=strip is preferred now. With this change, --ass-style-override can control all the types of style overriding.
* osd: add italic font for osdst4t1k2016-04-083-0/+3
|
* sub: interpret "text" subtitles as srtwm42016-04-061-0/+3
| | | | | Most players will interpret HTML-style tags (aka srt) in almost any kind of text subtitles; make mpv do this too.
* sd_lavc: use decoder-reordered PTS for PGSwm42016-04-021-3/+21
| | | | | | | | | | | | | | | | There is an obscure feature which requires essentially reordering PTS from different packets. Unfortunately, libavcodec introduced a ridiculously shitty API for this, which works very much unlike the audio/video API. Instead of simply passing through the PTS, it wants to fuck with it for no reason, and even worse, fucks with other fields and changes their semantivcs (??????). This affects AVSubtitle.end_display_time. This probably will cause issues for us, and I have no desire to find out whether it will. Since only PGS requires this, and it happens not to use end_display_time, do it for PGS only. Fixes #3016.
* sd_lavc: add a comment about duration==0 handlingwm42016-04-021-1/+3
| | | | | | | | Basically, this information is useless, because some muxers (hurr libavformat) write bogus information anyway. This means if we e.g. see PGS packets in mkv with duration explicitly set to 0, we must not trust that value anyway. (The FFmpeg API problem is leaking into files, how nice.)
* sd_lavc: fix subtitle display with unknown end timestampswm42016-04-021-1/+1
| | | | | This is a theoretical issue, because subtitle end timestamps for all but the current subtitle are always known.
* sub: force segment switch if video is already aheadwm42016-03-251-0/+8
| | | | | | | | | | | | In particular, this prevents subtitle packets from building up in the subtitle queue if e.g. --vo=null is used. In this situation, sub_get_bitmaps() is never called, and thus the segment never switched. This also seems to help with flickering at segment switch boundaries (if subs are supposed to be visible at the transition points). In theory, this could trigger a switch too early, but the way VO and subtitle renderer interact wrt. timing is a bit iffy anyway.
* vo_opengl, osd: allow osc.lua to react faster on resizeswm42016-03-212-6/+30
| | | | | | | | | Glitches when resizing are still possible, but are reduced. Other VOs could support this too, but don't need to do so. (Totally avoiding glitches would be much more effort, and probably not worth the trouble. How about you just watch the video the player is playing, instead of spending your time resizing the window.)
* osd: fix build with --disable-libasswm42016-03-161-1/+1
|
* osd: cleanup: make OSDTYPE_ constants private to OSD codewm42016-03-083-21/+28
| | | | | | 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()).
* osd, lua: manage multiple ASS overlays set with set_osd_ass() callswm42016-03-085-41/+83
| | | | | | | | | | | | | | | | | | | | | | | | | 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.