[MPlayer-dev-eng] [PATCH] fix -subcc for TiVo/tystreams
Doug Swarin
dswarin at gmail.com
Wed Sep 27 20:02:51 CEST 2006
On 9/27/06, Diego Biurrun <diego at biurrun.de> wrote:
> > --- DOCS/man/zh/mplayer.1 (revision 19993)
> > +++ DOCS/man/zh/mplayer.1 (working copy)
> > @@ -854,7 +854,7 @@
> > ??????????OSD????????????. ????????????????????????????????????????????.
> > 255????????0????????.
> > .TP
> > -.B \-subcc \
> > +.B \-subcc 1 \
>
> This (and the change to the other translations) looks bogus, leave it
> out.
Because it is changing from a flag option, it was necessary to specify
at least some argument. I didn't want the documentation to be
incorrect, and as I do not speak the other languages, I specified the
simplest option.
I've reworked my patch so the behavior of -subcc doesn't change. This
removes the need for any documentation updates. The patch now behaves
as the original code was apparently intended to (displaying both CC
subtitles and XDS subtitles). The new patch is attached.
I will submit a future patch to separate the CC and XDS functionality.
Thanks,
Doug
-------------- next part --------------
Index: libmpdemux/demux_ty.c
===================================================================
--- libmpdemux/demux_ty.c (revision 19997)
+++ libmpdemux/demux_ty.c (working copy)
@@ -116,7 +116,7 @@
} TiVoInfo;
off_t vstream_streamsize( );
-void ty_ClearOSD( int start );
+void ty_ClearOSD( int start, int osd );
// ===========================================================================
#define TMF_SIG "showing.xml"
@@ -1332,7 +1332,7 @@
}
if ( subcc_enabled )
{
- ty_ClearOSD( 0 );
+ ty_ClearOSD( 0, 0 );
}
}
Index: libmpdemux/demux_ty_osd.c
===================================================================
--- libmpdemux/demux_ty_osd.c (revision 19997)
+++ libmpdemux/demux_ty_osd.c (working copy)
@@ -46,6 +46,7 @@
#define TY_CCPAINTON ( 1 )
#define TY_CC_MAX_X ( 45 )
+#define TY_CC_MAX_Y ( 4 )
static int TY_CC_CUR_X;
static int TY_CC_CUR_Y;
@@ -65,21 +66,33 @@
static void ty_DrawOSD(void)
{
+ int index;
// printf( "Calling ty_DrawOSD()\n" );
+ for ( index = 1; index < SUB_MAX_TEXT ; index++ )
+ {
+ memcpy( ty_OSD1.text[ index ], ty_OSD2.text[ index ], TY_CC_MAX_X - 1 );
+ ty_OSD1.text[ index ][ TY_CC_MAX_X - 1 ] = 0;
+ }
tyOSDUpdate = 1;
}
-void ty_ClearOSD( int start )
+void ty_ClearOSD( int start, int osd )
{
int index;
// printf( "Calling ty_ClearOSD()\n" );
for ( index = start ; index < SUB_MAX_TEXT ; index++ )
{
+ if ( osd == 0 || osd == 1 )
+ {
memset( ty_OSD1.text[ index ], ' ', TY_CC_MAX_X - 1 );
ty_OSD1.text[ index ][ TY_CC_MAX_X - 1 ] = 0;
+ }
+ if ( osd == 0 || osd == 2 )
+ {
memset( ty_OSD2.text[ index ], ' ', TY_CC_MAX_X - 1 );
ty_OSD2.text[ index ][ TY_CC_MAX_X - 1 ] = 0;
}
+ }
}
static void ty_DrawChar( int *x, int *y, char disChar, int fgColor, int bgColor )
@@ -99,11 +112,11 @@
cy = SUB_MAX_TEXT - TY_CC_Y_Offset - 1;
}
- // printf( "Calling ty_DrawChar() x:%d y:%d %c fg:%d bg:%d\n",
+ // printf( "Calling ty_DrawChar() x:%d y:%d '%c' fg:%d bg:%d\n",
// cx, cy, disChar, fgColor, bgColor );
- ty_OSD1.text[ TY_CC_Y_Offset + cy ][ cx ] = disChar;
- memset( &( ty_OSD1.text[ TY_CC_Y_Offset + cy ][ cx + 1 ] ), ' ',
+ ty_OSD2.text[ TY_CC_Y_Offset + cy ][ cx ] = disChar;
+ memset( &( ty_OSD2.text[ TY_CC_Y_Offset + cy ][ cx + 1 ] ), ' ',
TY_CC_MAX_X - cx - 2 );
( *x )++;
}
@@ -117,31 +130,31 @@
//
if ( ( source + TY_CC_Y_Offset + numLines ) > SUB_MAX_TEXT )
{
- ty_ClearOSD( 1 );
+ ty_ClearOSD( 1, 1 );
return;
}
if ( ( source + TY_CC_Y_Offset + numLines ) < 0 )
{
- ty_ClearOSD( 1 );
+ ty_ClearOSD( 1, 1 );
return;
}
if ( numLines > SUB_MAX_TEXT )
{
- ty_ClearOSD( 1 );
+ ty_ClearOSD( 1, 1 );
return;
}
for ( index = 0 ; index < numLines ; index++ )
{
- strcpy( ty_OSD1.text[ TY_CC_Y_Offset + dest ],
- ty_OSD1.text[ TY_CC_Y_Offset + source ] );
+ strcpy( ty_OSD2.text[ TY_CC_Y_Offset + dest ],
+ ty_OSD2.text[ TY_CC_Y_Offset + source ] );
dest++;
source++;
}
- memset( ty_OSD1.text[ TY_CC_Y_Offset + source - 1 ], ' ', TY_CC_MAX_X - 1 );
- ty_OSD1.text[ TY_CC_Y_Offset + source - 1 ][ TY_CC_MAX_X - 1 ] = 0;
+ memset( ty_OSD2.text[ TY_CC_Y_Offset + source - 1 ], ' ', TY_CC_MAX_X - 1 );
+ ty_OSD2.text[ TY_CC_Y_Offset + source - 1 ][ TY_CC_MAX_X - 1 ] = 0;
}
static void ty_drawchar( char c )
@@ -185,6 +198,8 @@
11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10
};
+// these are kind of poor substitutes for the actual special characters
+char specialchar[] = { 'R', 'o', '/', '?', '*', 'c', 'E', '/', 'a', ' ', 'e', 'a', 'e', 'i', 'o', 'u' };
// char specialchar[] = { '??', '??', '??', '??', '*', '??', '??', 14, '??', ' ', '??', '??', '??', '??', '??', '??' };
static int ty_CCdecode( char b1, char b2 )
@@ -235,15 +250,19 @@
TY_CC_CUR_Y = CC_row[ ( ( b1 << 1 ) & 14 ) | ( ( b2 >> 5 ) & 1 ) ];
// Offset into MPlayer's Buffer
- if ( ( TY_CC_CUR_Y >= 1 ) && ( TY_CC_CUR_Y <= 4 ) )
+ if ( TY_CC_stat > TY_CCPAINTON ) {
+ TY_CC_CUR_Y = TY_CC_MAX_Y;
+ TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 1;
+ }
+ else if ( ( TY_CC_CUR_Y >= 1 ) && ( TY_CC_CUR_Y <= 4 ) )
{
TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 1;
}
- if ( ( TY_CC_CUR_Y >= 5 ) && ( TY_CC_CUR_Y <= 10 ) )
+ else if ( ( TY_CC_CUR_Y >= 5 ) && ( TY_CC_CUR_Y <= 10 ) )
{
TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 5;
}
- if ( ( TY_CC_CUR_Y >= 12 ) && ( TY_CC_CUR_Y <= 15 ) )
+ else if ( ( TY_CC_CUR_Y >= 12 ) && ( TY_CC_CUR_Y <= 15 ) )
{
TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 12;
}
@@ -332,8 +351,8 @@
}
else
{
- // ty_drawchar(specialchar[ b2 & 0x0f ] );
- ty_drawchar( ' ' );
+ ty_drawchar( specialchar[ b2 & 0x0f ] );
+ // ty_drawchar( ' ' );
}
break;
}
@@ -352,7 +371,7 @@
{
if ( TY_OSD_flags & TY_OSD_MODE &&
TY_CC_stat != TY_CCPOPUP )
- ty_ClearOSD( 1 );
+ ty_ClearOSD( 1, 2 );
TY_CC_stat = TY_CCPOPUP;
break;
}
@@ -365,9 +384,10 @@
case 0x25 ... 0x27: // 2-4 row captions
{
- if ( TY_CC_stat == TY_CCPOPUP ) ty_ClearOSD( 1 );
+ if ( TY_CC_stat == TY_CCPOPUP ) ty_ClearOSD( 1, 2 );
TY_CC_stat = b2 - 0x23;
- if ( TY_CC_CUR_Y < TY_CC_stat ) TY_CC_CUR_Y = TY_CC_stat;
+ TY_CC_CUR_Y = TY_CC_MAX_Y;
+ TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 1;
break;
}
@@ -396,12 +416,12 @@
{
if ( TY_CC_stat > TY_CCPOPUP || TY_CC_ptr == TY_CC_buf )
{
- ty_ClearOSD( 1 );
+ ty_ClearOSD( 1, 1 );
ty_draw();
}
else
{
- ty_ClearOSD( 1 );
+ ty_ClearOSD( 1, 1 );
// CRW -
// new buffer
@@ -441,7 +461,7 @@
if ( TY_OSD_debug && TY_CC_ptr != TY_CC_buf )
mp_msg( MSGT_DEMUX, MSGL_DBG3, "(TY_OSD_debug) %s\n",
TY_CC_buf );
- if ( TY_OSD_flags & TY_OSD_MODE ) ty_ClearOSD( 1 );
+ if ( TY_OSD_flags & TY_OSD_MODE ) ty_ClearOSD( 1, 2 );
TY_CC_CUR_X = 1;
TY_CC_CUR_Y = -1;
@@ -870,7 +890,7 @@
ty_OSD1.text[ index ] = malloc( TY_CC_MAX_X );
ty_OSD2.text[ index ] = malloc( TY_CC_MAX_X );
}
- ty_ClearOSD( 0 );
+ ty_ClearOSD( 0, 0 );
ty_OSD1.lines = SUB_MAX_TEXT;
ty_OSD2.lines = SUB_MAX_TEXT;
ty_pOSD1 = &ty_OSD1;
More information about the MPlayer-dev-eng
mailing list