comparison stream/tvi_vbi.c @ 24301:15d547dfa66b

Make sure that no pages will left in cache during channel switch (immediately stop decoding of vbi buffer when clear_cache is called).
author voroshil
date Sat, 01 Sep 2007 18:49:51 +0000
parents 1980e76f4482
children 414b72437fe3
comparison
equal deleted inserted replaced
24300:4ad15f9bff3b 24301:15d547dfa66b
147 unsigned int networkid; 147 unsigned int networkid;
148 int timeoffset; // timeoffset=realoffset*2 148 int timeoffset; // timeoffset=realoffset*2
149 unsigned int juliandate; 149 unsigned int juliandate;
150 unsigned int universaltime; 150 unsigned int universaltime;
151 unsigned char networkname[21]; 151 unsigned char networkname[21];
152 int cache_reset;
152 } priv_vbi_t; 153 } priv_vbi_t;
153 154
154 static unsigned char fixParity[256]; 155 static unsigned char fixParity[256];
155 156
156 static tt_char tt_space={0x20,7,0,0,0,0,0x20}; 157 static tt_char tt_space={0x20,7,0,0,0,0,0x20};
620 * Only zero-filled array of pointers remains in memory 621 * Only zero-filled array of pointers remains in memory
621 */ 622 */
622 static void clear_cache(priv_vbi_t* priv){ 623 static void clear_cache(priv_vbi_t* priv){
623 int i; 624 int i;
624 tt_page* tp; 625 tt_page* tp;
626 priv->cache_reset=1;
627
625 for(i=0;i<VBI_MAX_PAGES;i++){ 628 for(i=0;i<VBI_MAX_PAGES;i++){
626 while(priv->ptt_cache[i]){ 629 while(priv->ptt_cache[i]){
627 tp=priv->ptt_cache[i]; 630 tp=priv->ptt_cache[i];
628 priv->ptt_cache[i]=tp->next_subpage; 631 priv->ptt_cache[i]=tp->next_subpage;
629 free(tp); 632 free(tp);
1445 unsigned char data[64]; 1448 unsigned char data[64];
1446 unsigned char* linep; 1449 unsigned char* linep;
1447 int d0,d1; 1450 int d0,d1;
1448 int i=0; 1451 int i=0;
1449 mp_msg(MSGT_TV,MSGL_DBG3,"vbi: vbi_decode\n"); 1452 mp_msg(MSGT_TV,MSGL_DBG3,"vbi: vbi_decode\n");
1450 for(linep=buf; linep<buf+priv->ptsp->bufsize; linep+=priv->ptsp->samples_per_line,i++){ 1453 for(linep=buf; !priv->cache_reset && linep<buf+priv->ptsp->bufsize; linep+=priv->ptsp->samples_per_line,i++){
1451 #if 0 1454 #if 0
1452 /* 1455 /*
1453 This routine is alternative implementation of raw VBI data decoding. 1456 This routine is alternative implementation of raw VBI data decoding.
1454 Unfortunately, it detects only about 20% of incoming data, 1457 Unfortunately, it detects only about 20% of incoming data,
1455 but Michael says that this algorithm is better, and he wants to fix it. 1458 but Michael says that this algorithm is better, and he wants to fix it.
1484 }else if(pkt==30){ 1487 }else if(pkt==30){
1485 decode_pkt30(priv,data+2,magAddr); 1488 decode_pkt30(priv,data+2,magAddr);
1486 } else { 1489 } else {
1487 mp_msg(MSGT_TV,MSGL_DBG3,"unsupported packet:%d\n",pkt); 1490 mp_msg(MSGT_TV,MSGL_DBG3,"unsupported packet:%d\n",pkt);
1488 } 1491 }
1492 }
1493 if (priv->cache_reset){
1494 pthread_mutex_lock(&(priv->buffer_mutex));
1495 priv->cache_reset=0;
1496 pthread_mutex_unlock(&(priv->buffer_mutex));
1489 } 1497 }
1490 1498
1491 } 1499 }
1492 1500
1493 /* 1501 /*