1 // Most of this was written by mbm@linux.com and released on the GPL2 License.
3 // Modifications and SEVERE cleanup of the code was done by
7 // Released under GPL2 License.
21 //#include "demuxer.h"
22 //#include "parse_es.h"
23 //#include "stheader.h"
24 //#include "mp3_hdr.h"
25 //#include "subreader.h"
27 #include "libvo/sub.h"
29 //#include "dvdauth.h"
31 extern int sub_justify
;
33 #define TY_TEXT_MODE ( 1 << 0 )
34 #define TY_OSD_MODE ( 1 << 1 )
36 static int TY_OSD_flags
= TY_TEXT_MODE
| TY_OSD_MODE
;
37 static int TY_OSD_debug
= 0;
39 // ===========================================================================
40 // Closed Caption Decoding and OSD Presentation
41 // ===========================================================================
42 #define TY_CCNONE ( -3 )
43 #define TY_CCTEXTMODE ( -2 )
44 #define TY_CCPOPUPNB ( -1 )
45 #define TY_CCPOPUP ( 0 )
46 #define TY_CCPAINTON ( 1 )
48 #define TY_CC_MAX_X ( 45 )
50 static int TY_CC_CUR_X
;
51 static int TY_CC_CUR_Y
;
52 static int TY_CC_stat
= TY_CCNONE
;
53 static char TY_CC_buf
[ 255 ];
54 static char *TY_CC_ptr
= TY_CC_buf
;
55 static unsigned TY_CC_lastcap
= 0;
56 static int TY_CC_TextItalic
;
57 static int TY_CC_Y_Offset
;
59 static subtitle ty_OSD1
;
60 static subtitle ty_OSD2
;
61 static subtitle
*ty_pOSD1
;
62 static subtitle
*ty_pOSD2
;
63 static int tyOSDInited
= 0;
64 static int tyOSDUpdate
= 0;
66 static void ty_DrawOSD(void)
68 // printf( "Calling ty_DrawOSD()\n" );
72 void ty_ClearOSD( int start
)
75 // printf( "Calling ty_ClearOSD()\n" );
76 for ( index
= start
; index
< SUB_MAX_TEXT
; index
++ )
78 memset( ty_OSD1
.text
[ index
], ' ', TY_CC_MAX_X
- 1 );
79 ty_OSD1
.text
[ index
][ TY_CC_MAX_X
- 1 ] = 0;
80 memset( ty_OSD2
.text
[ index
], ' ', TY_CC_MAX_X
- 1 );
81 ty_OSD2
.text
[ index
][ TY_CC_MAX_X
- 1 ] = 0;
85 static void ty_DrawChar( int *x
, int *y
, char disChar
, int fgColor
, int bgColor
)
94 if ( *x
>= ( TY_CC_MAX_X
- 1 ) )
98 if ( ( *y
+ TY_CC_Y_Offset
) > SUB_MAX_TEXT
)
100 cy
= SUB_MAX_TEXT
- TY_CC_Y_Offset
- 1;
103 // printf( "Calling ty_DrawChar() x:%d y:%d %c fg:%d bg:%d\n",
104 // cx, cy, disChar, fgColor, bgColor );
106 ty_OSD1
.text
[ TY_CC_Y_Offset
+ cy
][ cx
] = disChar
;
107 memset( &( ty_OSD1
.text
[ TY_CC_Y_Offset
+ cy
][ cx
+ 1 ] ), ' ',
108 TY_CC_MAX_X
- cx
- 2 );
112 static void ty_RollupBuf( int dest
, int source
, int numLines
)
116 // printf( "Calling ty_RollupBuf() dest:%d source %d, numLines %d\n",
117 // dest, source, numLines );
119 if ( ( source
+ TY_CC_Y_Offset
+ numLines
) > SUB_MAX_TEXT
)
125 if ( ( source
+ TY_CC_Y_Offset
+ numLines
) < 0 )
131 if ( numLines
> SUB_MAX_TEXT
)
137 for ( index
= 0 ; index
< numLines
; index
++ )
139 strcpy( ty_OSD1
.text
[ TY_CC_Y_Offset
+ dest
],
140 ty_OSD1
.text
[ TY_CC_Y_Offset
+ source
] );
144 memset( ty_OSD1
.text
[ TY_CC_Y_Offset
+ source
- 1 ], ' ', TY_CC_MAX_X
- 1 );
145 ty_OSD1
.text
[ TY_CC_Y_Offset
+ source
- 1 ][ TY_CC_MAX_X
- 1 ] = 0;
148 static void ty_drawchar( char c
)
152 if ( TY_OSD_flags
& TY_OSD_MODE
&& TY_CC_stat
!= TY_CCNONE
&&
154 ty_DrawChar( &TY_CC_CUR_X
, &TY_CC_CUR_Y
, c
, 4, 13 );
156 if ( TY_CC_ptr
- TY_CC_buf
> sizeof( TY_CC_buf
) - 1 )
158 TY_CC_ptr
= TY_CC_buf
;
159 memset( TY_CC_buf
, 0, sizeof( TY_CC_buf
) );
161 *( TY_CC_ptr
++ ) = ( c
== 14 ) ? '/' : c
; // swap a '/' for musical note
164 static void ty_draw(void)
166 if ( TY_CC_ptr
!= TY_CC_buf
&& TY_OSD_flags
& TY_TEXT_MODE
)
168 if ( *( TY_CC_ptr
- 1 ) == '\n' ) *( TY_CC_ptr
- 1 ) = 0;
170 mp_msg( MSGT_DEMUX
, MSGL_V
, "CC: %s\n", TY_CC_buf
);
172 TY_CC_lastcap
= time( NULL
);
174 TY_CC_ptr
= TY_CC_buf
;
175 memset( TY_CC_buf
, 0, sizeof( TY_CC_buf
) );
177 if ( TY_OSD_flags
& TY_OSD_MODE
) ty_DrawOSD();
178 if ( TY_CC_TextItalic
) TY_CC_TextItalic
= 0;
182 static int CC_last
= 0;
183 static char CC_mode
= 0;
184 static int CC_row
[] =
186 11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10
189 // char specialchar[] = { '®', '°', '½', '¿', '*', '¢', '£', 14, 'à', ' ', 'è', 'â', 'ê', 'î', 'ô', 'û' };
191 static int ty_CCdecode( char b1
, char b2
)
194 int data
= ( b2
<< 8 ) + b1
;
196 if ( b1
& 0x60 ) // text
198 if ( !TY_OSD_debug
&& TY_CC_stat
== TY_CCNONE
) return 0;
199 if ( TY_OSD_debug
> 3 )
201 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "%c %c", b1
, b2
);
206 if ( TY_CC_stat
> 0 && TY_OSD_flags
& TY_OSD_MODE
) ty_DrawOSD();
208 else if ( ( b1
& 0x10 ) && ( b2
> 0x1F ) && ( data
!= CC_last
) )
210 #define CURRENT ( ( b1 & 0x08 ) >> 3 )
212 if ( CC_mode
!= CURRENT
&& TY_CC_stat
!= TY_CCNONE
)
214 if ( TY_OSD_debug
&& TY_CC_ptr
!= TY_CC_buf
) ty_draw();
215 TY_CC_stat
= TY_CCNONE
;
219 if ( TY_CC_stat
== TY_CCNONE
|| TY_CC_CUR_Y
== -1 )
221 if ( TY_CC_ptr
!= TY_CC_buf
)
224 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "(TY_OSD_debug) %s\n",
226 TY_CC_ptr
= TY_CC_buf
;
227 memset(TY_CC_buf
, 0, sizeof(TY_CC_buf
));
230 if ( CC_mode
!= CURRENT
) return 0;
233 // preamble address code (row & indent)
236 TY_CC_CUR_Y
= CC_row
[ ( ( b1
<< 1 ) & 14 ) | ( ( b2
>> 5 ) & 1 ) ];
238 // Offset into MPlayer's Buffer
239 if ( ( TY_CC_CUR_Y
>= 1 ) && ( TY_CC_CUR_Y
<= 4 ) )
241 TY_CC_Y_Offset
= SUB_MAX_TEXT
- 5 - 1;
243 if ( ( TY_CC_CUR_Y
>= 5 ) && ( TY_CC_CUR_Y
<= 10 ) )
245 TY_CC_Y_Offset
= SUB_MAX_TEXT
- 5 - 5;
247 if ( ( TY_CC_CUR_Y
>= 12 ) && ( TY_CC_CUR_Y
<= 15 ) )
249 TY_CC_Y_Offset
= SUB_MAX_TEXT
- 5 - 12;
252 if ( TY_OSD_debug
> 3 )
253 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<< preamble %d >>\n", TY_CC_CUR_Y
);
255 // we still have something in the text buffer
256 if (TY_CC_ptr
!= TY_CC_buf
)
258 *(TY_CC_ptr
++) = '\n';
259 if ( TY_CC_TextItalic
)
261 TY_CC_TextItalic
= 0;
266 // row contains indent flag
269 for ( x
= 0 ; x
< ( ( b2
& 0x0F ) << 1 ) ; x
++ )
272 *(TY_CC_ptr
++) = ' ';
279 if ( TY_OSD_debug
> 3 )
280 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<< %02x >>\n", b1
& 0x7 );
283 case 0x00: // attribute
285 if ( TY_OSD_debug
> 1 )
286 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<<A: %d>>\n", b2
);
289 case 0x01: // midrow or char
293 case 0x20: // midrow attribute change
297 case 0x00: // italics off
299 TY_CC_TextItalic
= 0;
300 *(TY_CC_ptr
++) = ' ';
303 case 0x0e: // italics on
306 TY_CC_TextItalic
= 1;
311 if ( TY_OSD_debug
> 1 )
312 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<<D: %d>>\n",
318 // TextUnderline = 1;
322 // TextUnderline = 0;
326 case 0x30: // special character..
329 if ( ( b2
& 0x0f ) == 9 )
332 *(TY_CC_ptr
++) = ' ';
336 // ty_drawchar(specialchar[ b2 & 0x0f ] );
346 case 0x05: // misc + F
348 if ( TY_OSD_debug
> 3 )
349 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "<< misc %02x >>\n", b2
);
352 case 0x20: // resume caption (new caption)
354 if ( TY_OSD_flags
& TY_OSD_MODE
&&
355 TY_CC_stat
!= TY_CCPOPUP
)
357 TY_CC_stat
= TY_CCPOPUP
;
361 case 0x21: // backspace
367 case 0x25 ... 0x27: // 2-4 row captions
369 if ( TY_CC_stat
== TY_CCPOPUP
) ty_ClearOSD( 1 );
370 TY_CC_stat
= b2
- 0x23;
371 if ( TY_CC_CUR_Y
< TY_CC_stat
) TY_CC_CUR_Y
= TY_CC_stat
;
375 case 0x29: // resume direct caption
377 TY_CC_stat
= TY_CCPAINTON
;
381 case 0x2A: // text restart
387 case 0x2B: // resume text display
389 TY_CC_stat
= TY_CCTEXTMODE
;
393 case 0x2C: // erase displayed memory
396 if ( TY_OSD_flags
& TY_OSD_MODE
)
398 if ( TY_CC_stat
> TY_CCPOPUP
|| TY_CC_ptr
== TY_CC_buf
)
409 // Used to be a buffer swap here, dunno why
415 case 0x2D: // carriage return
419 if ( TY_OSD_flags
& TY_OSD_MODE
)
421 if ( TY_CC_stat
> TY_CCPAINTON
)
424 TY_CC_CUR_Y
- TY_CC_stat
+ 1 ,
425 TY_CC_CUR_Y
- TY_CC_stat
+ 2,
434 case 0x2F: // end caption + swap memory
437 /* FALL THROUGH TO 0x2E */
440 case 0x2E: // erase non-displayed memory
442 if ( TY_OSD_debug
&& TY_CC_ptr
!= TY_CC_buf
)
443 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "(TY_OSD_debug) %s\n",
445 if ( TY_OSD_flags
& TY_OSD_MODE
) ty_ClearOSD( 1 );
450 TY_CC_ptr
= TY_CC_buf
;
451 memset( TY_CC_buf
, 0, sizeof( TY_CC_buf
) );
456 case 0x07: // misc (TAB)
458 for ( x
= 0 ; x
< ( b2
- 0x20 ) ; x
++ )
469 // ===========================================================================
470 // Extended Data Service Decoding and OSD Presentation
471 // ===========================================================================
472 #define XDS_BUFFER_LENGTH ( 16 )
473 #define XDS_DISPLAY_FRAMES ( 120 )
474 static char *ty_XDS_Display
[ XDS_BUFFER_LENGTH
];
475 static int ty_XDSAddLine
= -1;
476 static int ty_XDSDisplayCount
= -1;
479 static void ty_AddXDSToDisplay( char *format
, ... )
485 if ( ty_XDSAddLine
== -1 )
487 for( index
= 0 ; index
< XDS_BUFFER_LENGTH
; index
++ )
489 ty_XDS_Display
[ index
] = 0;
494 va_start( ap
, format
);
495 vsnprintf( line
, 80, format
, ap
);
497 mp_msg( MSGT_DEMUX
, MSGL_V
, "XDS: %s\n", line
);
499 if ( ty_XDSAddLine
== XDS_BUFFER_LENGTH
)
501 mp_msg( MSGT_DEMUX
, MSGL_ERR
, "XDS Buffer would have been blown\n" );
504 if ( ty_XDS_Display
[ ty_XDSAddLine
] != 0 )
506 free( ty_XDS_Display
[ ty_XDSAddLine
] );
507 ty_XDS_Display
[ ty_XDSAddLine
] = 0;
510 ty_XDS_Display
[ ty_XDSAddLine
] = malloc( strlen( line
) + 1 );
511 strcpy( ty_XDS_Display
[ ty_XDSAddLine
], line
);
516 static void ty_DisplayXDSInfo(void)
521 if ( ty_XDSDisplayCount
== -1 )
523 for( index
= 0 ; index
< XDS_BUFFER_LENGTH
; index
++ )
525 if ( ty_XDS_Display
[ index
] != 0 )
530 if ( index
!= XDS_BUFFER_LENGTH
)
532 size
= strlen( ty_XDS_Display
[ index
] );
534 // Right Justify the XDS Stuff
535 memcpy( &( ty_OSD1
.text
[ 0 ][ TY_CC_MAX_X
- size
- 1 ] ),
536 ty_XDS_Display
[ index
], size
);
537 free( ty_XDS_Display
[ index
] );
538 ty_XDS_Display
[ index
] = 0;
539 ty_XDSDisplayCount
= 0;
545 // We cleaned out all the XDS stuff to be displayed
551 // We displayed that piece of XDS information long enough
553 ty_XDSDisplayCount
++;
554 if ( ty_XDSDisplayCount
>= XDS_DISPLAY_FRAMES
)
556 memset( ty_OSD1
.text
[ 0 ], ' ', TY_CC_MAX_X
- 1 );
557 ty_OSD1
.text
[ 0 ][ TY_CC_MAX_X
- 1 ] = 0;
558 ty_XDSDisplayCount
= -1;
565 static int TY_XDS_mode
= 0;
566 static int TY_XDS_type
= 0;
567 static int TY_XDS_length
= 0;
568 static char TY_XDS_checksum
= 0;
570 // Array of [ Mode ][ Type ][ Length ]
571 static char TY_XDS
[ 8 ][ 25 ][ 34 ];
572 static char TY_XDS_new
[ 8 ][ 25 ][ 34 ];
574 // Array of [ MPAARating|TVRating ][ NumberRatings ]
575 static char *TY_XDS_CHIP
[ 2 ][ 8 ] =
577 { "(NOT APPLICABLE)", "G", "PG", "PG-13", "R", "NC-17", "X", "(NOT RATED)" },
578 { "(NOT RATED)", "TV-Y", "TV-Y7", "TV-G", "TV-PG", "TV-14", "TV-MA",
582 static char *TY_XDS_modes
[] =
584 "CURRENT", // 01h-02h current program
585 "FUTURE ", // 03h-04h future program
586 "CHANNEL", // 05h-06h channel
587 "MISC. ", // 07h-08h miscellaneous
588 "PUBLIC ", // 09h-0Ah public service
589 "RESERV.", // 0Bh-0Ch reserved
596 static int ty_XDSdecode( char b1
, char b2
)
603 TY_XDS_mode
= b1
>> 1; // every other mode is a resume
605 TY_XDS_checksum
= b1
+ b2
;
609 TY_XDS_checksum
+= b1
+ b2
;
611 // eof (next byte is checksum)
615 if ( !TY_XDS_length
|| TY_XDS_checksum
& 0x7F )
617 if ( TY_OSD_debug
> 3 && !TY_XDS_length
)
619 mp_msg( MSGT_DEMUX
, MSGL_DBG3
,
620 "%% TY_XDS CHECKSUM ERROR (ignoring)\n" );
630 // check to see if the data has changed.
631 if ( strncmp( TY_XDS
[ TY_XDS_mode
][ TY_XDS_type
],
632 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
], TY_XDS_length
- 1 ) )
634 char *TY_XDS_ptr
= TY_XDS
[ TY_XDS_mode
][ TY_XDS_type
];
636 TY_XDS_ptr
[ TY_XDS_length
] = 0;
637 memcpy( TY_XDS
[ TY_XDS_mode
][ TY_XDS_type
],
638 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
], TY_XDS_length
);
640 // nasty hack: only print time codes if seconds are 0
641 if ( TY_XDS_mode
== 3 && TY_XDS_type
== 1 &&
642 !( TY_XDS_new
[ 3 ][ 1 ][ 3 ] & 0x20 ) )
646 if ( TY_XDS_mode
== 0 && TY_XDS_type
== 2 &&
647 ( TY_XDS_new
[ 0 ][ 2 ][ 4 ] & 0x3f ) > 1 )
652 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "%% %s ", TY_XDS_modes
[ TY_XDS_mode
] );
655 // printf( "XDS Code %x\n",
656 // ( TY_XDS_mode << 9 ) + TY_XDS_type + 0x100 );
657 switch ( ( TY_XDS_mode
<< 9 ) + TY_XDS_type
+ 0x100 )
659 // cases are specified in 2 bytes hex representing mode, type.
660 // TY_XDS_ptr will point to the current class buffer
661 case 0x0101: // current
662 case 0x0301: // future
666 "0", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
667 "Aug", "Sep", "Oct", "Nov", "Dec", "13", "14", "15"
669 ty_AddXDSToDisplay( "AIR DATE: %s %2d %d:%02d:00",
670 mon
[ TY_XDS_ptr
[ 3 ] & 0x0f ],
671 TY_XDS_ptr
[ 2 ] & 0x1f,
672 TY_XDS_ptr
[ 1 ] & 0x1f,
673 TY_XDS_ptr
[ 0 ] & 0x3f
676 // Program is tape delayed
677 if ( TY_XDS_ptr
[ 3 ] & 0x10 ) ty_AddXDSToDisplay( " TAPE" );
681 case 0x0102: // current program length
682 case 0x0302: // future
685 "DURATION: %d:%02d:%02d of %d:%02d:%02d",
686 TY_XDS_ptr
[ 3 ] & 0x3f,
687 TY_XDS_ptr
[ 2 ] & 0x3f,
688 TY_XDS_ptr
[ 4 ] & 0x3f,
689 TY_XDS_ptr
[ 1 ] & 0x3f,
690 TY_XDS_ptr
[ 0 ] & 0x3f, 0);
694 case 0x0103: // current program name
695 case 0x0303: // future
697 ty_AddXDSToDisplay( "TITLE: %s", TY_XDS_ptr
);
701 case 0x0104: // current program type
702 case 0x0304: // future
704 // for now just print out the raw data
705 // requires a 127 string array to parse
706 // properly and isn't worth it.
707 sprintf ( line
, "%sGENRE:", line
);
710 for ( x
= 0 ; x
< TY_XDS_length
; x
++ )
711 sprintf( line
, "%s %02x", line
, TY_XDS_ptr
[ x
] );
713 ty_AddXDSToDisplay( line
);
717 case 0x0105: // current program rating
718 case 0x0305: // future
720 sprintf( line
, "%sRATING: %s", line
,
721 TY_XDS_CHIP
[ ( TY_XDS_ptr
[ 0 ] & 0x08 ) >> 3 ]
722 [ TY_XDS_ptr
[ 1 ] & 0x07 ] );
723 if ( TY_XDS_ptr
[ 0 ] & 0x20 )
724 sprintf( line
, "%s DIALOGUE", line
);
725 if ( TY_XDS_ptr
[ 1 ] & 0x08 )
726 sprintf( line
, "%s LANGUAGE", line
);
727 if ( TY_XDS_ptr
[ 1 ] & 0x10 )
728 sprintf( line
, "%s SEXUAL", line
);
729 if ( TY_XDS_ptr
[ 1 ] & 0x20 )
730 sprintf( line
, "%s VIOLENCE", line
);
731 ty_AddXDSToDisplay( line
);
733 // raw output for verification.
734 if ( TY_OSD_debug
> 1 )
735 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, " (%02x %02x)",
736 TY_XDS_ptr
[ 0 ], TY_XDS_ptr
[ 1 ] );
740 case 0x0106: // current program audio services
741 case 0x0306: // future
743 // requires table, never actually seen it used either
744 ty_AddXDSToDisplay( "AUDIO: %02x %02x", TY_XDS_ptr
[ 0 ],
749 case 0x0109: // current program aspect ratio
750 case 0x0309: // future
752 // requires table, rare
753 ty_AddXDSToDisplay( "ASPECT: %02x %02x",
754 TY_XDS_ptr
[ 0 ], TY_XDS_ptr
[ 1 ] );
758 case 0x0110 ... 0x0117: // program description
760 ty_AddXDSToDisplay( "DESCRIP: %s", TY_XDS_ptr
);
764 case 0x0501: // channel network name
766 ty_AddXDSToDisplay( "NETWORK: %s", TY_XDS_ptr
);
770 case 0x0502: // channel network call letters
772 ty_AddXDSToDisplay( "CALLSIGN: %s", TY_XDS_ptr
);
776 case 0x0701: // misc. time of day
778 #define TIMEZONE ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x1f )
779 #define DST ( ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x20 ) >> 5 )
783 .tm_min
= ( TY_XDS_ptr
[ 0 ] & 0x3F ), // min
784 .tm_hour
= ( TY_XDS_ptr
[ 1 ] & 0x1F ), // hour
785 .tm_mday
= ( TY_XDS_ptr
[ 2 ] & 0x1F ), // day
786 .tm_mon
= ( TY_XDS_ptr
[ 3 ] & 0x1f ) - 1, // month
787 .tm_year
= ( TY_XDS_ptr
[ 5 ] & 0x3f ) + 90, // year
788 .tm_wday
= 0, // day of week
789 .tm_yday
= 0, // day of year
790 .tm_isdst
= 0, // DST
793 time_t time_t = mktime( &tm
);
796 time_t -= ( ( TIMEZONE
- DST
) * 60 * 60 );
797 timestr
= ctime( &time_t );
798 timestr
[ strlen( timestr
) - 1 ] = 0;
800 sprintf( line
, "%sCUR.TIME: %s ", line
, timestr
);
801 if ( TY_XDS
[ 3 ][ 4 ][ 0 ] )
803 sprintf( line
, "%sUTC-%d", line
, TIMEZONE
);
804 if (DST
) sprintf( line
, "%s DST", line
);
807 sprintf( line
, "%sUTC", line
);
809 ty_AddXDSToDisplay( line
);
814 case 0x0704: //misc. local time zone
816 sprintf( line
, "%sTIMEZONE: UTC-%d",
817 line
, TY_XDS_ptr
[ 0 ] & 0x1f );
818 if ( TY_XDS_ptr
[ 0 ] & 0x20 ) sprintf( line
, "%s DST", line
);
819 ty_AddXDSToDisplay( line
);
825 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "UNKNOWN CLASS %d TYPE %d",
826 ( TY_XDS_mode
<< 1 ) + 1, TY_XDS_type
);
827 if ( TY_OSD_debug
> 1 )
830 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "\nDUMP:\n" );
831 for ( x
= 0 ; x
< TY_XDS_length
; x
++ )
832 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, " %02x %c",
833 TY_XDS_ptr
[ x
], TY_XDS_ptr
[ x
] );
834 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, "\n" );
838 if ( TY_OSD_debug
> 1 )
839 mp_msg( MSGT_DEMUX
, MSGL_DBG3
, " (%d)", TY_XDS_length
);
844 else if ( TY_XDS_length
< 34 )
846 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
][ TY_XDS_length
++ ] = b1
;
847 TY_XDS_new
[ TY_XDS_mode
][ TY_XDS_type
][ TY_XDS_length
++ ] = b2
;
854 static char *testline
= "0123456789012345678901234567890123456789012";
856 // ===========================================================================
857 // Callback from Video Display Processing to put up the OSD
858 // ===========================================================================
859 void ty_processuserdata( unsigned char* buf
, int len
)
867 if ( tyOSDInited
== 0 )
869 for ( index
= 0; index
< SUB_MAX_TEXT
; index
++ )
871 ty_OSD1
.text
[ index
] = malloc( TY_CC_MAX_X
);
872 ty_OSD2
.text
[ index
] = malloc( TY_CC_MAX_X
);
875 ty_OSD1
.lines
= SUB_MAX_TEXT
;
876 ty_OSD2
.lines
= SUB_MAX_TEXT
;
883 if ( buf
[ 0 ] == 0x01 )
885 ty_CCdecode( buf
[ 1 ], buf
[ 2 ] );
887 if ( buf
[ 0 ] == 0x02 )
889 ty_XDSdecode( buf
[ 1 ], buf
[ 2 ] );
896 // for ( index = 0; index < SUB_MAX_TEXT ; index++ )
898 // printf( "OSD:%d:%s\n", index, ty_OSD1.text[ index ] );
901 vo_osd_changed( OSDTYPE_SUBTITLE
);