📄 cddsp.c
字号:
/*
** FILE
** cddsp.c
**
** DESCRIPTION
*/
#include "config.h"
#include "global.h"
#include "memmap.h"
//#include "vfdfunc.h" //jjding
#include "func.h"
#include "cdfunc.h"
#include "cd.h"
#include "cderr.h"
#include "sig.h"
#include "util.h"
#include "func.h"
#include "cfont.h"
#include "ringbuf.h"
#include "avd.h"
#include "cddsp.h"
#include "cdxa.h"
#include "drammap.h"
//#define MONE_CD_PAUSE
//#define MONE_CD_OSD_PAUSE
void set_cddsp_config(void)
{
regs0->cddsp_config = cddsp_config;
}
void set_cddsp_config_cdda(void)
{
regs0->cddsp_control = RF_CDDSP_RESET|RF_CDDSP_STOP;
regs0->cddsp_config = cddsp_config | RF_CD_DATA_raw | RF_CD_DATA_nosync;
regs0->cddsp_control = 0;
}
/*
** FUNCTION
** reset_cddsp
**
** DESCRIPTION
*/
void reset_cddsp(void)
{
// NowPrint("cd reset,stop\n");
regs0->cddsp_config = cddsp_config;
regs0->cddsp_control = RF_CDDSP_RESET | RF_CDDSP_STOP;
regs0->cddsp_status = 0;
regs0->cddsp_control = 0;
SET_CDDSP_VX(0);
SET_CDDSP_VY(0);
SET_CDDSP_LIMIT(-CBV_LIMIT);
}
/*
** FUNCTION
** polling_cddsp
**
** DESCRIPTION
** monitor CDDSP buffer and try to keep system decoding timely.
**/
#if CONFIG==CONFIG_VCD
#define CBV_SIZE_START ((cd_type==CDROM_MP3) ? 8 : 2)
#define CBV_SIZE_LOW 4
#define CBV_SIZE_SPEEDUP 5
#define CBV_SIZE_SPEEDDOWN 6
#define CBV_FREE_PAUSE ((cd_type==CDROM_MP3) ? 16 : 3)
#define VBV_LOW 24
#define ABV_LOW 2
#else
#define CBV_SIZE_START 32
#define CBV_SIZE_LOW 64
#define CBV_SIZE_SPEEDUP 90
#define CBV_SIZE_SPEEDDOWN 180
#define CBV_FREE_PAUSE 8
#define VBV_LOW 1024
#define ABV_LOW 2
#endif
#ifdef EMULATION
#undef CBV_FREE_PAUSE
#define CBV_FREE_PAUSE 16
#endif
int polling_cddsp(void)
{
int cy = cbv_y;
int ch = CBV_H;
int cbv_size;
int cbv_free;
int cbv_free_pause_var;/*bondy 890927*/
int vbv_low_var; /*bondy 891002*/
cbv_size = RingBufferSize(GET_CDDSP_VY(),cy,ch);
cbv_free = ch - cbv_size;
if (CDPaused() || (regs0->cddsp_control & (RF_CDDSP_PAUSE|RF_CDDSP_STOP)))
{
int cd_start = 0;
/*
** try to flood CDDSP input buffer
*/
if (cbv_size<=CBV_SIZE_START)
{
cd_start=1;
}
/*bondy 891002*/
if (video_slow==0)
vbv_low_var =VBV_LOW;
else
vbv_low_var =28;
if (!cd_start && cbv_size<CBV_SIZE_LOW)
{
/*
** if VBV low, also start CD
*/
if (vcd_state & VCD_VIDEO)
{
if (RingBufferSize(vbv_y, video_parsing_barrier, VBV_H)<vbv_low_var)
cd_start = 1;
}
/*
** if ABV low, also start CD
*/
if (!cd_start && (vcd_state & VCD_AUDIO))
{
if (RingBufferSize(abv_y, audio_parsing_barrier, ABV_H)<ABV_LOW)
cd_start=1;
}
}
if (cd_start)
{
/*
** jjding 2000/11/02
** TO avoid MP3 paused,then auto pause released
*/
if(play_state!=VCD_STATE_PAUSE)
{
//if( (timestamp_dsp%5000==0)&×tamp_dsp )
{
do_cd_pause_release();
}
{
//if(timestamp_dsp)
// timestamp_dsp--;
//printf("s:%d\n",timestamp_dsp);
//NowPrint("");
}
}
#ifdef MONE_CD_OSD_PAUSE
osd_print2(OS_PLAY OS_DISC);
#endif
#ifdef MONE_CD_PAUSE
{
int vbv_size, abv_size;
vbv_size=RingBufferSize(vbv_y, video_parsing_barrier, VBV_H);
abv_size=RingBufferSize(abv_y, audio_parsing_barrier, ABV_H);
psprintf(linebuf, "REL %x %x %x", GET_CDDSP_VY(), cbv_y, cbv_size);
epp_write(linebuf);
psprintf(linebuf, " V %x A %x\n", vbv_size, abv_size);
epp_write(linebuf);
}
#endif/*MONE_CD_PAUSE*/
}
}
/*
** check CDDSP buffer
*/
/*bondy 890927*/
if (video_slow==0)
cbv_free_pause_var = CBV_FREE_PAUSE;
else
cbv_free_pause_var = 6;
if (cbv_free < cbv_free_pause_var)
{
if (video_slow==0)
B_skip+=2;
/*bondy 891003*/
// if ( (video_slow==0)&&(play_selection==0)&&(play_state!=VCD_STATE_STEP)&&(play_state!=VCD_STATE_PAUSE) )/*bondy 890929*/
// pause_skip_frame =1;
if (!CDPaused())
{
/* bondy 891003*/
if (cd_type_loaded==CDROM)
do_cd_pause();
else
if ( (video_slow)||(play_state == VCD_STATE_STEP)||(play_state == VCD_STATE_PAUSE) )
do_cd_pause();
#ifdef MONE_CD_OSD_PAUSE
osd_print2(OS_PAUSE OS_DISC);
#endif
#ifdef MONE_CD_PAUSE
{
int vbv_size, abv_size;
vbv_size=RingBufferSize(vbv_y, video_parsing_barrier, VBV_H);
abv_size=RingBufferSize(abv_y, audio_parsing_barrier, ABV_H);
psprintf(linebuf, "PAU %x %x %x", GET_CDDSP_VY(), cbv_y, cbv_size);
epp_write(linebuf);
psprintf(linebuf, " V %x A %x\n", vbv_size, abv_size);
epp_write(linebuf);
}
#endif/*MONE_CD_PAUSE*/
}
}
#if SUPPORT_SPEED_JUMP
else
{
if (cbv_size>CBV_SIZE_HIGH_SPEEDDOWN)
{
if (cd_speed==2)
{
do_cd_speed_down(); cd_speed=1;
}
}
else if (cbv_size<CBV_SIZE_LOW_SPEEDUP)
{
if (cd_speed==1)
{
do_cd_speed_up(); cd_speed=2;
}
}
}
#endif
/*
** check seeking too long and restart seeking again.
**
** *FIXME* we may have to timeout this loop due to DSA out of control.
*/
{
// ChkCdTLErr();//terry,2000/12/15 11:09AM
}
#if (SUPPORT_VFD) && !defined(VFD_TIME_GOP)
if (cd_msf_changed)
{
/*
if (!P_frame)
{
if (cd_msf_changed&MSF_MM_CHANGED) vfd_set_mm(cd_qcode_mm);
if (cd_msf_changed&MSF_SS_CHANGED) vfd_set_ss(cd_qcode_ss);
}
*/
cd_msf_changed=0;
}
#endif
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -