您的位置:首页 > 理论基础 > 计算机网络

主管叫我看tcpmp播放器,下面几行代码1月没看懂,求求你了,

2017-01-02 23:47 260 查看
主管叫我看tcpmp播放器,找出解码代码的接口!!

该如何去找关于音视频解码部分接口呢?

它是由14个项目组成的,其中主工程是一个叫player的,里面代码如下:

#include "../common/common.h"

static const tchar_t ProgramName[] = T("TCPMP");

static const tchar_t ProgramVersion[] = 

#include "../version"

;

#ifndef STRICT

#define STRICT

#endif

#include <windows.h>

#if defined(TARGET_WINCE)

#define TWIN(a) L ## a

extern int ProgramId;

#else

#define TWIN(a) a

static int ProgramId = 0;

#endif

// don't want to use common.dll, but don't want to collide with DLL import function either

#define tcscpy_s _tcscpy_s

#if !defined(NO_PLUGINS) || defined(NDEBUG)

static void tcscpy_s(tchar_t* Out,int OutLen,const tchar_t* In)

{

if (OutLen>0)

{

int n = min((int)tcslen(In),OutLen-1);

memcpy(Out,In,n*sizeof(tchar_t));

Out
 = 0;

}

}

#endif

#ifdef NDEBUG

static BOOL CALLBACK EnumWindowsProc(HWND Wnd,LPARAM Param)

{

HWND* p = (HWND*)Param;

if (GetWindow(Wnd,GW_OWNER) == *p)

{

*p = Wnd;

return 0;

}

return 1;

}

static bool_t FindRunning(const tchar_t* CmdLine)

{

HWND Wnd;

tchar_t ClassName[32];

int n = tcslen(ProgramName);

tcscpy_s(ClassName,TSIZEOF(ClassName),ProgramName);

tcscpy_s(ClassName+n,TSIZEOF(ClassName)-n,T("_Win"));

Wnd = FindWindow(ClassName, NULL);

if (Wnd)

{

HWND WndMain = Wnd;

while (!IsWindowEnabled(Wnd))

{

HWND Last = Wnd;

EnumWindows(EnumWindowsProc,(LPARAM)&Wnd);

if (Wnd == Last)

break;

}

SetForegroundWindow(Wnd);

if (CmdLine && CmdLine[0])

{

COPYDATASTRUCT Data;

Data.dwData = 0;

Data.cbData = (tcslen(CmdLine)+1)*sizeof(tchar_t);

Data.lpData = (PVOID)CmdLine;

SendMessage(WndMain,WM_COPYDATA,(WPARAM)WndMain,(LPARAM)&Data);

}

return 1;

}

return 0;

}

#endif

#ifdef NO_PLUGINS

extern void Main(const tchar_t* Name,const tchar_t* Version,int Id,const tchar_t* CmdLine);

#else

static HANDLE Load(const tchar_t* Name)

{

HANDLE Module;

tchar_t Path[MAXPATH];

tchar_t *s;

GetModuleFileName(NULL,Path,MAXPATH);

s = tcsrchr(Path,'\\');

if (s) s[1]=0;

tcscpy_s(Path+tcslen(Path),TSIZEOF(Path)-tcslen(Path),Name);

Module = LoadLibrary(Path);

if (!Module)

Module = LoadLibrary(Name);

return Module;

}

#endif

#if !defined(TARGET_WINCE) && defined(UNICODE)

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hParent,LPSTR CmdA,int CmdShow)

{

WCHAR Cmd[2048];

mbstowcs(Cmd,CmdA,sizeof(Cmd)/sizeof(WCHAR)); //!!!

#else

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hParent,TCHAR* Cmd,int CmdShow)

{

#endif

#ifndef NDEBUG

// DLLTest(); // just to help debugging plugins. comment out if not needed

Context();

#endif

#if defined(TARGET_WINCE) && defined(ARM)

if (ProgramId == 2)

{

OSVERSIONINFO Ver;

Ver.dwOSVersionInfoSize = sizeof(Ver);

GetVersionEx(&Ver);

if (Ver.dwMajorVersion*100 + Ver.dwMinorVersion >= 421)

{

// old shell menu not supported after WM2003SE

MessageBox(NULL,T("This ARM_CE2 version of the player is not compatible with this device. Please install ARM_CE3 version."),NULL,MB_OK|MB_ICONERROR); 

return 1; 

}

}

#endif

#ifdef NDEBUG

if (!FindRunning(Cmd))

{

HANDLE Handle = CreateMutex(NULL,FALSE,ProgramName);

if (GetLastError() != ERROR_ALREADY_EXISTS)

#endif

{

#ifndef NO_PLUGINS

HMODULE Module;

SetCursor(LoadCursor(NULL, IDC_WAIT));

Module = Load(T("interface.plg"));

if (Module)

{

void (*Main)(const tchar_t* Name,const tchar_t* Version,int Id,const tchar_t* CmdLine);

*(FARPROC*)&Main = GetProcAddress(Module,TWIN("Main"));

if (!Main)

*(FARPROC*)&Main = GetProcAddress(Module,TWIN("_Main@16"));

if (Main)

Main(ProgramName,ProgramVersion,ProgramId,Cmd);

FreeLibrary(Module);

}

#else

Main(ProgramName,ProgramVersion,ProgramId,Cmd);

#endif

#ifdef NDEBUG

CloseHandle(Handle);

#endif

SetCursor(LoadCursor(NULL, IDC_ARROW));

}

#ifdef NDEBUG

}

#endif

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: