1 // Most of this was written by Mike Baker <mbm@linux.com>
2 // and released under the GPL v2+ license.
4 // Modifications and SEVERE cleanup of the code was done by
8 // Released under GPL2 License.
21 //#include "stream/stream.h"
22 //#include "demuxer.h"
23 //#include "parse_es.h"
24 //#include "stheader.h"
25 //#include "mp3_hdr.h"
26 //#include "subreader.h"
28 #include "libvo/sub.h"
29 #include "demux_ty_osd.h"
31 //#include "dvdauth.h"
33 extern int sub_justify
;
35 #define TY_TEXT_MODE ( 1 << 0 )
36 #define TY_OSD_MODE ( 1 << 1 )
38 static int TY_OSD_flags
= TY_TEXT_MODE
| TY_OSD_MODE
;
39 static int TY_OSD_debug
= 0;
41 // ===========================================================================
42 // Closed Caption Decoding and OSD Presentation
43 // ===========================================================================
44 #define TY_CCNONE ( -3 )
45 #define TY_CCTEXTMODE ( -2 )
46 #define TY_CCPOPUPNB ( -1 )
47 #define TY_CCPOPUP ( 0 )
48 #define TY_CCPAINTON ( 1 )
50 #define TY_CC_MAX_X ( 45 )
52 static int TY_CC_CUR_X
;
53 static int TY_CC_CUR_Y
;
54 static int TY_CC_stat
= TY_CCNONE
;
55 static char TY_CC_buf
[ 255 ];
56 static char *TY_CC_ptr
= TY_CC_buf
;
57 static unsigned TY_CC_lastcap
= 0;
58 static int TY_CC_TextItalic
;
59 static int TY_CC_Y_Offset
;
61 static subtitle ty_OSD1
;
62 static subtitle ty_OSD2
;
63 static subtitle
*ty_pOSD1
;
64 static subtitle
*ty_pOSD2
;
65 static int tyOSDInitialized
= 0;
66 static int tyOSDUpdate
= 0;
68 static void ty_DrawOSD(void)
70 // printf( "Calling ty_DrawOSD()\n" );
74 void ty_ClearOSD( int start
)
77 // printf( "Calling ty_ClearOSD()\n" );
78 for ( index
= start
; index
< SUB_MAX_TEXT
; index
++ )
80 memset( ty_OSD1
.text
[ index
], ' ', TY_CC_MAX_X
- 1 );
81 ty_OSD1
.text
[ index
][ TY_CC_MAX_X
- 1 ] = 0;
82 memset( ty_OSD2
.text
[ index
], ' ', TY_CC_MAX_X
- 1 );
83 ty_OSD2
.text
[ index
][ TY_CC_MAX_X
- 1 ] = 0;
87 static void ty_DrawChar( int *x
, int *y
, char disChar
, int fgColor
, int bgColor
)
95 if ( *x
>= ( TY_CC_MAX_X
- 1 ) )
99 if ( ( *y
+ TY_CC_Y_Offset
) > SUB_MAX_TEXT
)
101 cy
= SUB_MAX_TEXT
- TY_CC_Y_Offset
- 1;
104 // printf( "Calling ty_DrawChar() x:%d y:%d %c fg:%d bg:%d\n",
105 // cx, cy, disChar, fgColor, bgColor );
107 ty_OSD1
.text
[ TY_CC_Y_Offset
+ cy
][ cx
] = disChar
;
108 memset( &( ty_OSD1
.text
[ TY_CC_Y_Offset
+ cy
][ cx
+ 1 ] ), ' ',
109 TY_CC_MAX_X
- cx
- 2 );
113 static void ty_RollupBuf( int dest
, int source
, int numLines
)
117 // printf( "Calling ty_RollupBuf() dest:%d source %d, numLines %d\n",
118 // dest, source, numLines );
120 if ( ( source
+ TY_CC_Y_Offset
+ numLines
) > SUB_MAX_TEXT
)
126 if ( ( source
+ TY_CC_Y_Offset
+ numLines
) < 0 )
132 if ( numLines
> SUB_MAX_TEXT
)
138 for ( index
= 0 ; index
< numLines
; index
++ )
140 strcpy( ty_OSD1
.text
[ TY_CC_Y_Offset
+ dest
],
141 ty_OSD1
.text
[ TY_CC_Y_Offset
+ source
] );
145 memset( ty_OSD1
.text
[ TY_CC_Y_Offset
+ source
- 1 ], ' ', TY_CC_MAX_X
- 1 );
146 ty_OSD1
.text
[ TY_CC_Y_Offset
+ source
- 1 ][ TY_CC_MAX_X
- 1 ] = 0;
149 static void ty_drawchar( char c
)
153 if ( TY_OSD_flags
& TY_OSD_MODE
&& TY_CC_stat
!= TY_CCNONE
&&
155 ty_DrawChar( &TY_CC_CUR_X
, &TY_CC_CUR_Y
, c
, 4, 13 );
157 if ( TY_CC_ptr
- TY_CC_buf
> sizeof( TY_CC_buf
) - 1 )
159 TY_CC_ptr
= TY_CC_buf
;
160 memset( TY_CC_buf
, 0, sizeof( TY_CC_buf
) );
162 *( TY_CC_ptr
++ ) = ( c
== 14 ) ? '/' : c
; // swap a '/' for musical note
165 static void ty_draw(void)
167 if ( TY_CC_ptr
!= TY_CC_buf
&& TY_OSD_flags
& TY_TEXT_MODE
)
169 if ( *( TY_CC_ptr
- 1 ) == '\n' ) *( TY_CC_ptr
- 1 ) = 0;
171 mp_msg( MSGT_DEMUX
, MSGL_V
, "CC: %s\n", TY_CC_buf
);
173 TY_CC_lastcap
= time( NULL
);
175 TY_CC_ptr
= TY_CC_buf
;
176 memset( TY_CC_buf
, 0, sizeof( TY_CC_buf
) );
178 if ( TY_OSD_flags
& TY_OSD_MODE
) ty_DrawOSD();
179 if ( TY_CC_TextItalic
) TY_CC_TextItalic
= 0;
183 static int CC_last
= 0;
184 static char CC_mode
= 0;
185 static int CC_row
[] =
187 11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10
190 // char specialchar[] = { '®', '°', '½', '¿', '*', '¢', '£', 14, 'à', ' ', 'è', 'â', 'ê', 'î', 'ô', 'û' };
192 static int ty_CCdecode( char b1
, char b2
)
195 int data
= ( b2
<< 8 ) + b1
;
197 if ( b1
& 0x60 ) // text
199 if ( !TY_OSD_debug
&& TY_CC_stat
== TY_CCNONE
) return 0;
200 if ( TY_OSD_debug
> 3 )
202 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "%c %c", b1
, b2
);
207 if ( TY_CC_stat
> 0 && TY_OSD_flags
& TY_OSD_MODE
) ty_DrawOSD();
209 else if ( ( b1
& 0x10 ) && ( b2
> 0x1F ) && ( data
!= CC_last
) )
211 #define CURRENT ( ( b1 & 0x08 ) >> 3 )
213 if ( CC_mode
!= CURRENT
&& TY_CC_stat
!= TY_CCNONE
)
215 if ( TY_OSD_debug
&& TY_CC_ptr
!= TY_CC_buf
) ty_draw();
216 TY_CC_stat
= TY_CCNONE
;
220 if ( TY_CC_stat
== TY_CCNONE
|| TY_CC_CUR_Y
== -1 )
222 if ( TY_CC_ptr
!= TY_CC_buf
)
225 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "(TY_OSD_debug) %s\n",
227 TY_CC_ptr
= TY_CC_buf
;
228 memset(TY_CC_buf
, 0, sizeof(TY_CC_buf
));
231 if ( CC_mode
!= CURRENT
) return 0;
234 // preamble address code (row & indent)
237 TY_CC_CUR_Y
= CC_row
[ ( ( b1
<< 1 ) & 14 ) | ( ( b2
>> 5 ) & 1 ) ];
239 // Offset into MPlayer's Buffer
240 if ( ( TY_CC_CUR_Y
>= 1 ) && ( TY_CC_CUR_Y
<= 4 ) )
242 TY_CC_Y_Offset
= SUB_MAX_TEXT
- 5 - 1;
244 if ( ( TY_CC_CUR_Y
>= 5 ) && ( TY_CC_CUR_Y
<= 10 ) )
246 TY_CC_Y_Offset
= SUB_MAX_TEXT
- 5 - 5;
248 if ( ( TY_CC_CUR_Y
>= 12 ) && ( TY_CC_CUR_Y
<= 15 ) )
250 TY_CC_Y_Offset
= SUB_MAX_TEXT
- 5 - 12;
253 if ( TY_OSD_debug
> 3 )
254 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<< preamble %d >>\n", TY_CC_CUR_Y
);
256 // we still have something in the text buffer
257 if (TY_CC_ptr
!= TY_CC_buf
)
259 *(TY_CC_ptr
++) = '\n';
260 if ( TY_CC_TextItalic
)
262 TY_CC_TextItalic
= 0;
267 // row contains indent flag
270 for ( x
= 0 ; x
< ( ( b2
& 0x0F ) << 1 ) ; x
++ )
273 *(TY_CC_ptr
++) = ' ';
280 if ( TY_OSD_debug
> 3 )
281 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<< %02x >>\n", b1
& 0x7 );
284 case 0x00: // attribute
286 if ( TY_OSD_debug
> 1 )
287 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<<A: %d>>\n", b2
);
290 case 0x01: // midrow or char
294 case 0x20: // midrow attribute change
298 case 0x00: // italics off
300 TY_CC_TextItalic
= 0;
301 *(TY_CC_ptr
++) = ' ';
304 case 0x0e: // italics on
307 TY_CC_TextItalic
= 1;
312 if ( TY_OSD_debug
> 1 )
313 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<<D: %d>>\n",
319 // TextUnderline = 1;
323 // TextUnderline = 0;
327 case 0x30: // special character..
330 if ( ( b2
& 0x0f ) == 9 )
333 *(TY_CC_ptr
++) = ' ';
337 // ty_drawchar(specialchar[ b2 & 0x0f ] );
347 case 0x05: // misc + F
349 if ( TY_OSD_debug
> 3 )
350 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<< misc %02x >>\n", b2
);
353 case 0x20: // resume caption (new caption)
355 if ( TY_OSD_flags
& TY_OSD_MODE
&&
356 TY_CC_stat
!= TY_CCPOPUP
)
358 TY_CC_stat
= TY_CCPOPUP
;
362 case 0x21: // backspace
368 case 0x25: // 2-4 row captions
372 if ( TY_CC_stat
== TY_CCPOPUP
) ty_ClearOSD( 1 );
373 TY_CC_stat
= b2
- 0x23;
374 if ( TY_CC_CUR_Y
< TY_CC_stat
) TY_CC_CUR_Y
= TY_CC_stat
;
378 case 0x29: // resume direct caption
380 TY_CC_stat
= TY_CCPAINTON
;
384 case 0x2A: // text restart
390 case 0x2B: // resume text display
392 TY_CC_stat
= TY_CCTEXTMODE
;
396 case 0x2C: // erase displayed memory
399 if ( TY_OSD_flags
& TY_OSD_MODE
)
401 if ( TY_CC_stat
> TY_CCPOPUP
|| TY_CC_ptr
== TY_CC_buf
)
412 // Used to be a buffer swap here, dunno why
418 case 0x2D: // carriage return
422 if ( TY_OSD_flags
& TY_OSD_MODE
)
424 if ( TY_CC_stat
> TY_CCPAINTON
)
427 TY_CC_CUR_Y
- TY_CC_stat
+ 1 ,
428 TY_CC_CUR_Y
- TY_CC_stat
+ 2,
437 case 0x2F: // end caption + swap memory
440 /* FALL THROUGH TO 0x2E */
443 case 0x2E: // erase non-displayed memory
445 if ( TY_OSD_debug
&& TY_CC_ptr
!= TY_CC_buf
)
446 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "(TY_OSD_debug) %s\n",
448 if ( TY_OSD_flags
& TY_OSD_MODE
) ty_ClearOSD( 1 );
453 TY_CC_ptr
= TY_CC_buf
;
454 memset( TY_CC_buf
, 0, sizeof( TY_CC_buf
) );
459 case 0x07: // misc (TAB)
461 for ( x
= 0 ; x
< ( b2
- 0x20 ) ; x
++ )
472 // ===========================================================================
473 // Extended Data Service Decoding and OSD Presentation
474 // ===========================================================================
475 #define XDS_BUFFER_LENGTH ( 16 )
476 #define XDS_DISPLAY_FRAMES ( 120 )
477 static char *ty_XDS_Display
[ XDS_BUFFER_LENGTH
];
478 static int ty_XDSAddLine
= -1;
479 static int ty_XDSDisplayCount
= -1;
482 static void ty_AddXDSToDisplay( const char *format
, ... )
488 if ( ty_XDSAddLine
== -1 )
490 for( index
= 0 ; index
< XDS_BUFFER_LENGTH
; index
++ )
492 ty_XDS_Display
[ index
] = 0;
497 va_start( ap
, format
);
498 vsnprintf( line
, 80, format
, ap
);
500 mp_msg( MSGT_DEMUX
, MSGL_V
, "XDS: %s\n", line
);
502 if ( ty_XDSAddLine
== XDS_BUFFER_LENGTH
)
504 mp_msg( MSGT_DEMUX
, MSGL_ERR
, "XDS Buffer would have been blown\n" );
507 if ( ty_XDS_Display
[ ty_XDSAddLine
] != 0 )
509 free( ty_XDS_Display
[ ty_XDSAddLine
] );
510 ty_XDS_Display
[ ty_XDSAddLine
] = 0;
513 ty_XDS_Display
[ ty_XDSAddLine
] = malloc( strlen( line
) + 1 );
514 strcpy( ty_XDS_Display
[ ty_XDSAddLine
], line
);
519 static void ty_DisplayXDSInfo(void)
524 if ( ty_XDSDisplayCount
== -1 )
526 for( index
= 0 ; index
< XDS_BUFFER_LENGTH
; index
++ )
528 if ( ty_XDS_Display
[ index
] != 0 )
533 if ( index
!= XDS_BUFFER_LENGTH
)
535 size
= strlen( ty_XDS_Display
[ index
] );
537 // Right Justify the XDS Stuff
538 memcpy( &( ty_OSD1
.text
[ 0 ][ TY_CC_MAX_X
- size
- 1 ] ),
539 ty_XDS_Display
[ index
], size
);
540 free( ty_XDS_Display
[ index
] );
541 ty_XDS_Display
[ index
] = 0;
542 ty_XDSDisplayCount
= 0;
548 // We cleaned out all the XDS stuff to be displayed
554 // We displayed that piece of XDS information long enough
556 ty_XDSDisplayCount
++;
557 if ( ty_XDSDisplayCount
>= XDS_DISPLAY_FRAMES
)
559 memset( ty_OSD1
.text
[ 0 ], ' ', TY_CC_MAX_X
- 1 );
560 ty_OSD1
.text
[ 0 ][ TY_CC_MAX_X
- 1 ] = 0;
561 ty_XDSDisplayCount
= -1;
568 static int TY_XDS_mode
= 0;
569 static int TY_XDS_type
= 0;
570 static int TY_XDS_length
= 0;
571 static char TY_XDS_checksum
= 0;
573 // Array of [ Mode ][ Type ][ Length ]
574 static char TY_XDS
[ 8 ][ 25 ][ 34 ];
575 static char TY_XDS_new
[ 8 ][ 25 ][ 34 ];
577 // Array of [ MPAARating|TVRating ][ NumberRatings ]
578 static const char * const TY_XDS_CHIP
[ 2 ][ 8 ] =
580 { "(NOT APPLICABLE)", "G", "PG", "PG-13", "R", "NC-17", "X", "(NOT RATED)" },
581 { "(NOT RATED)", "TV-Y", "TV-Y7", "TV-G", "TV-PG", "TV-14", "TV-MA",
585 static const char * const TY_XDS_modes
[] =
587 "CURRENT", // 01h-02h current program
588 "FUTURE ", // 03h-04h future program
589 "CHANNEL", // 05h-06h channel
590 "MISC. ", // 07h-08h miscellaneous
591 "PUBLIC ", // 09h-0Ah public service
592 "RESERV.", // 0Bh-0Ch reserved
599 static int ty_XDSdecode( char b1
, char b2
)
606 TY_XDS_mode
= b1
>> 1; // every other mode is a resume
608 TY_XDS_checksum
= b1
+ b2
;
612 TY_XDS_checksum
+= b1
+ b2
;
614 // eof (next byte is checksum)
618 if ( !TY_XDS_length
|| TY_XDS_checksum
& 0x7F )
620 if ( TY_OSD_debug
> 3 && !TY_XDS_length
)
622 mp_msg( MSGT_DEMUX
, MSGL_DBG3
,
623 "%% TY_XDS CHECKSUM ERROR (ignoring)\n" );
633 // check to see if the data has changed.
634 if ( strncmp( TY_XDS
[ TY_XDS_mode
][ TY_XDS_type
],
635 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
], TY_XDS_length
- 1 ) )
637 char *TY_XDS_ptr
= TY_XDS
[ TY_XDS_mode
][ TY_XDS_type
];
639 TY_XDS_ptr
[ TY_XDS_length
] = 0;
640 memcpy( TY_XDS
[ TY_XDS_mode
][ TY_XDS_type
],
641 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
], TY_XDS_length
);
643 // nasty hack: only print time codes if seconds are 0
644 if ( TY_XDS_mode
== 3 && TY_XDS_type
== 1 &&
645 !( TY_XDS_new
[ 3 ][ 1 ][ 3 ] & 0x20 ) )
649 if ( TY_XDS_mode
== 0 && TY_XDS_type
== 2 &&
650 ( TY_XDS_new
[ 0 ][ 2 ][ 4 ] & 0x3f ) > 1 )
655 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "%% %s ", TY_XDS_modes
[ TY_XDS_mode
] );
658 // printf( "XDS Code %x\n",
659 // ( TY_XDS_mode << 9 ) + TY_XDS_type + 0x100 );
660 switch ( ( TY_XDS_mode
<< 9 ) + TY_XDS_type
+ 0x100 )
662 // cases are specified in 2 bytes hex representing mode, type.
663 // TY_XDS_ptr will point to the current class buffer
664 case 0x0101: // current
665 case 0x0301: // future
669 "0", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
670 "Aug", "Sep", "Oct", "Nov", "Dec", "13", "14", "15"
672 ty_AddXDSToDisplay( "AIR DATE: %s %2d %d:%02d:00",
673 mon
[ TY_XDS_ptr
[ 3 ] & 0x0f ],
674 TY_XDS_ptr
[ 2 ] & 0x1f,
675 TY_XDS_ptr
[ 1 ] & 0x1f,
676 TY_XDS_ptr
[ 0 ] & 0x3f
679 // Program is tape delayed
680 if ( TY_XDS_ptr
[ 3 ] & 0x10 ) ty_AddXDSToDisplay( " TAPE" );
684 case 0x0102: // current program length
685 case 0x0302: // future
688 "DURATION: %d:%02d:%02d of %d:%02d:%02d",
689 TY_XDS_ptr
[ 3 ] & 0x3f,
690 TY_XDS_ptr
[ 2 ] & 0x3f,
691 TY_XDS_ptr
[ 4 ] & 0x3f,
692 TY_XDS_ptr
[ 1 ] & 0x3f,
693 TY_XDS_ptr
[ 0 ] & 0x3f, 0);
697 case 0x0103: // current program name
698 case 0x0303: // future
700 ty_AddXDSToDisplay( "TITLE: %s", TY_XDS_ptr
);
704 case 0x0104: // current program type
705 case 0x0304: // future
707 // for now just print out the raw data
708 // requires a 127 string array to parse
709 // properly and isn't worth it.
710 sprintf ( line
, "%sGENRE:", line
);
713 for ( x
= 0 ; x
< TY_XDS_length
; x
++ )
714 sprintf( line
, "%s %02x", line
, TY_XDS_ptr
[ x
] );
716 ty_AddXDSToDisplay( line
);
720 case 0x0105: // current program rating
721 case 0x0305: // future
723 sprintf( line
, "%sRATING: %s", line
,
724 TY_XDS_CHIP
[ ( TY_XDS_ptr
[ 0 ] & 0x08 ) >> 3 ]
725 [ TY_XDS_ptr
[ 1 ] & 0x07 ] );
726 if ( TY_XDS_ptr
[ 0 ] & 0x20 )
727 sprintf( line
, "%s DIALOGUE", line
);
728 if ( TY_XDS_ptr
[ 1 ] & 0x08 )
729 sprintf( line
, "%s LANGUAGE", line
);
730 if ( TY_XDS_ptr
[ 1 ] & 0x10 )
731 sprintf( line
, "%s SEXUAL", line
);
732 if ( TY_XDS_ptr
[ 1 ] & 0x20 )
733 sprintf( line
, "%s VIOLENCE", line
);
734 ty_AddXDSToDisplay( line
);
736 // raw output for verification.
737 if ( TY_OSD_debug
> 1 )
738 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, " (%02x %02x)",
739 TY_XDS_ptr
[ 0 ], TY_XDS_ptr
[ 1 ] );
743 case 0x0106: // current program audio services
744 case 0x0306: // future
746 // requires table, never actually seen it used either
747 ty_AddXDSToDisplay( "AUDIO: %02x %02x", TY_XDS_ptr
[ 0 ],
752 case 0x0109: // current program aspect ratio
753 case 0x0309: // future
755 // requires table, rare
756 ty_AddXDSToDisplay( "ASPECT: %02x %02x",
757 TY_XDS_ptr
[ 0 ], TY_XDS_ptr
[ 1 ] );
761 case 0x0110: // program description
770 ty_AddXDSToDisplay( "DESCRIP: %s", TY_XDS_ptr
);
774 case 0x0501: // channel network name
776 ty_AddXDSToDisplay( "NETWORK: %s", TY_XDS_ptr
);
780 case 0x0502: // channel network call letters
782 ty_AddXDSToDisplay( "CALLSIGN: %s", TY_XDS_ptr
);
786 case 0x0701: // misc. time of day
788 #define TIMEZONE ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x1f )
789 #define DST ( ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x20 ) >> 5 )
793 .tm_min
= ( TY_XDS_ptr
[ 0 ] & 0x3F ), // min
794 .tm_hour
= ( TY_XDS_ptr
[ 1 ] & 0x1F ), // hour
795 .tm_mday
= ( TY_XDS_ptr
[ 2 ] & 0x1F ), // day
796 .tm_mon
= ( TY_XDS_ptr
[ 3 ] & 0x1f ) - 1, // month
797 .tm_year
= ( TY_XDS_ptr
[ 5 ] & 0x3f ) + 90, // year
798 .tm_wday
= 0, // day of week
799 .tm_yday
= 0, // day of year
800 .tm_isdst
= 0, // DST
803 time_t time_t = mktime( &tm
);
806 time_t -= ( ( TIMEZONE
- DST
) * 60 * 60 );
807 timestr
= ctime( &time_t );
808 timestr
[ strlen( timestr
) - 1 ] = 0;
810 sprintf( line
, "%sCUR.TIME: %s ", line
, timestr
);
811 if ( TY_XDS
[ 3 ][ 4 ][ 0 ] )
813 sprintf( line
, "%sUTC-%d", line
, TIMEZONE
);
814 if (DST
) sprintf( line
, "%s DST", line
);
817 sprintf( line
, "%sUTC", line
);
819 ty_AddXDSToDisplay( line
);
824 case 0x0704: //misc. local time zone
826 sprintf( line
, "%sTIMEZONE: UTC-%d",
827 line
, TY_XDS_ptr
[ 0 ] & 0x1f );
828 if ( TY_XDS_ptr
[ 0 ] & 0x20 ) sprintf( line
, "%s DST", line
);
829 ty_AddXDSToDisplay( line
);
835 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "UNKNOWN CLASS %d TYPE %d",
836 ( TY_XDS_mode
<< 1 ) + 1, TY_XDS_type
);
837 if ( TY_OSD_debug
> 1 )
840 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "\nDUMP:\n" );
841 for ( x
= 0 ; x
< TY_XDS_length
; x
++ )
842 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, " %02x %c",
843 TY_XDS_ptr
[ x
], TY_XDS_ptr
[ x
] );
844 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "\n" );
848 if ( TY_OSD_debug
> 1 )
849 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, " (%d)", TY_XDS_length
);
854 else if ( TY_XDS_length
< 34 )
856 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
][ TY_XDS_length
++ ] = b1
;
857 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
][ TY_XDS_length
++ ] = b2
;
863 // ===========================================================================
864 // Callback from Video Display Processing to put up the OSD
865 // ===========================================================================
866 void ty_processuserdata( unsigned char* buf
, int len
)
874 if ( tyOSDInitialized
== 0 )
876 for ( index
= 0; index
< SUB_MAX_TEXT
; index
++ )
878 ty_OSD1
.text
[ index
] = malloc( TY_CC_MAX_X
);
879 ty_OSD2
.text
[ index
] = malloc( TY_CC_MAX_X
);
882 ty_OSD1
.lines
= SUB_MAX_TEXT
;
883 ty_OSD2
.lines
= SUB_MAX_TEXT
;
887 tyOSDInitialized
= 1;
890 if ( buf
[ 0 ] == 0x01 )
892 ty_CCdecode( buf
[ 1 ], buf
[ 2 ] );
894 if ( buf
[ 0 ] == 0x02 )
896 ty_XDSdecode( buf
[ 1 ], buf
[ 2 ] );
903 // for ( index = 0; index < SUB_MAX_TEXT ; index++ )
905 // printf( "OSD:%d:%s\n", index, ty_OSD1.text[ index ] );
908 vo_osd_changed( OSDTYPE_SUBTITLE
);