summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-06 19:57:45 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-06 19:57:45 +0000
commitaedd1b4de8f516881de4e44613e98b59799e2996 (patch)
treea4c8a0366b741dda9324fe18ab63904ae9a77bef /spudec.c
parente008f62627e01a064db9f73f16fb3c2e9b198f3f (diff)
downloadmpv-aedd1b4de8f516881de4e44613e98b59799e2996.tar.bz2
mpv-aedd1b4de8f516881de4e44613e98b59799e2996.tar.xz
Fix subtitle display for DVDs using fade-in/fade-out.
This does not do the actual fading, this is not supported by MPlayer, but will just use the highest alpha value used during display. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30524 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/spudec.c b/spudec.c
index 8be30e1e56..a20d97d865 100644
--- a/spudec.c
+++ b/spudec.c
@@ -354,7 +354,7 @@ static void compute_palette(spudec_handle_t *this, packet_t *packet)
static void spudec_process_control(spudec_handle_t *this, int pts100)
{
- int a,b; /* Temporary vars */
+ int a,b,c,d; /* Temporary vars */
unsigned int date, type;
unsigned int off;
unsigned int start_off = 0;
@@ -417,10 +417,22 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
break;
case 0x04:
/* Alpha */
- this->alpha[0] = this->packet[off] >> 4;
- this->alpha[1] = this->packet[off] & 0xf;
- this->alpha[2] = this->packet[off + 1] >> 4;
- this->alpha[3] = this->packet[off + 1] & 0xf;
+ a = this->packet[off] >> 4;
+ b = this->packet[off] & 0xf;
+ c = this->packet[off + 1] >> 4;
+ d = this->packet[off + 1] & 0xf;
+ // Note: some DVDs change these values to create a fade-in/fade-out effect
+ // We can not handle this, so just keep the highest value during the display time.
+ if (display) {
+ a = FFMAX(a, this->alpha[0]);
+ b = FFMAX(b, this->alpha[1]);
+ c = FFMAX(c, this->alpha[2]);
+ d = FFMAX(d, this->alpha[3]);
+ }
+ this->alpha[0] = a;
+ this->alpha[1] = b;
+ this->alpha[2] = c;
+ this->alpha[3] = d;
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Alpha %d, %d, %d, %d\n",
this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]);
off+=2;