⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 linux下的一款播放器
💻 CPP
字号:
#include <memory.h>#include <stdlib.h>#include <stdio.h>#include "HXClientCFuncs.h"#include "HXClientCallbacks.h"#include "HXClientConstants.h"voidOnVisualStateChanged(void* userInfo, bool hasVisualContent){}voidOnIdealSizeChanged(void* userInfo, SInt32 idealWidth, SInt32 idealHeight){}voidOnLengthChanged(void* userInfo, UInt32 length){}voidOnTitleChanged(void* userInfo, const char* pTitle){}voidOnGroupsChanged(void* userInfo){}voidOnGroupStarted(void* userInfo, UInt16 groupIndex){}voidOnContacting(void* userInfo, const char* pHostName){}voidOnBuffering(void* userInfo, UInt32 bufferingReason, UInt16 bufferPercent){}voidOnContentConcluded(void* userInfo){}voidOnContentStateChanged(void* userInfo, int oldContentState, int newContentState){    switch (newContentState)    {	case kContentStateNotLoaded:	{	}	break;		case kContentStateLoading:	{	}	break;		case kContentStateStopped:	{	}	break;		case kContentStatePlaying:	{	}	break;		case kContentStatePaused:	{	}	break;	default:	{	    // unsupported!	}	break;    }}voidOnStatusChanged(void* userInfo, const char* pStatus){}voidOnVolumeChanged(void* userInfo, UInt16 volume){}voidOnMuteChanged(void* userInfo, bool hasMuted){}voidOnClipBandwidthChanged(void* userInfo, SInt32 clipBandwidth){}voidOnErrorOccurred(void* userInfo, UInt32 hxCode, UInt32 userCode,		const char* pErrorString, const char* pUserString,		const char* pMoreInfoURL)		{}boolGoToURL(void* userInfo, const char* pURL, const char* pTarget){    return false;}boolRequestAuthentication(void* userInfo, const char* pServer, const char* pRealm,		      bool isProxyServer){    return false;}boolRequestUpgrade(void* userInfo, UInt32 numOfComponents,	       const char* componentNames[], bool isBlocking){    return false;}boolHasComponent(void* userInfo, const char* componentName){    return false;}typedef struct{    HXClientPlayerToken player;    SHXClientWindow window;    int state;} PlayerInfo;intmain(int argc, char* argv[]){    if (argc < 2)    {	printf("USAGE: testkit URL\n");	return 0;    }    static const HXClientCallbacks kCallbacks =    {        OnVisualStateChanged,        OnIdealSizeChanged,        OnLengthChanged,        OnTitleChanged,        OnGroupsChanged,        OnGroupStarted,        OnContacting,        OnBuffering,        OnContentStateChanged,        OnContentConcluded,        OnStatusChanged,        OnVolumeChanged,        OnMuteChanged,        OnClipBandwidthChanged,        OnErrorOccurred,        GoToURL,        RequestAuthentication,        RequestUpgrade,        HasComponent    };    const char* pURL = argv[1];    PlayerInfo info;    memset(&info, 0, sizeof(info));    if (ClientPlayerCreate(&info.player, &info.window, &info, &kCallbacks))    {	ClientPlayerOpenURL(info.player, pURL, NULL);	do	{#ifdef _MAC	    // todo: pump a message to the mac client engine#elif _UNIX	    ClientEngineProcessXEvent(NULL);#endif	}	while (info.state);		ClientPlayerClose(info.player);    }    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -