#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include <vlc_codec.h>
#include <vlc_input.h>
Eia608Init( &p_sys->eia608 );
p_dec->fmt_out.i_cat = SPU_ES;
- p_dec->fmt_out.i_codec = VLC_FOURCC('T','E','X','T');
+ p_dec->fmt_out.i_codec = VLC_CODEC_TEXT;
return VLC_SUCCESS;
}
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+ fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
/* Reset current row */
Eia608ClearScreenRow( h, i_screen, h->cursor.i_row );
}
-static void Eia608ParseChannel( eia608_t *h, uint8_t d1 )
+static void Eia608ParseChannel( eia608_t *h, const uint8_t d[2] )
{
+ /* Check odd parity */
+ static const int p4[16] = {
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0
+ };
+ if( p4[d[0] & 0xf] == p4[d[0] >> 4] ||
+ p4[d[1] & 0xf] == p4[ d[1] >> 4] )
+ {
+ h->i_channel = -1;
+ return;
+ }
+
+ /* */
+ const int d1 = d[0] & 0x7f;
+ const int d2 = d[1] & 0x7f;
if( d1 == 0x14 )
h->i_channel = 1;
else if( d1 == 0x1c )
h->i_channel = 2;
- else if( ( d1 >= 0x01 && d1 <= 0x0f ) || d1 == 0x15 )
+ else if( d1 == 0x15 )
h->i_channel = 3;
else if( d1 == 0x1d )
h->i_channel = 4;
}
static bool Eia608Parse( eia608_t *h, int i_channel_selected, const uint8_t data[2] )
{
- const uint8_t d1 = data[0] & 0x7f; /* Removed parity bit TODO we might want to check them */
+ const uint8_t d1 = data[0] & 0x7f; /* Removed parity bit */
const uint8_t d2 = data[1] & 0x7f;
bool b_screen_changed = false;
if( d1 == 0 && d2 == 0 )
- return false; /* Ignore padding */
+ return false; /* Ignore padding (parity check are sometimes invalid on them) */
- Eia608ParseChannel( h, d1 );
+ Eia608ParseChannel( h, data );
if( h->i_channel != i_channel_selected )
return false;
//fprintf( stderr, "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC %x %x\n", data[0], data[1] );