summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-16 20:03:08 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-18 14:58:09 +0200
commite990fb2ffeaa786339895c8f3b3f104ef536bf39 (patch)
tree383aaa216cd5d1f7c4dd75f7c27cfbaadaa7970a /libmpdemux
parent8636eb77c5f9f1e49a12e3e1653fe4c2e8e0bfc3 (diff)
downloadmpv-e990fb2ffeaa786339895c8f3b3f104ef536bf39.tar.bz2
mpv-e990fb2ffeaa786339895c8f3b3f104ef536bf39.tar.xz
subtitles: add framework for subtitle decoders
Add a framework for subtitle decoder modules that work more like audio/video decoders do, and change libass rendering of demuxed subtitles to use the new framework. The old subtitle code is messy, with details specific to handling particular subtitle types spread over high-level code. This should make it easier to clean things up and fix some bugs/limitations.
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demuxer.c20
-rw-r--r--libmpdemux/stheader.h5
2 files changed, 4 insertions, 21 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index dc5d8858bc..c45cb18729 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -43,8 +43,6 @@
#include "libmpcodecs/dec_teletext.h"
#include "libmpcodecs/vd_ffmpeg.h"
-#include "ass_mp.h"
-
#ifdef CONFIG_FFMPEG
#include "libavcodec/avcodec.h"
#if MP_INPUT_BUFFER_PADDING_SIZE < FF_INPUT_BUFFER_PADDING_SIZE
@@ -295,10 +293,6 @@ static void free_sh_sub(sh_sub_t *sh)
{
mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_sub at %p\n", sh);
free(sh->extradata);
-#ifdef CONFIG_ASS
- if (sh->ass_track)
- ass_free_track(sh->ass_track);
-#endif
free(sh->lang);
#ifdef CONFIG_FFMPEG
clear_parser((sh_common_t *)sh);
@@ -998,20 +992,6 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
sh_video->fps, sh_video->i_bps * 0.008f,
sh_video->i_bps / 1024.0f);
}
-#ifdef CONFIG_ASS
- if (opts->ass_enabled && ass_library) {
- for (int i = 0; i < MAX_S_STREAMS; ++i) {
- sh_sub_t *sh = demuxer->s_streams[i];
- if (sh && sh->type == 'a') {
- sh->ass_track = ass_new_track(ass_library);
- if (sh->ass_track && sh->extradata)
- ass_process_codec_private(sh->ass_track, sh->extradata,
- sh->extradata_len);
- } else if (sh && sh->type != 'v')
- sh->ass_track = ass_default_track(ass_library);
- }
- }
-#endif
return demuxer;
}
diff --git a/libmpdemux/stheader.h b/libmpdemux/stheader.h
index 4bb2da3ac7..dc84518abc 100644
--- a/libmpdemux/stheader.h
+++ b/libmpdemux/stheader.h
@@ -19,6 +19,8 @@
#ifndef MPLAYER_STHEADER_H
#define MPLAYER_STHEADER_H
+#include <stdbool.h>
+
#include "aviheader.h"
#include "ms_hdr.h"
struct MPOpts;
@@ -135,9 +137,10 @@ typedef struct sh_sub {
SH_COMMON
int sid;
char type; // t = text, v = VobSub, a = SSA/ASS
+ bool active; // after track switch decoder may stay initialized, not active
unsigned char* extradata; // extra header data passed from demuxer
int extradata_len;
- struct ass_track *ass_track; // for SSA/ASS streams (type == 'a')
+ const struct sd_functions *sd_driver;
} sh_sub_t;
// demuxer.c: