annotate libmpdemux/demux_ty_osd.c @ 17094:cb35587c8156

fix vf_phase.c:101: warning: suggest parentheses around + or - inside shift vf_phase.c:102: warning: suggest parentheses around + or - inside shift vf_phase.c:105: warning: suggest parentheses around + or - inside shift vf_phase.c:106: warning: suggest parentheses around + or - inside shift vf_phase.c:112: warning: suggest parentheses around + or - inside shift vf_phase.c:113: warning: suggest parentheses around + or - inside shift vf_phase.c:116: warning: suggest parentheses around + or - inside shift vf_phase.c:117: warning: suggest parentheses around + or - inside shift vf_phase.c:123: warning: suggest parentheses around + or - inside shift vf_phase.c:124: warning: suggest parentheses around + or - inside shift vf_phase.c:127: warning: suggest parentheses around + or - inside shift vf_phase.c:128: warning: suggest parentheses around + or - inside shift vf_phase.c:134: warning: suggest parentheses around + or - inside shift vf_phase.c:135: warning: suggest parentheses around + or - inside shift vf_phase.c:136: warning: suggest parentheses around + or - inside shift vf_phase.c:139: warning: suggest parentheses around + or - inside shift vf_phase.c:140: warning: suggest parentheses around + or - inside shift vf_phase.c:141: warning: suggest parentheses around + or - inside shift
author rathann
date Mon, 05 Dec 2005 01:28:59 +0000
parents 6ff3379a0862
children f580a7755ac5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10263
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
1 // Most of this was written by mbm@linux.com and released on the GPL2 License.
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
2 //
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
3 // Modifications and SEVERE cleanup of the code was done by
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
4 // Christopher Wingert
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
5 // Copyright 2003
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
6 //
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
7 // Released under GPL2 License.
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
8
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
9 #include <stdio.h>
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
10 #include <stdlib.h>
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
11 #include <unistd.h>
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
12 #include <time.h>
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
13 #include <stdarg.h>
10310
68e714ed669f fix one missing #include, one missing extern and one 10l error.
rathann
parents: 10263
diff changeset
14 #include <string.h>
10263
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
15
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
16 #include "config.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
17 #include "mp_msg.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
18 #include "help_mp.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
19
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
20 //#include "stream.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
21 //#include "demuxer.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
22 //#include "parse_es.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
23 //#include "stheader.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
24 //#include "mp3_hdr.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11000
diff changeset
25 //#include "subreader.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11000
diff changeset
26 #include "sub_cc.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11000
diff changeset
27 #include "libvo/sub.h"
10263
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
28
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
29 //#include "dvdauth.h"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
30
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
31 extern int sub_justify;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
32
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
33 #define TY_TEXT_MODE ( 1 << 0 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
34 #define TY_OSD_MODE ( 1 << 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
35
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
36 static int TY_OSD_flags = TY_TEXT_MODE | TY_OSD_MODE;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
37 static int TY_OSD_debug = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
38
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
39 // ===========================================================================
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
40 // Closed Caption Decoding and OSD Presentation
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
41 // ===========================================================================
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
42 #define TY_CCNONE ( -3 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
43 #define TY_CCTEXTMODE ( -2 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
44 #define TY_CCPOPUPNB ( -1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
45 #define TY_CCPOPUP ( 0 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
46 #define TY_CCPAINTON ( 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
47
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
48 #define TY_CC_MAX_X ( 45 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
49
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
50 static int TY_CC_CUR_X;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
51 static int TY_CC_CUR_Y;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
52 static int TY_CC_stat = TY_CCNONE;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
53 static char TY_CC_buf[ 255 ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
54 static char *TY_CC_ptr = TY_CC_buf;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
55 static unsigned TY_CC_lastcap = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
56 static int TY_CC_TextItalic;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
57 static int TY_CC_Y_Offset;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
58
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
59 static subtitle ty_OSD1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
60 static subtitle ty_OSD2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
61 static subtitle *ty_pOSD1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
62 static subtitle *ty_pOSD2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
63 static int tyOSDInited = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
64 static int tyOSDUpdate = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
65
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
66 static void ty_DrawOSD()
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
67 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
68 // printf( "Calling ty_DrawOSD()\n" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
69 tyOSDUpdate = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
70 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
71
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
72 void ty_ClearOSD( int start )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
73 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
74 int index;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
75 // printf( "Calling ty_ClearOSD()\n" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
76 for ( index = start ; index < SUB_MAX_TEXT ; index++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
77 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
78 memset( ty_OSD1.text[ index ], ' ', TY_CC_MAX_X - 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
79 ty_OSD1.text[ index ][ TY_CC_MAX_X - 1 ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
80 memset( ty_OSD2.text[ index ], ' ', TY_CC_MAX_X - 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
81 ty_OSD2.text[ index ][ TY_CC_MAX_X - 1 ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
82 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
83 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
84
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
85 static void ty_DrawChar( int *x, int *y, char disChar, int fgColor, int bgColor )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
86 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
87 int index;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
88 int cx;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
89 int cy;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
90
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
91 cx = *x;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
92 cy = *y;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
93
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
94 if ( *x >= ( TY_CC_MAX_X - 1 ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
95 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
96 cx = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
97 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
98 if ( ( *y + TY_CC_Y_Offset ) > SUB_MAX_TEXT )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
99 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
100 cy = SUB_MAX_TEXT - TY_CC_Y_Offset - 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
101 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
102
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
103 // printf( "Calling ty_DrawChar() x:%d y:%d %c fg:%d bg:%d\n",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
104 // cx, cy, disChar, fgColor, bgColor );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
105
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
106 ty_OSD1.text[ TY_CC_Y_Offset + cy ][ cx ] = disChar;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
107 memset( &( ty_OSD1.text[ TY_CC_Y_Offset + cy ][ cx + 1 ] ), ' ',
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
108 TY_CC_MAX_X - cx - 2 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
109 ( *x )++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
110 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
111
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
112 static void ty_RollupBuf( int dest, int source, int numLines )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
113 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
114 int index;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
115
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
116 // printf( "Calling ty_RollupBuf() dest:%d source %d, numLines %d\n",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
117 // dest, source, numLines );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
118 //
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
119 if ( ( source + TY_CC_Y_Offset + numLines ) > SUB_MAX_TEXT )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
120 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
121 ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
122 return;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
123 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
124
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
125 if ( ( source + TY_CC_Y_Offset + numLines ) < 0 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
126 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
127 ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
128 return;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
129 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
130
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
131 if ( numLines > SUB_MAX_TEXT )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
132 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
133 ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
134 return;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
135 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
136
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
137 for ( index = 0 ; index < numLines ; index++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
138 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
139 strcpy( ty_OSD1.text[ TY_CC_Y_Offset + dest ],
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
140 ty_OSD1.text[ TY_CC_Y_Offset + source ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
141 dest++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
142 source++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
143 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
144 memset( ty_OSD1.text[ TY_CC_Y_Offset + source - 1 ], ' ', TY_CC_MAX_X - 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
145 ty_OSD1.text[ TY_CC_Y_Offset + source - 1 ][ TY_CC_MAX_X - 1 ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
146 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
147
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
148 static void ty_drawchar( char c )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
149 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
150 if ( c < 2 ) return;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
151
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
152 if ( TY_OSD_flags & TY_OSD_MODE && TY_CC_stat != TY_CCNONE &&
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
153 TY_CC_CUR_Y != -1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
154 ty_DrawChar( &TY_CC_CUR_X, &TY_CC_CUR_Y, c, 4, 13 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
155
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
156 if ( TY_CC_ptr - TY_CC_buf > sizeof( TY_CC_buf ) - 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
157 { // buffer overflow
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
158 TY_CC_ptr = TY_CC_buf;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
159 memset( TY_CC_buf, 0, sizeof( TY_CC_buf ) );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
160 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
161 *( TY_CC_ptr++ ) = ( c == 14 ) ? '/' : c; // swap a '/' for musical note
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
162 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
163
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
164 static void ty_draw()
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
165 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
166 if ( TY_CC_ptr != TY_CC_buf && TY_OSD_flags & TY_TEXT_MODE )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
167 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
168 if ( *( TY_CC_ptr - 1 ) == '\n' ) *( TY_CC_ptr - 1 ) = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
169
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
170 mp_msg( MSGT_DEMUX, MSGL_V, "CC: %s\n", TY_CC_buf );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
171 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
172 TY_CC_lastcap = time( NULL );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
173
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
174 TY_CC_ptr = TY_CC_buf;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
175 memset( TY_CC_buf, 0, sizeof( TY_CC_buf) );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
176
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
177 if ( TY_OSD_flags & TY_OSD_MODE ) ty_DrawOSD();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
178 if ( TY_CC_TextItalic ) TY_CC_TextItalic = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
179 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
180
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
181
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
182 static int CC_last = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
183 static char CC_mode = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
184 static int CC_row[] =
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
185 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
186 11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
187 };
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
188
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
189 // char specialchar[] = { '®', '°', '½', '¿', '*', '¢', '£', 14, 'à', ' ', 'è', 'â', 'ê', 'î', 'ô', 'û' };
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
190
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
191 static int ty_CCdecode( char b1, char b2 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
192 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
193 int x;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
194 int data = ( b2 << 8 ) + b1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
195
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
196 if ( b1 & 0x60 ) // text
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
197 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
198 if ( !TY_OSD_debug && TY_CC_stat == TY_CCNONE ) return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
199 if ( TY_OSD_debug > 3 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
200 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
201 mp_msg( MSGT_DEMUX, MSGL_DBG3, "%c %c", b1, b2 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
202 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
203 ty_drawchar( b1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
204 ty_drawchar( b2 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
205
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
206 if ( TY_CC_stat > 0 && TY_OSD_flags & TY_OSD_MODE ) ty_DrawOSD();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
207 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
208 else if ( ( b1 & 0x10 ) && ( b2 > 0x1F ) && ( data != CC_last ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
209 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
210 #define CURRENT ( ( b1 & 0x08 ) >> 3 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
211
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
212 if ( CC_mode != CURRENT && TY_CC_stat != TY_CCNONE )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
213 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
214 if ( TY_OSD_debug && TY_CC_ptr != TY_CC_buf ) ty_draw();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
215 TY_CC_stat = TY_CCNONE;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
216 return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
217 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
218
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
219 if ( TY_CC_stat == TY_CCNONE || TY_CC_CUR_Y == -1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
220 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
221 if ( TY_CC_ptr != TY_CC_buf )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
222 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
223 if ( TY_OSD_debug )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
224 mp_msg( MSGT_DEMUX, MSGL_DBG3, "(TY_OSD_debug) %s\n",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
225 TY_CC_buf );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
226 TY_CC_ptr = TY_CC_buf;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
227 memset(TY_CC_buf, 0, sizeof(TY_CC_buf));
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
228 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
229
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
230 if ( CC_mode != CURRENT ) return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
231 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
232
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
233 // preamble address code (row & indent)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
234 if ( b2 & 0x40 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
235 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
236 TY_CC_CUR_Y = CC_row[ ( ( b1 << 1 ) & 14 ) | ( ( b2 >> 5 ) & 1 ) ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
237
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
238 // Offset into MPlayer's Buffer
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
239 if ( ( TY_CC_CUR_Y >= 1 ) && ( TY_CC_CUR_Y <= 4 ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
240 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
241 TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
242 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
243 if ( ( TY_CC_CUR_Y >= 5 ) && ( TY_CC_CUR_Y <= 10 ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
244 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
245 TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 5;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
246 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
247 if ( ( TY_CC_CUR_Y >= 12 ) && ( TY_CC_CUR_Y <= 15 ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
248 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
249 TY_CC_Y_Offset = SUB_MAX_TEXT - 5 - 12;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
250 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
251
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
252 if ( TY_OSD_debug > 3 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
253 mp_msg( MSGT_DEMUX, MSGL_DBG3, "<< preamble %d >>\n", TY_CC_CUR_Y );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
254
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
255 // we still have something in the text buffer
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
256 if (TY_CC_ptr != TY_CC_buf)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
257 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
258 *(TY_CC_ptr++) = '\n';
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
259 if ( TY_CC_TextItalic )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
260 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
261 TY_CC_TextItalic = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
262 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
263 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
264
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
265 TY_CC_CUR_X = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
266 // row contains indent flag
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
267 if ( b2 & 0x10 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
268 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
269 for ( x = 0 ; x < ( ( b2 & 0x0F ) << 1 ) ; x++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
270 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
271 TY_CC_CUR_X++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
272 *(TY_CC_ptr++) = ' ';
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
273 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
274 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
275 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
276 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
277 // !(b2 & 0x40)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
278 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
279 if ( TY_OSD_debug > 3 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
280 mp_msg( MSGT_DEMUX, MSGL_DBG3, "<< %02x >>\n", b1 & 0x7 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
281 switch (b1 & 0x07)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
282 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
283 case 0x00: // attribute
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
284 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
285 if ( TY_OSD_debug > 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
286 mp_msg( MSGT_DEMUX, MSGL_DBG3, "<<A: %d>>\n", b2 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
287 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
288 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
289 case 0x01: // midrow or char
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
290 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
291 switch (b2 & 0x70)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
292 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
293 case 0x20: // midrow attribute change
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
294 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
295 switch (b2 & 0x0e)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
296 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
297 case 0x00: // italics off
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
298 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
299 TY_CC_TextItalic = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
300 *(TY_CC_ptr++) = ' ';
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
301 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
302 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
303 case 0x0e: // italics on
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
304 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
305 ty_drawchar(' ');
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
306 TY_CC_TextItalic = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
307 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
308 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
309 default:
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
310 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
311 if ( TY_OSD_debug > 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
312 mp_msg( MSGT_DEMUX, MSGL_DBG3, "<<D: %d>>\n",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
313 b2 & 0x0e );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
314 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
315 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
316 if ( b2 & 0x01 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
317 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
318 // TextUnderline = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
319 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
320 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
321 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
322 // TextUnderline = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
323 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
324 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
325 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
326 case 0x30: // special character..
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
327 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
328 // transparent space
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
329 if ( ( b2 & 0x0f ) == 9 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
330 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
331 TY_CC_CUR_X++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
332 *(TY_CC_ptr++) = ' ';
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
333 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
334 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
335 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
336 // ty_drawchar(specialchar[ b2 & 0x0f ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
337 ty_drawchar( ' ' );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
338 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
339 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
340 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
341 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
342 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
343 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
344
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
345 case 0x04: // misc
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
346 case 0x05: // misc + F
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
347 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
348 if ( TY_OSD_debug > 3 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
349 mp_msg( MSGT_DEMUX, MSGL_DBG3, "<< misc %02x >>\n", b2 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
350 switch ( b2 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
351 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
352 case 0x20: // resume caption (new caption)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
353 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
354 if ( TY_OSD_flags & TY_OSD_MODE &&
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
355 TY_CC_stat != TY_CCPOPUP )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
356 ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
357 TY_CC_stat = TY_CCPOPUP;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
358 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
359 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
360
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
361 case 0x21: // backspace
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
362 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
363 TY_CC_CUR_X--;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
364 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
365 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
366
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
367 case 0x25 ... 0x27: // 2-4 row captions
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
368 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
369 if ( TY_CC_stat == TY_CCPOPUP ) ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
370 TY_CC_stat = b2 - 0x23;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
371 if ( TY_CC_CUR_Y < TY_CC_stat ) TY_CC_CUR_Y = TY_CC_stat;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
372 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
373 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
374
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
375 case 0x29: // resume direct caption
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
376 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
377 TY_CC_stat = TY_CCPAINTON;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
378 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
379 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
380
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
381 case 0x2A: // text restart
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
382 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
383 ty_draw();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
384 /* FALL */
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
385 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
386
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
387 case 0x2B: // resume text display
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
388 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
389 TY_CC_stat = TY_CCTEXTMODE;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
390 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
391 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
392
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
393 case 0x2C: // erase displayed memory
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
394 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
395 TY_CC_lastcap = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
396 if ( TY_OSD_flags & TY_OSD_MODE )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
397 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
398 if ( TY_CC_stat > TY_CCPOPUP || TY_CC_ptr == TY_CC_buf )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
399 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
400 ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
401 ty_draw();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
402 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
403 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
404 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
405 ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
406
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
407 // CRW -
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
408 // new buffer
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
409 // Used to be a buffer swap here, dunno why
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
410 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
411 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
412 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
413 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
414
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
415 case 0x2D: // carriage return
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
416 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
417 ty_draw();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
418 TY_CC_CUR_X = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
419 if ( TY_OSD_flags & TY_OSD_MODE )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
420 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
421 if ( TY_CC_stat > TY_CCPAINTON )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
422 ty_RollupBuf
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
423 (
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
424 TY_CC_CUR_Y - TY_CC_stat + 1 ,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
425 TY_CC_CUR_Y - TY_CC_stat + 2,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
426 TY_CC_stat - 1
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
427 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
428 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
429 TY_CC_CUR_Y++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
430 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
431 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
432 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
433
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
434 case 0x2F: // end caption + swap memory
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
435 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
436 ty_draw();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
437 /* FALL THROUGH TO 0x2E */
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
438 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
439
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
440 case 0x2E: // erase non-displayed memory
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
441 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
442 if ( TY_OSD_debug && TY_CC_ptr != TY_CC_buf )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
443 mp_msg( MSGT_DEMUX, MSGL_DBG3, "(TY_OSD_debug) %s\n",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
444 TY_CC_buf );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
445 if ( TY_OSD_flags & TY_OSD_MODE ) ty_ClearOSD( 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
446
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
447 TY_CC_CUR_X = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
448 TY_CC_CUR_Y = -1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
449
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
450 TY_CC_ptr = TY_CC_buf;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
451 memset( TY_CC_buf, 0, sizeof( TY_CC_buf ) );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
452 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
453 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
454 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
455 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
456 case 0x07: // misc (TAB)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
457 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
458 for ( x = 0 ; x < ( b2 - 0x20 ) ; x++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
459 TY_CC_CUR_X++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
460 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
461 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
462 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
463 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
464 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
465 CC_last = data;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
466 return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
467 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
468
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
469 // ===========================================================================
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
470 // Extended Data Service Decoding and OSD Presentation
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
471 // ===========================================================================
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
472 #define XDS_BUFFER_LENGTH ( 16 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
473 #define XDS_DISPLAY_FRAMES ( 120 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
474 static char *ty_XDS_Display[ XDS_BUFFER_LENGTH ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
475 static int ty_XDSAddLine = -1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
476 static int ty_XDSDisplayCount = -1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
477
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
478
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
479 static void ty_AddXDSToDisplay( char *format, ... )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
480 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
481 char line[ 80 ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
482 int index;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
483 va_list ap;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
484
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
485 if ( ty_XDSAddLine == -1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
486 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
487 for( index = 0 ; index < XDS_BUFFER_LENGTH ; index++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
488 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
489 ty_XDS_Display[ index ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
490 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
491 ty_XDSAddLine = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
492 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
493
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
494 va_start( ap, format );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
495 vsnprintf( line, 80, format, ap );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
496 va_end( ap );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
497 mp_msg( MSGT_DEMUX, MSGL_V, "XDS: %s\n", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
498
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
499 if ( ty_XDSAddLine == XDS_BUFFER_LENGTH )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
500 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
501 mp_msg( MSGT_DEMUX, MSGL_ERR, "XDS Buffer would have been blown\n" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
502 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
503
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
504 if ( ty_XDS_Display[ ty_XDSAddLine ] != 0 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
505 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
506 free( ty_XDS_Display[ ty_XDSAddLine ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
507 ty_XDS_Display[ ty_XDSAddLine ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
508 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
509
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
510 ty_XDS_Display[ ty_XDSAddLine ] = malloc( strlen( line ) + 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
511 strcpy( ty_XDS_Display[ ty_XDSAddLine ], line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
512 ty_XDSAddLine++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
513 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
514
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
515
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
516 static void ty_DisplayXDSInfo()
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
517 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
518 int index;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
519 int size;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
520
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
521 if ( ty_XDSDisplayCount == -1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
522 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
523 for( index = 0 ; index < XDS_BUFFER_LENGTH ; index++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
524 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
525 if ( ty_XDS_Display[ index ] != 0 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
526 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
527 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
528 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
529 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
530 if ( index != XDS_BUFFER_LENGTH )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
531 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
532 size = strlen( ty_XDS_Display[ index ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
533
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
534 // Right Justify the XDS Stuff
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
535 memcpy( &( ty_OSD1.text[ 0 ][ TY_CC_MAX_X - size - 1 ] ),
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
536 ty_XDS_Display[ index ], size );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
537 free( ty_XDS_Display[ index ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
538 ty_XDS_Display[ index ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
539 ty_XDSDisplayCount = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
540 tyOSDUpdate = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
541
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
542 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
543 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
544 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
545 // We cleaned out all the XDS stuff to be displayed
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
546 ty_XDSAddLine = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
547 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
548 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
549 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
550 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
551 // We displayed that piece of XDS information long enough
11000
6e35326c742f many small typo and grammar fixes
gabucino
parents: 10858
diff changeset
552 // Let's move on
10263
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
553 ty_XDSDisplayCount++;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
554 if ( ty_XDSDisplayCount >= XDS_DISPLAY_FRAMES )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
555 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
556 memset( ty_OSD1.text[ 0 ], ' ', TY_CC_MAX_X - 1 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
557 ty_OSD1.text[ 0 ][ TY_CC_MAX_X - 1 ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
558 ty_XDSDisplayCount = -1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
559 tyOSDUpdate = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
560 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
561 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
562 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
563
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
564
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
565 static int TY_XDS_mode = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
566 static int TY_XDS_type = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
567 static int TY_XDS_length = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
568 static char TY_XDS_checksum = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
569
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
570 // Array of [ Mode ][ Type ][ Length ]
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
571 static char TY_XDS [ 8 ][ 25 ][ 34 ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
572 static char TY_XDS_new[ 8 ][ 25 ][ 34 ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
573
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
574 // Array of [ MPAARating|TVRating ][ NumberRatings ]
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
575 static char *TY_XDS_CHIP[ 2 ][ 8 ] =
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
576 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
577 { "(NOT APPLICABLE)", "G", "PG", "PG-13", "R", "NC-17", "X", "(NOT RATED)" },
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
578 { "(NOT RATED)", "TV-Y", "TV-Y7", "TV-G", "TV-PG", "TV-14", "TV-MA",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
579 "(NOT RATED)" }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
580 };
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
581
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
582 static char *TY_XDS_modes[] =
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
583 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
584 "CURRENT", // 01h-02h current program
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
585 "FUTURE ", // 03h-04h future program
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
586 "CHANNEL", // 05h-06h channel
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
587 "MISC. ", // 07h-08h miscellaneous
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
588 "PUBLIC ", // 09h-0Ah public service
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
589 "RESERV.", // 0Bh-0Ch reserved
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
590 "UNDEF. ",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
591 "INVALID",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
592 "INVALID",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
593 "INVALID"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
594 };
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
595
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
596 static int ty_XDSdecode( char b1, char b2 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
597 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
598 char line[ 80 ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
599
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
600 if ( b1 < 0x0F )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
601 { // start packet
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
602 TY_XDS_length = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
603 TY_XDS_mode = b1 >> 1; // every other mode is a resume
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
604 TY_XDS_type = b2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
605 TY_XDS_checksum = b1 + b2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
606 return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
607 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
608
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
609 TY_XDS_checksum += b1 + b2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
610
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
611 // eof (next byte is checksum)
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
612 if ( b1 == 0x0F )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
613 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
614 // validity check
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
615 if ( !TY_XDS_length || TY_XDS_checksum & 0x7F )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
616 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
617 if ( TY_OSD_debug > 3 && !TY_XDS_length )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
618 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
619 mp_msg( MSGT_DEMUX, MSGL_DBG3,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
620 "%% TY_XDS CHECKSUM ERROR (ignoring)\n" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
621 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
622 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
623 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
624 TY_XDS_mode = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
625 TY_XDS_type = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
626 return 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
627 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
628 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
629
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
630 // check to see if the data has changed.
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
631 if ( strncmp( TY_XDS[ TY_XDS_mode ][ TY_XDS_type ],
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
632 TY_XDS_new[ TY_XDS_mode ][ TY_XDS_type ], TY_XDS_length - 1 ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
633 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
634 char *TY_XDS_ptr = TY_XDS[ TY_XDS_mode ][ TY_XDS_type ];
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
635
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
636 TY_XDS_ptr[ TY_XDS_length ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
637 memcpy( TY_XDS[ TY_XDS_mode ][ TY_XDS_type ],
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
638 TY_XDS_new[ TY_XDS_mode ][ TY_XDS_type ], TY_XDS_length );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
639
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
640 // nasty hack: only print time codes if seconds are 0
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
641 if ( TY_XDS_mode == 3 && TY_XDS_type == 1 &&
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
642 !( TY_XDS_new[ 3 ][ 1 ][ 3 ] & 0x20 ) )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
643 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
644 return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
645 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
646 if ( TY_XDS_mode == 0 && TY_XDS_type == 2 &&
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
647 ( TY_XDS_new[ 0 ][ 2 ][ 4 ] & 0x3f ) > 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
648 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
649 return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
650 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
651
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
652 mp_msg( MSGT_DEMUX, MSGL_DBG3, "%% %s ", TY_XDS_modes[ TY_XDS_mode ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
653
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
654 line[ 0 ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
655 // printf( "XDS Code %x\n",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
656 // ( TY_XDS_mode << 9 ) + TY_XDS_type + 0x100 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
657 switch ( ( TY_XDS_mode << 9 ) + TY_XDS_type + 0x100 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
658 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
659 // cases are specified in 2 bytes hex representing mode, type.
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
660 // TY_XDS_ptr will point to the current class buffer
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
661 case 0x0101: // current
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
662 case 0x0301: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
663 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
664 char *mon[] =
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
665 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
666 "0", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
667 "Aug", "Sep", "Oct", "Nov", "Dec", "13", "14", "15"
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
668 };
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
669 ty_AddXDSToDisplay( "AIR DATE: %s %2d %d:%02d:00",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
670 mon[ TY_XDS_ptr[ 3 ] & 0x0f ],
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
671 TY_XDS_ptr[ 2 ] & 0x1f,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
672 TY_XDS_ptr[ 1 ] & 0x1f,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
673 TY_XDS_ptr[ 0 ] & 0x3f
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
674 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
675
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
676 // Program is tape delayed
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
677 if ( TY_XDS_ptr[ 3 ] & 0x10 ) ty_AddXDSToDisplay( " TAPE" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
678 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
679 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
680
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
681 case 0x0102: // current program length
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
682 case 0x0302: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
683 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
684 ty_AddXDSToDisplay(
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
685 "DURATION: %d:%02d:%02d of %d:%02d:%02d",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
686 TY_XDS_ptr[ 3 ] & 0x3f,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
687 TY_XDS_ptr[ 2 ] & 0x3f,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
688 TY_XDS_ptr[ 4 ] & 0x3f,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
689 TY_XDS_ptr[ 1 ] & 0x3f,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
690 TY_XDS_ptr[ 0 ] & 0x3f, 0);
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
691 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
692 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
693
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
694 case 0x0103: // current program name
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
695 case 0x0303: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
696 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
697 ty_AddXDSToDisplay( "TITLE: %s", TY_XDS_ptr );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
698 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
699 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
700
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
701 case 0x0104: // current program type
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
702 case 0x0304: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
703 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
704 // for now just print out the raw data
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
705 // requires a 127 string array to parse
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
706 // properly and isn't worth it.
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
707 sprintf ( line, "%sGENRE:", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
708 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
709 int x;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
710 for ( x = 0 ; x < TY_XDS_length ; x++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
711 sprintf( line, "%s %02x", line, TY_XDS_ptr[ x ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
712 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
713 ty_AddXDSToDisplay( line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
714 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
715 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
716
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
717 case 0x0105: // current program rating
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
718 case 0x0305: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
719 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
720 sprintf( line, "%sRATING: %s", line,
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
721 TY_XDS_CHIP[ ( TY_XDS_ptr[ 0 ] & 0x08 ) >> 3 ]
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
722 [ TY_XDS_ptr[ 1 ] & 0x07 ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
723 if ( TY_XDS_ptr[ 0 ] & 0x20 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
724 sprintf( line, "%s DIALOGUE", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
725 if ( TY_XDS_ptr[ 1 ] & 0x08 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
726 sprintf( line, "%s LANGUAGE", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
727 if ( TY_XDS_ptr[ 1 ] & 0x10 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
728 sprintf( line, "%s SEXUAL", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
729 if ( TY_XDS_ptr[ 1 ] & 0x20 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
730 sprintf( line, "%s VIOLENCE", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
731 ty_AddXDSToDisplay( line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
732
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
733 // raw output for verification.
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
734 if ( TY_OSD_debug > 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
735 mp_msg( MSGT_DEMUX, MSGL_DBG3, " (%02x %02x)",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
736 TY_XDS_ptr[ 0 ], TY_XDS_ptr[ 1 ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
737 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
738 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
739
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
740 case 0x0106: // current program audio services
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
741 case 0x0306: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
742 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
743 // requires table, never actually seen it used either
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
744 ty_AddXDSToDisplay( "AUDIO: %02x %02x", TY_XDS_ptr[ 0 ],
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
745 TY_XDS_ptr[ 1 ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
746 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
747 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
748
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
749 case 0x0109: // current program aspect ratio
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
750 case 0x0309: // future
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
751 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
752 // requires table, rare
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
753 ty_AddXDSToDisplay( "ASPECT: %02x %02x",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
754 TY_XDS_ptr[ 0 ], TY_XDS_ptr[ 1 ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
755 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
756 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
757
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
758 case 0x0110 ... 0x0117: // program description
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
759 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
760 ty_AddXDSToDisplay( "DESCRIP: %s", TY_XDS_ptr );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
761 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
762 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
763
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
764 case 0x0501: // channel network name
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
765 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
766 ty_AddXDSToDisplay( "NETWORK: %s", TY_XDS_ptr );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
767 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
768 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
769
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
770 case 0x0502: // channel network call letters
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
771 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
772 ty_AddXDSToDisplay( "CALLSIGN: %s", TY_XDS_ptr );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
773 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
774 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
775
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
776 case 0x0701: // misc. time of day
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
777 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
778 #define TIMEZONE ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x1f )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
779 #define DST ( ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x20 ) >> 5 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
780 struct tm tm =
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
781 {
10858
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
782 .tm_sec = 0, // sec
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
783 .tm_min = ( TY_XDS_ptr[ 0 ] & 0x3F ), // min
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
784 .tm_hour = ( TY_XDS_ptr[ 1 ] & 0x1F ), // hour
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
785 .tm_mday = ( TY_XDS_ptr[ 2 ] & 0x1F ), // day
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
786 .tm_mon = ( TY_XDS_ptr[ 3 ] & 0x1f ) - 1, // month
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
787 .tm_year = ( TY_XDS_ptr[ 5 ] & 0x3f ) + 90, // year
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
788 .tm_wday = 0, // day of week
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
789 .tm_yday = 0, // day of year
da9311e7f5fc warning fix (missing C initializers)
pl
parents: 10310
diff changeset
790 .tm_isdst = 0, // DST
10263
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
791 };
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
792
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
793 time_t time_t = mktime( &tm );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
794 char *timestr;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
795
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
796 time_t -= ( ( TIMEZONE - DST ) * 60 * 60 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
797 timestr = ctime( &time_t );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
798 timestr[ strlen( timestr ) - 1 ] = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
799
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
800 sprintf( line, "%sCUR.TIME: %s ", line, timestr );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
801 if ( TY_XDS[ 3 ][ 4 ][ 0 ] )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
802 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
803 sprintf( line, "%sUTC-%d", line, TIMEZONE );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
804 if (DST) sprintf( line, "%s DST", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
805 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
806 else
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
807 sprintf( line, "%sUTC", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
808
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
809 ty_AddXDSToDisplay( line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
810
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
811 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
812 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
813
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
814 case 0x0704: //misc. local time zone
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
815 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
816 sprintf( line, "%sTIMEZONE: UTC-%d",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
817 line, TY_XDS_ptr[ 0 ] & 0x1f );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
818 if ( TY_XDS_ptr[ 0 ] & 0x20 ) sprintf( line, "%s DST", line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
819 ty_AddXDSToDisplay( line );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
820 break;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
821 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
822
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
823 default:
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
824 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
825 mp_msg( MSGT_DEMUX, MSGL_DBG3, "UNKNOWN CLASS %d TYPE %d",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
826 ( TY_XDS_mode << 1 ) + 1, TY_XDS_type );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
827 if ( TY_OSD_debug > 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
828 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
829 int x;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
830 mp_msg( MSGT_DEMUX, MSGL_DBG3, "\nDUMP:\n" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
831 for ( x = 0 ; x < TY_XDS_length ; x++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
832 mp_msg( MSGT_DEMUX, MSGL_DBG3, " %02x %c",
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
833 TY_XDS_ptr[ x ], TY_XDS_ptr[ x ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
834 mp_msg( MSGT_DEMUX, MSGL_DBG3, "\n" );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
835 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
836 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
837 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
838 if ( TY_OSD_debug > 1 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
839 mp_msg( MSGT_DEMUX, MSGL_DBG3, " (%d)", TY_XDS_length );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
840 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
841 TY_XDS_mode = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
842 TY_XDS_type = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
843 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
844 else if ( TY_XDS_length < 34 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
845 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
846 TY_XDS_new[ TY_XDS_mode ][ TY_XDS_type ][ TY_XDS_length++ ] = b1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
847 TY_XDS_new[ TY_XDS_mode ][ TY_XDS_type ][ TY_XDS_length++ ] = b2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
848 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
849 return 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
850 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
851
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
852
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
853 // 42 x 10
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
854 static char *testline = "0123456789012345678901234567890123456789012";
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
855
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
856 // ===========================================================================
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
857 // Callback from Video Display Processing to put up the OSD
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
858 // ===========================================================================
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
859 void ty_processuserdata( unsigned char* buf, int len )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
860 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
861 int index;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
862
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
863 sub_justify = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
864
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
865 if ( subcc_enabled )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
866 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
867 if ( tyOSDInited == 0 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
868 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
869 for ( index = 0; index < SUB_MAX_TEXT ; index++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
870 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
871 ty_OSD1.text[ index ] = malloc( TY_CC_MAX_X );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
872 ty_OSD2.text[ index ] = malloc( TY_CC_MAX_X );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
873 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
874 ty_ClearOSD( 0 );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
875 ty_OSD1.lines = SUB_MAX_TEXT;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
876 ty_OSD2.lines = SUB_MAX_TEXT;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
877 ty_pOSD1 = &ty_OSD1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
878 ty_pOSD2 = &ty_OSD2;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
879 tyOSDUpdate = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
880 tyOSDInited = 1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
881 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
882
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
883 if ( buf[ 0 ] == 0x01 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
884 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
885 ty_CCdecode( buf[ 1 ], buf[ 2 ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
886 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
887 if ( buf[ 0 ] == 0x02 )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
888 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
889 ty_XDSdecode( buf[ 1 ], buf[ 2 ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
890 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
891
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
892 ty_DisplayXDSInfo();
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
893
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
894 if ( tyOSDUpdate )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
895 {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
896 // for ( index = 0; index < SUB_MAX_TEXT ; index++ )
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
897 // {
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
898 // printf( "OSD:%d:%s\n", index, ty_OSD1.text[ index ] );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
899 // }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
900 vo_sub = &ty_OSD1;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
901 vo_osd_changed( OSDTYPE_SUBTITLE );
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
902 tyOSDUpdate = 0;
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
903 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
904 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
905 }
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
906
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
907
0df8816f4665 TiVo demuxer and sub-cc/osd decoder
arpi
parents:
diff changeset
908