From 67276cc8cd70aded2079a2716499501e2055c390 Mon Sep 17 00:00:00 2001 From: voroshil Date: Sat, 8 Sep 2007 03:06:23 +0000 Subject: Decrease teletext page rendering frequency from 1/frame to about 4/sec. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24362 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/tv.h | 3 +++ stream/tvi_vbi.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'stream') diff --git a/stream/tv.h b/stream/tv.h index 31d5785282..f69d8f3371 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -198,6 +198,9 @@ typedef struct { #define TV_VBI_CONTROL_GET_HALF_PAGE 0x51c ///< get current half page #define TV_VBI_CONTROL_SET_HALF_PAGE 0x51d ///< switch half page +#define TV_VBI_CONTROL_IS_CHANGED 0x540 ///< teletext page is changed +#define TV_VBI_CONTROL_MARK_UNCHANGED 0x541 ///< teletext page is changed + #define TV_VBI_CONTROL_ADD_DEC 0x550 ///< add page number with dec #define TV_VBI_CONTROL_GO_LINK 0x551 ///< go link (1..6) NYI #define TV_VBI_CONTROL_GET_VBIPAGE 0x552 ///< get vbi_image for grabbed teletext page diff --git a/stream/tvi_vbi.c b/stream/tvi_vbi.c index 7cfd27e20c..930dab4e48 100644 --- a/stream/tvi_vbi.c +++ b/stream/tvi_vbi.c @@ -96,6 +96,7 @@ #include "libmpcodecs/img_format.h" #include "libavutil/common.h" #include "input/input.h" +#include "osdep/timer.h" //#define DEBUG_DUMP 1 @@ -150,6 +151,8 @@ typedef struct { unsigned int universaltime; unsigned char networkname[21]; int cache_reset; + /// "page changed" flag: 0-unchanged, 1-entire page, 3-only header + int page_changed; } priv_vbi_t; static unsigned char fixParity[256]; @@ -1635,7 +1638,7 @@ int teletext_control(void* p, int cmd, void *arg) if (!priv && cmd!=TV_VBI_CONTROL_START) return TVI_CONTROL_FALSE; - if (!arg && cmd!=TV_VBI_CONTROL_STOP) + if (!arg && cmd!=TV_VBI_CONTROL_STOP && cmd!=TV_VBI_CONTROL_MARK_UNCHANGED) return TVI_CONTROL_FALSE; switch (cmd) { @@ -1669,6 +1672,7 @@ int teletext_control(void* p, int cmd, void *arg) priv->primary_language=tt_languages[i].lang_code; } } + priv->page_changed=1; pthread_mutex_unlock(&(priv->buffer_mutex)); return TVI_CONTROL_TRUE; } @@ -1696,6 +1700,7 @@ int teletext_control(void* p, int cmd, void *arg) init_cache(priv); init_vbi_consts(priv); pll_reset(priv,fine_tune); + priv->page_changed=1; return TVI_CONTROL_TRUE; } case TV_VBI_CONTROL_STOP: @@ -1705,16 +1710,19 @@ int teletext_control(void* p, int cmd, void *arg) if(priv->ptsp) free(priv->ptsp); destroy_cache(priv); + priv->page_changed=1; free(priv); return TVI_CONTROL_TRUE; } case TV_VBI_CONTROL_SET_MODE: priv->on=(*(int*)arg%2); + priv->page_changed=1; return TVI_CONTROL_TRUE; case TV_VBI_CONTROL_GET_MODE: *(int*)arg=priv->on; return TVI_CONTROL_TRUE; case TV_VBI_CONTROL_SET_FORMAT: + priv->page_changed=1; return teletext_set_format(priv, *(int *) arg); case TV_VBI_CONTROL_GET_FORMAT: pthread_mutex_lock(&(priv->buffer_mutex)); @@ -1734,6 +1742,7 @@ int teletext_control(void* p, int cmd, void *arg) val+=3; pthread_mutex_lock(&(priv->buffer_mutex)); priv->zoom=val; + priv->page_changed=1; pthread_mutex_unlock(&(priv->buffer_mutex)); return TVI_CONTROL_TRUE; } @@ -1756,6 +1765,7 @@ int teletext_control(void* p, int cmd, void *arg) priv->subpagenum=pgc->links[val-1].subpagenum; else priv->subpagenum=get_subpagenum_from_cache(priv,priv->pagenum); + priv->page_changed=1; pthread_mutex_unlock(&(priv->buffer_mutex)); return TVI_CONTROL_TRUE; } @@ -1768,6 +1778,7 @@ int teletext_control(void* p, int cmd, void *arg) priv->pagenum=val&0x7ff; priv->subpagenum=get_subpagenum_from_cache(priv,priv->pagenum); priv->pagenumdec=0; + priv->page_changed=1; pthread_mutex_unlock(&(priv->buffer_mutex)); return TVI_CONTROL_TRUE; } @@ -1778,6 +1789,7 @@ int teletext_control(void* p, int cmd, void *arg) priv->pagenum=steppage(priv->pagenum, direction,1); priv->subpagenum=get_subpagenum_from_cache(priv,priv->pagenum); priv->pagenumdec=0; + priv->page_changed=1; pthread_mutex_unlock(&(priv->buffer_mutex)); return TVI_CONTROL_TRUE; } @@ -1792,6 +1804,7 @@ int teletext_control(void* p, int cmd, void *arg) priv->subpagenum=0x3f7f; if(priv->subpagenum>=VBI_MAX_SUBPAGES) priv->subpagenum=VBI_MAX_SUBPAGES-1; + priv->page_changed=1; pthread_mutex_unlock(&(priv->buffer_mutex)); return TVI_CONTROL_TRUE; case TV_VBI_CONTROL_GET_SUBPAGE: @@ -1799,6 +1812,7 @@ int teletext_control(void* p, int cmd, void *arg) return TVI_CONTROL_TRUE; case TV_VBI_CONTROL_ADD_DEC: vbi_add_dec(priv, *(char **) arg); + priv->page_changed=1; return TVI_CONTROL_TRUE; case TV_VBI_CONTROL_DECODE_PAGE: vbi_decode(priv,*(unsigned char**)arg); @@ -1812,6 +1826,14 @@ int teletext_control(void* p, int cmd, void *arg) case TV_VBI_CONTROL_GET_NETWORKNAME: *(void **)arg=priv->networkname; return TVI_CONTROL_TRUE; + case TV_VBI_CONTROL_MARK_UNCHANGED: + priv->page_changed=0; + return TVI_CONTROL_TRUE; + case TV_VBI_CONTROL_IS_CHANGED: + if((GetTimerMS()/250)%2) //forcing page update every 1/4 sec + priv->page_changed=3; //mark that header update is enough + *(int*)arg=priv->page_changed; + return TVI_CONTROL_TRUE; } return TVI_CONTROL_UNKNOWN; } -- cgit v1.2.3