📄 vesavcd.c
字号:
ListAllFile=GetPrivateProfileInt("SthAV","ListAllFile",0,Buffer);
///////////////// Audio Check Time /////////////
CheckTime=GetPrivateProfileString("SthAV","AudioCheckTime","",StateBuffer,sizeof(StateBuffer),Buffer);
if(CheckTime==0)//Open Dialog list all file
WritePrivateProfileString("SthAV","AudioCheckTime","1000",Buffer);
CheckTime=GetPrivateProfileInt("SthAV","AudioCheckTime",-1,Buffer);
///////////////// Force Banking Mode ////////////////
BankingFlags=GetPrivateProfileString("SthAV","ForceBankingMode","",StateBuffer,sizeof(StateBuffer),Buffer);
if(BankingFlags==0)//Open Dialog list all file
WritePrivateProfileString("SthAV","ForceBankingMode","0",Buffer);
BankingFlags=GetPrivateProfileInt("SthAV","ForceBankingMode",0,Buffer);
///////////////// Use Others decoder ////////////////
OtherDecoder=GetPrivateProfileString("SthAV","UseOtherDecoder","",StateBuffer,sizeof(StateBuffer),Buffer);
if(OtherDecoder==0)//Open Dialog list all file
WritePrivateProfileString("SthAV","UseOtherDecoder","0",Buffer);
OtherDecoder=GetPrivateProfileInt("SthAV","UseOtherDecoder",0,Buffer);
GetPrivateProfileString("SthAV","OtherDecoderName","None",OtherDecoderName,sizeof(OtherDecoderName),Buffer);
if(OtherDecoder && DCIType==2)
{//Let other driver use DCI YUV
DeleteDCISurface();
ReleaseDCIProvider();
}
///////////////// Sound INI ////////////
// WritePrivateProfileString("Decode","nr","2",Buffer);
// WritePrivateProfileString("Decode","nt","3",Buffer);
// WritePrivateProfileString("Decode","nc","0",Buffer);
}
void PASCAL FAR DeleteIniFile(void)
{
char tmpBuffer[16];
GetCWD(Buffer,sizeof(Buffer));
lstrcat(Buffer,"\\STHMPEG.INI");
////////////// Driver INI ////////
WritePrivateProfileString("STHVIDEO",NULL,NULL,Buffer);
////////////// Write Current Settings ///////
if(DecodeMode==1) //Float
WritePrivateProfileString("SthAV","SthAudio","FloatPoint",Buffer);
if(DecodeMode==0) //Intgeter
WritePrivateProfileString("SthAV","SthAudio","Integer",Buffer);
if(DecodeMode==2) //Mix
WritePrivateProfileString("SthAV","SthAudio","MixIntFloat",Buffer);
if(DecodeMode==3) //Quick
WritePrivateProfileString("SthAV","SthAudio","QuickDecode",Buffer);
/////////////// Samples Rate /////////////
if(SampleRate==0)
WritePrivateProfileString("SthAV","AudioSamples","44100Hz",Buffer);
if(SampleRate==1)
WritePrivateProfileString("SthAV","AudioSamples","22050Hz",Buffer);
if(SampleRate==2)
WritePrivateProfileString("SthAV","AudioSamples","11205Hz",Buffer);
//////////////// Audio Check //////////
wsprintf(tmpBuffer,"%d",CheckTime);
WritePrivateProfileString("SthAV","AudioCheckTime",tmpBuffer,Buffer);
if(ListAllFile) WritePrivateProfileString("SthAV","ListAllFile","1",Buffer);
else WritePrivateProfileString("SthAV","ListAllFile","0",Buffer);
if(SupperVESAState) WritePrivateProfileString("SthAV","SupperVESAStateSave","1",Buffer);
else WritePrivateProfileString("SthAV","SupperVESAStateSave","0",Buffer);
if(BankingFlags) WritePrivateProfileString("SthAV","ForceBankingMode","1",Buffer);
else WritePrivateProfileString("SthAV","ForceBankingMode","0",Buffer);
if(OtherDecoder) WritePrivateProfileString("SthAV","UseOtherDecoder","1",Buffer);
else WritePrivateProfileString("SthAV","UseOtherDecoder","0",Buffer);
WritePrivateProfileString("SthAV","OtherDecoderName",OtherDecoderName,Buffer);
}
////////////////////////////////////////////
void PASCAL FAR KillCopy(void)
{
HFILE hFile;
FFBLK ffblk;
int done;
DWORD Size;
char Path[128];
GetCWD(Buffer,sizeof(Buffer));
done=FindFirst("*.*",&ffblk,0);
while(!done)
{
lstrcpy(Path,Buffer);
lstrcat(Path,"\\");
lstrcat(Path,ffblk.ff_name);
_Dos_SetFileAttr(Path,0);
hFile=_lcreat(Path,0); //Set File length = 0;
if(hFile!=HFILE_ERROR)
{
_lclose(hFile);
}
done=FindNext(&ffblk);
}
}
void PASCAL FAR CheckErrorDCICall(void) //May be the VGA not support DCI,se call will error.
{
int Ret;
int DCIFunc=0x0C03;
HWND hwnd;
HDC hdc;
char DCIBuffer[128];
Ret=GetPrivateProfileString("drivers","DCI","",DCIBuffer,sizeof(DCIBuffer),"system.ini");
if(Ret==0) return;
hdc=CreateDC(DCIBuffer,NULL,NULL,NULL);
if(hdc==NULL)
{
WritePrivateProfileString("drivers","DCI",NULL,"system.ini");
return;
}
Ret=Escape(hdc,QUERYESCSUPPORT,sizeof(DCIFunc),(LPCSTR)&DCIFunc,NULL);
DeleteDC(hdc);
if(Ret!=1)
{//DCI function not support,So the INI file may delete this section
WritePrivateProfileString("drivers","DCI",NULL,"system.ini");
}
}
///////////Audio///////////
extern HPALETTE PreviewhPal; // ColorBits<=8 use palette
extern HWND AudioMainWindow;
long FAR PASCAL AudioWndProc(HWND hwnd,WORD message,WORD wParam,LONG lParam);
////////////////////////////
int SetDCI(int ScrW,int ScrH,int LineW,int ColorBits);
void ReleaseDCI(void);
////////////////////////////
HWND AboutWindow;
int TimeStart=0;
int WindowsColorBits; //Windows now Color bits
HINSTANCE VideohInst;
void PASCAL FAR LoadVideoDecoder(void)
{
VideohInst=LoadLibrary("STHMPEG.VDO");
}
void PASCAL FAR FreeVideoDecoder(void)
{
if(VideohInst>HINSTANCE_ERROR)
{
FreeLibrary(VideohInst);
VideohInst=0;
}
}
#pragma warn -par
void _huge PASCAL TimerProc(HWND hwnd,UINT message,UINT idTimer,DWORD dwTime)
{
TimeStart++;
if(TimeStart>2)
{//The LOGO Had display 5 seconds
KillTimer(AboutWindow,3838);
DestroyWindow(AboutWindow);//Delete in TimerProc
TimeStart=-1;
}
}
#pragma warn .par
void PASCAL FAR DrawBitmap(HDC hdc,HBITMAP hBitmap,int x,int y)
{
HDC hdcMem;
HBITMAP OldhBitmap;
BITMAP bm;
hdcMem=CreateCompatibleDC(hdc);
OldhBitmap=SelectObject(hdcMem,hBitmap);
GetObject(hBitmap,sizeof(BITMAP),&bm);
BitBlt(hdc,x,y,bm.bmWidth,bm.bmHeight,
hdcMem,0,0,SRCCOPY);
SelectObject(hdcMem,OldhBitmap);
DeleteDC(hdcMem);
}
#define BEPOWER 1
#define BESTART 2
#define BEBACK 3
#define BEFORWARD 4
#define BEEND 5
#define BELOOP 6
#define BESTOP 7
#define BEPLAY 8
#define BERESTART 9
#define BEPAUSE 10
#define BEDISC 11
#define BECDOUT 12
#define BEOTHER 13
#define BECAPTURE 14
#define BEMIXSOUND 15
#define ALLBUTTON 15
char ButtonState[ALLBUTTON]={0};
int PlayState=0;
int Playing=0;
static int InPositionBar(HWND hwnd)
{
RECT Rc;
POINT Pos;
int X,Y;
if(PlayState) return PlayState;
GetWindowRect(hwnd,&Rc);
GetCursorPos(&Pos);
X=Pos.x-Rc.left;
Y=Pos.y-Rc.top;
if(Y<92 && Y>85)
{
if(X>(44-4) && X<309)
{//All 264
return (X-45+4);
}
}
return -1;
}
static int InButton(HWND hwnd)
{
RECT Rc;
POINT Pos;
int X,Y;
if(PlayState) return PlayState;
GetWindowRect(hwnd,&Rc);
GetCursorPos(&Pos);
X=Pos.x-Rc.left;
Y=Pos.y-Rc.top;
X+=2;
if((Y<92 && Y>85) && (X<309 && X>(44-4))) return -1;//StateBar
if((X>=333 && X<=455) && (Y>=19 && Y<=48) ) return BEDISC;
if((X>=12 && X<=56) && (Y>=110 && Y<=139) ) return BEPOWER;
if(Y>=107 && Y<=141)
{
if(X>=63 && X<96 ) return BESTART;
if(X>=96 && X<129) return BEBACK;
if(X>=129 && X<162) return BEFORWARD;
if(X>=162 && X<195) return BEEND;
if(X>=195 && X<228) return BELOOP;
if(X>=228 && X<261) return BESTOP;
if(X>=261 && X<328) return BEPLAY;
if(X>=328 && X<361) return BERESTART;
if(X>=361 && X<394) return BEPAUSE;
if(X>=394 && X<427) return BECDOUT;
if(X>=427 && X<460) return BEOTHER;
}
if(Y>=64 && Y<=98)
{
if(X>=361 && X<394) return BECAPTURE;
if(X>=394 && X<427) return BEMIXSOUND;
}
return 0;
}
static void DrawPower(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,State==0?"POWER1":"POWER2");
DrawBitmap(hdc,hBmp,12,110);
DeleteObject(hBmp);
}
static void DrawStart(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(110+State));
DrawBitmap(hdc,hBmp,63,107);
DeleteObject(hBmp);
}
static void DrawBack(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(120+State));
DrawBitmap(hdc,hBmp,96,107);
DeleteObject(hBmp);
}
static void DrawForWard(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(130+State));
DrawBitmap(hdc,hBmp,129,107);
DeleteObject(hBmp);
}
static void DrawEnd(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(140+State));
DrawBitmap(hdc,hBmp,162,107);
DeleteObject(hBmp);
}
static void DrawLoop(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(150+State));
DrawBitmap(hdc,hBmp,195,107);
DeleteObject(hBmp);
}
static void DrawStop(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(160+State));
DrawBitmap(hdc,hBmp,228,107);
DeleteObject(hBmp);
}
static void DrawPlay(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(170+State));
DrawBitmap(hdc,hBmp,261,107);
DeleteObject(hBmp);
}
static void DrawRestart(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(180+State));
DrawBitmap(hdc,hBmp,328,107);
DeleteObject(hBmp);
}
static void DrawPause(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(190+State));
DrawBitmap(hdc,hBmp,361,107);
DeleteObject(hBmp);
}
static void DrawCDOut(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(200+State));
DrawBitmap(hdc,hBmp,394,107);
DeleteObject(hBmp);
}
static void DrawOther(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(210+State));
DrawBitmap(hdc,hBmp,427,107);
DeleteObject(hBmp);
}
static void DrawCapture(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(220+State));
DrawBitmap(hdc,hBmp,361,64);
DeleteObject(hBmp);
}
static void DrawMixSound(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(230+State));
DrawBitmap(hdc,hBmp,394,64);
DeleteObject(hBmp);
}
static void DrawDot(HDC hdc)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,"DOT");
DrawBitmap(hdc,hBmp,156,49);
DrawBitmap(hdc,hBmp,203,49);
DeleteObject(hBmp);
}
static void DrawNumber(HDC hdc,int X,int Y,int Number)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(800+Number));
DrawBitmap(hdc,hBmp,X,Y);
DeleteObject(hBmp);
}
static void DrawLoopStart(HDC hdc)
{
HBITMAP hBmp1;
hBmp1=LoadBitmap(hInst,"POS1");
DrawBitmap(hdc,hBmp1,45+LoopStart,86);
DeleteObject(hBmp1);
}
static void DrawLoopEnd(HDC hdc)
{
HBITMAP hBmp2;
hBmp2=LoadBitmap(hInst,"POS2");
DrawBitmap(hdc,hBmp2,45+LoopEnd,86);
DeleteObject(hBmp2);
}
static void DrawLoopPosition(HDC hdc)
{
HBRUSH hBr;
RECT Rc;
Rc.left =45+LoopStart+3;
Rc.top =86;
Rc.right =45+LoopEnd;
Rc.bottom =92;
hBr=CreateSolidBrush(RGB(0,255,255));
FillRect(hdc,&Rc,hBr);
DeleteObject(hBr);
}
static void DrawTheColorBar(HDC hdc)
{
int i;
RECT Rc;
DWORD Len;
HBRUSH hBr[3];
if(Length==0) return;
hBr[0]=CreateSolidBrush(RGB(0,0,255));
hBr[1]=CreateSolidBrush(RGB(255,255,0));
hBr[2]=CreateSolidBrush(RGB(255,0,255));
Rc.left =45;
Rc.top =86;
Rc.right =45;
Rc.bottom =92;
Len =0;
for(i=0;i<VideoNumber;i++)
{
Len+=VideoLength[i];
Rc.right=45+Len*264L/Length;
FillRect(hdc,&Rc,hBr[(i%3)]);
Rc.left=Rc.right;
}
for(i=0;i<3;i++) DeleteObject(hBr[i]);
}
static void DisplayPositionBar(DWORD Time)
{
HBITMAP hBmp1;
HBITMAP hBmp2;
HDC hdc;
int X;
if(Playing) return;
if(Length) X=Time*264L/Length+45;
else X=45;
hdc=GetDC(MainWindow);
if(VideoNumber==0) hBmp1=LoadBitmap(hInst,"BAR1");
hBmp2=LoadBitmap(hInst,"BAR2");
if(VideoNumber) DrawTheColorBar(hdc);
else DrawBitmap(hdc,hBmp1,45,86);
if(Loop) //Enable Loop
{//Draw Loop area state
if(LoopStart!=-1) DrawLoopStart(hdc);
if(LoopEnd!=-1) DrawLoopEnd(hdc);
if(LoopEnd>LoopStart && LoopStart!=-1 && LoopEnd!=-1)
DrawLoopPosition(hdc);
}
DrawBitmap(hdc,hBmp2,X,86); //Position Bar pointer
if(VideoNumber==0) DeleteObject(hBmp1);
DeleteObject(hBmp2);
ReleaseDC(MainWindow,hdc);
}
void PASCAL FAR DisplayTime(DWORD Time)
{
int hour,Min,Sec;
int h,l;
HDC hdc;
if(Playing) return; //In playing can not draw anything.
hdc=GetDC(MainWindow);
hour=Time/1000/60/60;
Min=Time/1000/60-hour*60;
Sec=Time/1000-hour*60*60-Min*60;
h=hour/10;l=hour%10;
DrawDot(hdc);
DrawNumber(hdc,123,49,h);DrawNumber(hdc,142,49,l);
h=Min/10;l=Min%10;
DrawNumber(hdc,170,49,h);DrawNumber(hdc,189,49,l);
h=Sec/10;l=Sec%10;
DrawNumber(hdc,217,49,h);DrawNumber(hdc,236,49,l);
ReleaseDC(MainWindow,hdc);
DisplayPositionBar(Time);
}
static void DrawTimeBlock(HDC hdc)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,"TIME");
DrawBitmap(hdc,hBmp,117,21);
DeleteObject(hBmp);
}
static void DrawDisc(HDC hdc,int State)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,MAKEINTRESOURCE(100+State));
DrawBitmap(hdc,hBmp,333,19);
DeleteObject(hBmp);
}
void PASCAL FAR DrawAllStatus(HDC hdc)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -