From b44202b69fc4a1dd1659f7940c5f8846d316e0ff Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 28 Apr 2013 21:12:11 +0200 Subject: sub: redo how -no-ass is handled The -no-ass switch used to disable any use of libass for text subtitles. This is not really the case anymore, because libass is now always involved when rendering text. The only remaining use of -no-ass is disabling styling or showing subtitles on the terminal. On the other hand, the old subtitle rendering path is a big reason why the subtitle code is still a big mess with an awful number of obscure special cases. In order to simplify it, remove the old subtitle rendering code, and always go through sd_ass.c. Basically, we use ASS_Track as central data structure for storing text subtitles instead of struct sub_data. This also makes libass mandatory for all text subs, even if they are printed to the terminal in -no-video mode. (We could add something like sd_text to avoid this, but it's not worth the trouble.) struct sub_data and subreader.c are still around, even its ASS/SSA reader. But struct sub_data is freed right after converting it to ASS_Track. The internal ASS reader actually can handle some obscure cases libass can't, like files encoded in UTF-16. --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1662f6f1e1..f7b94f44e9 100644 --- a/Makefile +++ b/Makefile @@ -227,7 +227,6 @@ SOURCES = talloc.c \ stream/url.c \ sub/dec_sub.c \ sub/draw_bmp.c \ - sub/find_sub.c \ sub/find_subfiles.c \ sub/img_convert.c \ sub/sd_lavc.c \ -- cgit v1.2.3 From 26842806431a1d21e3c3c430994cd6901e36a08e Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 29 Apr 2013 01:13:22 +0200 Subject: sub: add sd_spu.c to wrap spudec, cleanup mplayer.c This unifies the subtitle rendering path. Now all subtitle rendering goes through sd_ass.c/sd_lavc.c/sd_spu.c. Before that commit, the spudec.h functions were used directly in mplayer.c, which introduced many special cases. Add sd_spu.c, which is just a small wrapper connecting the new subtitle render API with the dusty old vobsub decoder in spudec.c. One detail that changes is that we always pass the palette as extra data, instead of passing the libdvdread palette as pointer to spudec directly. This is a bit roundabout, but actually makes the code simpler and more elegant: the difference between DVD and non-DVD dvdsubs is reduced. Ideally, we would just delete spudec.c and use libavcodec's DVD sub decoder. However, DVD playback with demux_mpg produces packets incompatible to lavc. There are incompatibilities the other way around as well: packets from libavformat's vobsub demuxer are incompatible to spudec.c. So we define a new subtitle codec name for demux_mpg subs, "dvd_subtitle_mpg", which only sd_spu can decode. There is actually code in spudec.c to "assemble" fragments into complete packets, but using the whole spudec.c is easier than trying to move this code into demux_mpg to fix subtitle packets. As additional complication, Libav 9.x can't decode DVD subs correctly, so use sd_spu in that case as well. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f7b94f44e9..e91564703e 100644 --- a/Makefile +++ b/Makefile @@ -230,6 +230,7 @@ SOURCES = talloc.c \ sub/find_subfiles.c \ sub/img_convert.c \ sub/sd_lavc.c \ + sub/sd_spu.c \ sub/spudec.c \ sub/sub.c \ sub/subassconvert.c \ -- cgit v1.2.3 From 27d383918a3d63559c85ca96b2162a13234f2abc Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2013 19:43:11 +0200 Subject: core: add demux_sub pseudo demuxer Subtitle files are opened in mplayer.c, not using the demuxer infrastructure in general. Pretend that this is not the case (outside of the loading code) by opening a pseudo demuxer that does nothing. One advantage is that the initialization code is now the same, and there's no confusion about what the difference between track->stream, track->sh_sub and mpctx->sh_sub is supposed to be. This is a bit stupid, and it would be much better if there were proper subtitle demuxers (there are many in recent FFmpeg, but not Libav). So for now this is just a transition to a more proper architecture. Look at demux_sub like an artifical limb: it's ugly, but don't hate it - it helps you to get on with your life. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e91564703e..6e52253543 100644 --- a/Makefile +++ b/Makefile @@ -205,6 +205,7 @@ SOURCES = talloc.c \ demux/demux_mf.c \ demux/demux_mkv.c \ demux/demux_mpg.c \ + demux/demux_sub.c \ demux/demux_ts.c \ demux/mp3_hdr.c \ demux/parse_es.c \ -- cgit v1.2.3 From 3000df35d31f09f13a7c662e2f96bcd7d0f6ac13 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2013 19:44:55 +0200 Subject: sub: basic subtitle converters Add a basic infrastructure for subtitle converters. These converters work sort-of like decoders, except that they produce packets instead of subtitle bitmaps. They are put in front of actual decoders. Start with sd_movtext. 4 lines of code are blown up to a 55 lines file, but fortunately this is not going to be that bad for the following converters. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6e52253543..583eaf87ec 100644 --- a/Makefile +++ b/Makefile @@ -231,6 +231,7 @@ SOURCES = talloc.c \ sub/find_subfiles.c \ sub/img_convert.c \ sub/sd_lavc.c \ + sub/sd_movtext.c \ sub/sd_spu.c \ sub/spudec.c \ sub/sub.c \ -- cgit v1.2.3 From 14dd95154820d4ec9afb5200335177b011233049 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2013 19:50:46 +0200 Subject: sub: split subassconvert.c into sd_microdvd.c and sd_srt.c --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 583eaf87ec..d3e203a852 100644 --- a/Makefile +++ b/Makefile @@ -231,11 +231,12 @@ SOURCES = talloc.c \ sub/find_subfiles.c \ sub/img_convert.c \ sub/sd_lavc.c \ + sub/sd_microdvd.c \ sub/sd_movtext.c \ sub/sd_spu.c \ + sub/sd_srt.c \ sub/spudec.c \ sub/sub.c \ - sub/subassconvert.c \ sub/subreader.c \ video/csputils.c \ video/fmt-conversion.c \ -- cgit v1.2.3 From b11bd1fe5e82fb7cd9aa912c2b1c98de8704bb87 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2013 19:54:31 +0200 Subject: sub: make use of libavcodec subtitle converters This allows using some formats that were not supported until now, like WebVTT. We still prefer the internal subtitle reader (subreader.c), because 1. Libav, and 2. random things which we probably want to keep, such as control over formatting, codepage stuff, or various mysterious postprecessing done in that code. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d3e203a852..389a519055 100644 --- a/Makefile +++ b/Makefile @@ -231,6 +231,7 @@ SOURCES = talloc.c \ sub/find_subfiles.c \ sub/img_convert.c \ sub/sd_lavc.c \ + sub/sd_lavc_conv.c \ sub/sd_microdvd.c \ sub/sd_movtext.c \ sub/sd_spu.c \ -- cgit v1.2.3