From 65e0b2a95ede109a2b55329b373c4d16802f66b1 Mon Sep 17 00:00:00 2001 From: voroshil Date: Wed, 22 Aug 2007 14:01:57 +0000 Subject: [PATCH] Fix [soc:eoc] stubs. Slightly modified patch from Otvos Attila oattila at chello dot hu git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24119 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/tvi_vbi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stream/tvi_vbi.c b/stream/tvi_vbi.c index 6d877d6899..b4ab05b667 100644 --- a/stream/tvi_vbi.c +++ b/stream/tvi_vbi.c @@ -22,6 +22,7 @@ * Based on Attila Otvos' teletext patch, Michael Niedermayer's * proof-of-concept teletext capture utility and some parts * (decode_raw_line_runin,pll_add,pll_reset) of MythTV project. + * Code for calculating [soc:eoc] is based on aletv of Edgar Toernig. * * * Some implementation details: @@ -277,10 +278,13 @@ static void init_vbi_consts(priv_vbi_t* priv){ } priv->bpb=(priv->ptsp->sampling_rate/6937500.0)*ONE_FIXP+0.5; -//FIXME: STUBS!!!! - priv->soc=0; - priv->eoc=92; -//END STUBS!!! + priv->soc=FFMAX(9.2e-6*priv->ptsp->sampling_rate-priv->ptsp->offset, 0); + priv->eoc=FFMIN(12.9e-6*priv->ptsp->sampling_rate-priv->ptsp->offset, + priv->ptsp->samples_per_line-43*8*priv->bpb/ONE_FIXP); + if (priv->eoc - priv->soc<16*priv->bpb/ONE_FIXP){ // invalid [soc:eoc] + priv->soc=0; + priv->eoc=92; + }; priv->bp8bl=0.97*8*priv->bpb/ONE_FIXP; // -3% tolerance priv->bp8bh=1.03*8*priv->bpb/ONE_FIXP; // +3% tolerance } @@ -913,8 +917,8 @@ static int decode_raw_line_runin(priv_vbi_t* priv,unsigned char* buf,unsigned ch int thr=0; //threshold //stubs - int soc=0; - int eoc=92; + int soc=priv->soc; + int eoc=priv->eoc; for(i=soc;ibpb/ONE_FIXP]-buf[i]; // amplifies the edges best.