#include "StdAfx.h" #include "TcpmpPlayer.h" CTcpmpPlayer::CTcpmpPlayer(void) { m_Player = NULL; } CTcpmpPlayer::~CTcpmpPlayer(void) { } // ³õʼ»¯TCPMP²¥·ÅÆ÷ bool CTcpmpPlayer::Init(char* pVersion,int iVer,void* pVideoWnd) { tchar_t ProgramName[MAX_PATH]; tchar_t ProgramCmd[MAX_PATH]; tchar_t ProgrameVer[MAX_PATH]; char pCharProg[] = TCPMPCLASS; char pCharCmd[] = ""; FormatTcpmpString(pCharProg,ProgramName); FormatTcpmpString(pVersion,ProgrameVer); FormatTcpmpString(pCharCmd,ProgramCmd); if (!Context_Init(ProgramName,ProgramName,iVer,ProgramCmd,NULL)) { AfxMessageBox(L"Init Player Core Error!"); return false; } else { if (pVideoWnd) { Context_Wnd(pVideoWnd); } else { Context_Wnd((void*)1); } context* p = Context(); if (p) { m_Player = (player*)(p->Player); } int Int = CONSOLE_ID; m_Player->Set(m_Player,PLAYER_VOUTPUTID,&Int,sizeof(Int)); node* Color = NodeEnumObject(NULL,COLOR_ID); Int = 8; Color->Set(Color,COLOR_BRIGHTNESS,&Int,sizeof(Int)); Int = 32; Color->Set(Color,COLOR_CONTRAST,&Int,sizeof(Int)); Int = 24; Color->Set(Color,COLOR_SATURATION,&Int,sizeof(Int)); /*rect Rect; Rect.x = 0; Rect.y = 0; Rect.Width = 800; Rect.Height = 240;*/ ((player*)m_Player)->Paint(m_Player,NULL,0,0); bool_t Bool = 0; m_Player->Set(m_Player,PLAYER_FULLSCREEN,&Bool,sizeof(Bool)); /*if (m_Player) { m_Player->Set(m_Player,PLAYER_SKIN_VIEWPORT,&Rect,sizeof(Rect)); } */ char pCharFile[]= "\\GarField.wmv"; static tchar_t FileName[MAX_PATH]; FormatTcpmpString(pCharFile,FileName); PlayerAdd(m_Player,0,FileName,NULL); m_Player->Set(m_Player,PLAYER_STOP,NULL,0); /*Bool = 1; if (m_Player) { m_Player->Set(m_Player,PLAYER_PLAY,&Bool,sizeof(Bool)); }*/ return true; } } void CTcpmpPlayer::SetDisplayRect(LPRECT lRect) { if (m_Player) { m_Player->Set(m_Player,PLAYER_SKIN_VIEWPORT,lRect,sizeof(lRect)); } } void CTcpmpPlayer::Play(bool bPause) { bool_t Bool; if (bPause) { Bool = 1; } else { Bool = 0; } if (m_Player) { m_Player->Set(m_Player,PLAYER_PLAY,&Bool,sizeof(Bool)); } } void CTcpmpPlayer::Stop(void) { if (m_Player) { m_Player->Set(m_Player,PLAYER_STOP,NULL,0); } } BOOL CTcpmpPlayer::IsPlaying(void) { bool_t b; if (m_Player) { if (m_Player->Get(m_Player,PLAYER_PLAY,&b,sizeof(b)) == ERR_NONE && b) return TRUE; else return FALSE; } return FALSE; } tick_t CTcpmpPlayer::GetDuration(void) { tick_t time; if (m_Player) { if (m_Player->Get(m_Player,PLAYER_DURATION,&time,sizeof(time)) == ERR_NONE && time >= 0) { return time; } else { return -1; } } return -1; }