[MPlayer-dev-eng] [PATCH] network name from teletext

Vladimir Voroshilov voroshil at gmail.com
Sun Aug 26 22:02:35 CEST 2007


2007/8/26, Ötvös Attila <oattila at chello.hu>:
> Hi All!
>
> This patch grab network name (network code, date and time) from decoded pkt30.


>Index: stream/tvi_vbi.c
>===================================================================
>--- stream/tvi_vbi.c	(revision 24202)
>+++ stream/tvi_vbi.c	(working copy)
>@@ -137,6 +137,15 @@
>
>     tt_page** ptt_cache;
>     unsigned char* ptt_cache_first_subpage;
>+    /// network info
>+    unsigned char designation;

Why do you want to keep this value?

>[...]
>+static int decode_xpacket(priv_vbi_t* priv,unsigned char* data,int magAddr)

"decode_pkt30" for consistance with another code.

>+    if (magAddr) return 0;
>+    err=0;
>+    for(i=0;i<7;i++){
>+        d[i]= corrHamm48[ data[i] ];
>+        err+=d[i];
>+        if(d[i]&0x80){
>+            pll_add(priv,2,4);
>+            return 0;
>+        }
>+        d[i]&=0xf;
>+    }

"err" was not used

>+    err=0;
>+    for(i=20; i<40; i++){
>+        data[i]= fixParity[data[i]];
>+        if(data[i]&0x80) //Error
>+            err++;
>+        pll_add(priv,1,err);
>+    }
>+    if (err) return 0;
>+
>+    priv->designation=d[0];
>+    priv->initialpage=d[1]|d[2]<<4;

You missed magazine number.(some bits in bytes 4 and 6).

>+    priv->initialsubpage=d[3]|d[4]<<4|d[5]<<8|d[6]<<12;
>+    priv->networkcode=data[7]<<8|data[8];
>+    if(d[0]/2==0) {

Use "if(d[0]&0xe) return 0" instead and put it immediately after
parity check, because code below is valid only when bits 2-4 of
designation code
are set to zero.
See subclause 9.8.1 of specification for details.

>[...]
>+    case TV_VBI_CONTROL_GET_NETWORKNAME:
>+        *(void **)arg=priv->networkname;
>+        return TVI_CONTROL_TRUE;
>     }
>     return TVI_CONTROL_UNKNOWN;

Where do you want to use this ?

P.S. you can also check my version of the same patch.

-- 
Regards,
Vladimir Voroshilov     mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tt_pkt30.diff
Type: application/octet-stream
Size: 4014 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070827/61d292d0/attachment.obj>


More information about the MPlayer-dev-eng mailing list