TVGlo.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:5k
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef TV_GUARDIAN_ENABLE
- #include <stdlib.h>
- #include <stdio.h>
- #include "Playcoretvgtvglo.h"
- #include "Playcoretvgtvgcode.h"
- #include "Playcoretvgtvgram.h"
- #include "Playcoretvgtvgpar.h"
- #include "Playcoretvgtvgapi.h"
- //**********************************************************************
- //**********************************************************************
- //***
- //*** TVG Functions w/Hardware Dependencies (LOW Leval Funcs)
- //***
- //**********************************************************************
- //**********************************************************************
- // For Zoran Chipset
- void show_tvg_bug( uchar msg_index ) {
- DisplayOperationalMessage(msg_index);
- }
- void transmit2chars( uchar *ccdata_out, uchar field ) {
- uchar *pccdata;
- if(iccfifo==occfifo) return;
- pccdata=(ccfifo+occfifo);
- occfifo += 2;
- occfifo %= CCMAXFIFO;
- // shift CC channel if necessary
- shift_cc( pccdata ); // test to shift to CC2
- // Apply Parity and send it out...
- ccdata_out[0]=mkpar[(pccdata[0] & 0x7F)];
- ccdata_out[1]=mkpar[(pccdata[1] & 0x7F)];
- }
- #define MUTE_CMD 1
- #define UNMUTE_CMD 0
- void mute_audio( void ) {
- if(!(tvg_flags & TVG_MUTE)) {
- MuteAudio( MUTE_CMD, &gop_offset );
- }
- tvg_flags |= TVG_MUTE;
- return;
- }
- void check_to_unmute( void ) {
- if(!(tvg_flags & TVG_MUTE)) return;
- MuteAudio( UNMUTE_CMD, &gop_offset );
- tvg_flags &= ~TVG_MUTE;
- timer_mute=0; // clear any pending mute timer
- return;
- }
- // for now, we will simply process timers on a frame basis.
- // probably adequate for DVD player application. If this
- // later causes a problem, we can tie these timers to some
- // system-dependent timers.
- void tvg_process_timers( void ) {
- if(timer_mute != 0) {
- timer_mute--;
- if(timer_mute==0) check_to_unmute();
- }
- return;
- }
- // This is a temporary kludge.... we are using the DEMO version
- // menu system, but implementing version 2 settings.
- //
- // DEMO VER2
- // =========== ===========
- // TVG OFF TVG OFF
- // TVG MOD TVG TOLER
- // TVG MODER (not available)
- // TVG STRICT TVG STRICT
- //
- // FORCE ALL WORD SETS ON FOR NOW
- //
- // NO CHANGE TO CC SETTINGS
- void tvg_process_modes( void ) {
- uchar testing;
- uchar tvg_mode_tvg;
- uchar tvg_mode_cc;
- uchar tvg_ccshift;
- uchar tvg_word_sets;
- // Temporary patch - make Demo Version User Menu map to Version 2 Algorithm
- //
- // Demo Mode Ver 2 Mode
- // ========= ==========
- // (0) OFF (0) OFF
- // (1) TOL
- // (1) MOD (2) MOD
- // (2) STR (3) STR
- testing = GetTVGMode();
- if(testing) testing++;
- tvg_mode_tvg = 0x01 << testing;
- tvg_mode_cc = 0x10 << GetTVGCCOperation();
- tvg_ccshift = 0x80 << GetCCShiftValue();
- // tvg_word_sets = GetTVGWordset();
- testing = tvg_mode_cc | tvg_mode_tvg | tvg_ccshift;
- if(testing==io_map) return; // no change
- io_map = testing;
- tvg_word_sets = TOL_RELIGIOUS | TOL_SEXUAL | TOL_HELLDAMN;
- if(io_map & TVG_MODER) tvg_word_sets = TOL_SEXUAL | TOL_HELLDAMN;
- // set flag TVG_CAPS if TVG is ON (not OFF) AND CC is ON (not OFF)
- if((io_map & 0x60) && (io_map & 0x0E)) tvg_flags |= TVG_CAPS;
- else tvg_flags &= ~TVG_CAPS;
- iomap2=0;
- if(io_map & TVG_OFF) tvg_word_sets=0;
- else {
- if(io_map & TVG_TOLRNT) iomap2 = TOL_STRICT;
- if(io_map & TVG_MODER) iomap2 = TOL_STRICT | TOL_MODERATE;
- if(io_map & TVG_STRICT) iomap2 = TOL_STRICT | TOL_MODERATE | TOL_MILD;
- iomap2 |= (tvg_word_sets & USER_WSMASK);
- }
- return;
- }
- // This function shift_cc doesnt really depend on hardware, placed
- // here for convenience.
- // This function shifts CC signal from the specified input channel
- // to the specified output channel. Valid inputs 1=CC1, 2=CC2, etc
- // pointer points to the control byte pair...
- // This function will be called before parity is applied to the data
- /*
- * Control Pair:
- *
- * byte1: 0x10 - 0x1F only. Bit 3 determines CC1/CC2 (or CC3/CC4)
- * byte2: 0x20 - 0x7F only.
- *
- */
- void shift_cc( uchar *cp ) {
- uchar ccin, ccout;
- char parsave0, parsav1; /* used to store parity */
- if(io_map & 0x80) return; // return if CC1
- if((cp[0]<0x10) || (cp[0]>0x1F)) return; /* no action */
- if( cp[0] <= 0x17 ) { /* incoming data is CC1/3 */
- cp[0] |= 0x08; /* set bit 3 */
- }
-
- return;
- }
- #endif //TV_GUARDIAN_ENABLE