summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreddyg <[email protected]>2007-08-29 22:29:36 +0000
committereddyg <[email protected]>2007-08-29 22:29:36 +0000
commitfe2046208ad29b1043c76b05dbac4076a95ad282 (patch)
tree8cb7d16ffe64bd91db6b9c0597fa25730187f167
parent7b95e146c522e0343b284145a5c1a0f7df84dd40 (diff)
Patch from bitsflew that displays fading subtitles as solid subtitles rather than being invisible.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@896 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/decsub.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/libhb/decsub.c b/libhb/decsub.c
index ee269c53b..eb3b35a34 100644
--- a/libhb/decsub.c
+++ b/libhb/decsub.c
@@ -141,7 +141,12 @@ static void ParseControls( hb_work_object_t * w )
pv->pts_start = 0;
pv->pts_stop = 0;
pv->pts_forced = 0;
-
+
+ pv->alpha[3] = 0;
+ pv->alpha[2] = 0;
+ pv->alpha[1] = 0;
+ pv->alpha[0] = 0;
+
for( i = pv->size_rle; ; )
{
date = ( pv->buf[i] << 8 ) | pv->buf[i+1]; i += 2;
@@ -193,7 +198,8 @@ static void ParseControls( hb_work_object_t * w )
break;
case 0x02: // 0x02 - STP_DSP - Stop Display, no arguments
- pv->pts_stop = pv->pts + date * 900;
+ if(!pv->pts_stop)
+ pv->pts_stop = pv->pts + date * 900;
break;
case 0x03: // 0x03 - SET_COLOR - Set Colour indices
@@ -247,10 +253,32 @@ static void ParseControls( hb_work_object_t * w )
* (alpha blend) values to associate with the four
* pixel values
*/
- pv->alpha[3] = (pv->buf[i+0]>>4)&0x0f;
- pv->alpha[2] = (pv->buf[i+0])&0x0f;
- pv->alpha[1] = (pv->buf[i+1]>>4)&0x0f;
- pv->alpha[0] = (pv->buf[i+1])&0x0f;
+ uint8_t alpha[4];
+
+ alpha[3] = (pv->buf[i+0]>>4)&0x0f;
+ alpha[2] = (pv->buf[i+0])&0x0f;
+ alpha[1] = (pv->buf[i+1]>>4)&0x0f;
+ alpha[0] = (pv->buf[i+1])&0x0f;
+
+
+ int lastAlpha = pv->alpha[3] + pv->alpha[2] + pv->alpha[1] + pv->alpha[0];
+ int currAlpha = alpha[3] + alpha[2] + alpha[1] + alpha[0];
+
+ // fading-in, save the highest alpha value
+ if( currAlpha > lastAlpha )
+ {
+ pv->alpha[3] = alpha[3];
+ pv->alpha[2] = alpha[2];
+ pv->alpha[1] = alpha[1];
+ pv->alpha[0] = alpha[0];
+ }
+
+ // fading-out
+ if( currAlpha < lastAlpha && !pv->pts_stop )
+ {
+ pv->pts_stop = pv->pts + date * 900;
+ }
+
i += 2;
break;
}
@@ -271,6 +299,8 @@ static void ParseControls( hb_work_object_t * w )
}
}
}
+
+
if( i > next )
{