summaryrefslogtreecommitdiffstats
path: root/vobsub.c
diff options
context:
space:
mode:
authorattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-21 14:21:43 +0000
committerattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-21 14:21:43 +0000
commit943904865ff0af25172c788601a585cf2cc590b4 (patch)
treeb38f15a0b0dbd6a4d0e8f2d02399c98de0734367 /vobsub.c
parent1526dc6cdf8b226c43600eefc6ce137d73dd1f74 (diff)
downloadmpv-943904865ff0af25172c788601a585cf2cc590b4.tar.bz2
mpv-943904865ff0af25172c788601a585cf2cc590b4.tar.xz
Forced subtitles patch by Arne Driescher <driescher@mpi-magdeburg.mpg.de>
For a given subtitle language you can now chose to display only the forced subtitles. Defaut is set to "show all subtitles" so that current mplayer behaviour is not changed. For DVD: Use -forced_subs_only additionally to e.g. -slang en if you are only interested in the forced subtitles. For VobSub: The idx file is now parsed for the "forced subs: ON/OFF" tag and used according to its settings. Key: You can toggle the display of forced subtitles by pressing "F" (upper case letter). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10918 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vobsub.c')
-rw-r--r--vobsub.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/vobsub.c b/vobsub.c
index beec7439cb..c943655f87 100644
--- a/vobsub.c
+++ b/vobsub.c
@@ -576,6 +576,7 @@ typedef struct {
unsigned int have_palette;
unsigned int orig_frame_width, orig_frame_height;
unsigned int origin_x, origin_y;
+ unsigned int forced_subs;
/* index */
packet_queue_t *spu_streams;
unsigned int spu_streams_size;
@@ -888,6 +889,26 @@ vobsub_set_lang(const char *line)
}
static int
+vobsub_parse_forced_subs(vobsub_t *vob, const char *line)
+{
+ const char *p;
+
+ p = line;
+ while (isspace(*p))
+ ++p;
+
+ if (strncasecmp("on",p,2) == 0){
+ vob->forced_subs=~0;
+ return 0;
+ } else if (strncasecmp("off",p,3) == 0){
+ vob->forced_subs=0;
+ return 0;
+ }
+
+ return -1;
+}
+
+static int
vobsub_parse_one_line(vobsub_t *vob, rar_stream_t *fd)
{
ssize_t line_size;
@@ -920,6 +941,8 @@ vobsub_parse_one_line(vobsub_t *vob, rar_stream_t *fd)
else if (strncmp("custom colors:", line, 14) == 0)
//custom colors: ON/OFF, tridx: XXXX, colors: XXXXXX, XXXXXX, XXXXXX,XXXXXX
res = vobsub_parse_cuspal(vob, line) + vobsub_parse_tridx(line) + vobsub_parse_custom(vob, line);
+ else if (strncmp("forced subs:", line, 12) == 0)
+ res = vobsub_parse_forced_subs(vob, line + 12);
else {
mp_msg(MSGT_VOBSUB,MSGL_V, "vobsub: ignoring %s", line);
continue;
@@ -1017,6 +1040,7 @@ vobsub_open(const char *const name,const char *const ifo,const int force,void**
vob->spu_streams_size = 0;
vob->spu_streams_current = 0;
vob->delay = 0;
+ vob->forced_subs=0;
buf = malloc((strlen(name) + 5) * sizeof(char));
if (buf) {
rar_stream_t *fd;
@@ -1149,6 +1173,15 @@ vobsub_get_id(void *vobhandle, unsigned int index)
return (index < vob->spu_streams_size) ? vob->spu_streams[index].id : NULL;
}
+unsigned int
+vobsub_get_forced_subs_flag(void const * const vobhandle)
+{
+ if (vobhandle)
+ return ((vobsub_t*) vobhandle)->forced_subs;
+ else
+ return 0;
+}
+
int
vobsub_set_from_lang(void *vobhandle, unsigned char * lang)
{
@@ -1256,6 +1289,9 @@ create_idx(vobsub_out_t *me, const unsigned int *palette, unsigned int orig_widt
}
putc('\n', me->fidx);
}
+
+ fprintf(me->fidx,"# ON: displays only forced subtitles, OFF: shows everything\n"
+ "forced subs: OFF\n");
}
void *