summaryrefslogtreecommitdiffstats
path: root/spudec.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 /spudec.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 'spudec.c')
-rw-r--r--spudec.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/spudec.c b/spudec.c
index 8c86149ed3..8bcc580065 100644
--- a/spudec.c
+++ b/spudec.c
@@ -89,6 +89,8 @@ typedef struct {
int font_start_level; /* Darkest value used for the computed font */
vo_functions_t *hw_spu;
int spu_changed;
+ unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */
+ unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */
} spudec_handle_t;
static void spudec_queue_packet(spudec_handle_t *this, packet_t *packet)
@@ -371,8 +373,10 @@ static void spudec_process_control(spudec_handle_t *this, unsigned int pts100)
/* Menu ID, 1 byte */
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Menu ID\n");
/* shouldn't a Menu ID type force display start? */
- //this->start_pts = pts100 + date;
- //this->end_pts = UINT_MAX;
+ start_pts = pts100 + date;
+ end_pts = UINT_MAX;
+ display = 1;
+ this->is_forced_sub=~0; // current subtitle is forced
break;
case 0x01:
/* Start display */
@@ -380,6 +384,7 @@ static void spudec_process_control(spudec_handle_t *this, unsigned int pts100)
start_pts = pts100 + date;
end_pts = UINT_MAX;
display = 1;
+ this->is_forced_sub=0;
break;
case 0x02:
/* Stop display */
@@ -604,6 +609,14 @@ int spudec_visible(void *this){
return ret;
}
+void spudec_set_forced_subs_only(void * const this, const unsigned int flag)
+{
+ if(this){
+ ((spudec_handle_t *)this)->forced_subs_only=flag;
+ mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPU: Display only forced subs now %s\n", flag ? "enabled": "disabled");
+ }
+}
+
void spudec_draw(void *this, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride))
{
spudec_handle_t *spu = (spudec_handle_t *)this;
@@ -752,7 +765,14 @@ void spudec_draw_scaled(void *me, unsigned int dxs, unsigned int dys, void (*dra
spudec_handle_t *spu = (spudec_handle_t *)me;
scale_pixel *table_x;
scale_pixel *table_y;
+
if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts) {
+
+ // check if only forced subtitles are requested
+ if( (spu->forced_subs_only) && !(spu->is_forced_sub) ){
+ return;
+ }
+
if (!(spu_aamode&16) && (spu->orig_frame_width == 0 || spu->orig_frame_height == 0
|| (spu->orig_frame_width == dxs && spu->orig_frame_height == dys))) {
if (spu->image)
@@ -1125,6 +1145,9 @@ void *spudec_new_scaled_vobsub(unsigned int *palette, unsigned int *cuspal, unsi
memcpy(this->cuspal, cuspal, sizeof(this->cuspal));
this->auto_palette = 0;
}
+ // forced subtitles default: show all subtitles
+ this->forced_subs_only=0;
+ this->is_forced_sub=0;
}
else
mp_msg(MSGT_SPUDEC,MSGL_FATAL, "FATAL: spudec_init: calloc");