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

📄 hxclientcfuncs.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: HXClientCFuncs.cpp,v 1.16.2.3 2004/07/09 01:49:47 hubbe Exp $ *  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. *  * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks.  You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL.  Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. *  * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. *  * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. *  * Technology Compatibility Kit Test Suite(s) Location: *    http://www.helixcommunity.org/content/tck *  * Contributor(s): *  * ***** END LICENSE BLOCK ***** */#include "HXClientCFuncs.h"#include "HXClientConstants.h"#include "CHXClientEngine.h"#include "IHXClientPlayer.h"#include "CHXClientPlayer.h"#include "CHXClientDebug.h"#include "enter_hx_headers.h"#include "hxwintyp.h"#include "hxcom.h"#include "hxcore.h"#include "hxsmartptr.h"HX_SMART_POINTER_INLINE( SPIHXClientEngine, IHXClientEngine );HX_SMART_POINTER_INLINE( SPIHXPlayer, IHXPlayer );#include "exit_hx_headers.h"/*!  @function ClientEngineSetCallbacks  @param pClientEngineCallbacks  @abstract set the client engine callbacks*/void ClientEngineSetCallbacks( const HXClientEngineCallbacks* pClientEngineCallbacks ){	CHXClientEngine::SetClientEngineCallbacks( pClientEngineCallbacks );}/*!  @function ClientPlayerCreate  @param pClientPlayerToken out parameter for the client token  @param pWindow struct defining the window for the player to use for video  @param userInfo custom value to be passed to callback functions  @param pClientCallbacks struct defining the client callbacks  @result true on success, false on fail  @abstract Creates a new player instance*/bool ClientPlayerCreate( HXClientPlayerToken* pClientPlayerToken, SHXClientWindow* pWindow, void* userInfo, const HXClientCallbacks* pClientCallbacks ){	HX_RESULT result = HXR_OUTOFMEMORY;	SPIHXClientEngine spIClientEngine;	if ( CHXClientEngine::CreateEngine( spIClientEngine.AsInOutParam() ) )	{		IHXPlayer* pICorePlayer = NULL;		result = spIClientEngine->CreatePlayer( pICorePlayer );		if ( SUCCEEDED( result ) )		{			IHXClientPlayer* pIClientPlayer = CHXClientPlayer::Create( spIClientEngine.Ptr(), pICorePlayer, ( HXxWindow* ) pWindow, userInfo, pClientCallbacks );			CHXASSERT( pIClientPlayer );			pICorePlayer->Release();			*pClientPlayerToken = pIClientPlayer;			return true;		}	}	if ( pClientCallbacks->OnErrorOccurred )	{		pClientCallbacks->OnErrorOccurred( userInfo, result, 0, NULL, NULL, NULL ); // XXXSEH: Should we fill in the last 4 arguments?	}	*pClientPlayerToken = NULL;	return false;}/*!  @function ClientPlayerClose  @param clientPlayerToken  @abstract Close the player*/void ClientPlayerClose( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer )	{		pIClientPlayer->Release();	}}/*!  @function ClientPlayerOpenURL  @param clientPlayerToken  @param pURL  @param pMimeType  @abstract open the given URL, optionally provide mime type of content*/bool ClientPlayerOpenURL( HXClientPlayerToken clientPlayerToken, const char* pURL, const char* pMimeType ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? ( ( 0 != SUCCEEDED( pIClientPlayer->OpenURL( pURL, pMimeType ) ) ) ? true : false ) : false;}bool ClientPlayerOpenData( HXClientPlayerToken clientPlayerToken, const char* pURL, const char* pMimeType, UInt32 dataLength, bool autoPlay, void** ppOutData ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? ( ( 0 != SUCCEEDED( pIClientPlayer->OpenData( pURL, pMimeType, dataLength, autoPlay, ppOutData ) ) ) ? true : false ) : false;}bool ClientPlayerWriteData( HXClientPlayerToken clientPlayerToken, void* pData, UInt32 bufferLength, unsigned char* pBuffer ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? ( ( 0 != SUCCEEDED( pIClientPlayer->WriteData( pData, bufferLength, pBuffer ) ) ) ? true : false ) : false;}void ClientPlayerCloseData( HXClientPlayerToken clientPlayerToken, void* pData ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->CloseData( pData );}bool ClientPlayerGetOpenedURL( HXClientPlayerToken clientPlayerToken, char* pURLBuffer, UInt32 bufferLength, UInt32* pUsedBufferLength ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->GetOpenedURL( pURLBuffer, bufferLength, pUsedBufferLength ) : false;}bool ClientPlayerCanViewSource( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->CanViewSource() : false;}void ClientPlayerViewSource( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->ViewSource();}bool ClientPlayerCanViewRights( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->CanViewRights() : false;}void ClientPlayerViewRights( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->ViewRights();}/*!  @function ClientPlayerAuthenticate  @param clientPlayerToken  @param shouldValidateUser  @param pUsername  @param pPassword  @result true on success, false on fail  @abstract provide credentials for authenticating password-protected content*/bool ClientPlayerAuthenticate( HXClientPlayerToken clientPlayerToken, bool shouldValidateUser, const char* pUsername, const char* pPassword ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? ( ( 0 != SUCCEEDED( pIClientPlayer->Authenticate( shouldValidateUser, pUsername, pPassword ) ) ) ? true : false ) : false;}/*!  @function ClientPlayerGetContentState  @param clientPlayerToken  @result an integer indicating the current state  @abstract reports the current state of the player*/int ClientPlayerGetContentState( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->GetContentState() : kContentStateNotLoaded;}/*!  @function ClientPlayerSetStatus  @param clientPlayerToken  @param pStatus  @abstract ???*/bool ClientPlayerSetStatus( HXClientPlayerToken clientPlayerToken, const char* pStatus ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->SetStatus( pStatus ) : false;}/*!  @function ClientPlayerPlay  @param clientPlayerToken  @abstract begin playback*/void ClientPlayerPlay( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->Play();}/*!  @function ClientPlayerPause  @param clientPlayerToken  @abstract pause playback*/void ClientPlayerPause( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->Pause();}/*!  @function ClientPlayerStop  @param clientPlayerToken  @abstract stop playback*/void ClientPlayerStop( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->Stop();}/*!  @function ClientPlayerStartSeeking  @param clientPlayerToken  @result true on success, false on fail  @abstract start seeking*/bool ClientPlayerStartSeeking( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->StartSeeking() : false;}/*!  @function ClientPlayerSetPosition  @param clientPlayerToken  @param position  @result true on success, false on fail  @abstract seek the player to the given position*/bool ClientPlayerSetPosition( HXClientPlayerToken clientPlayerToken, UInt32 position ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? ( ( 0 != SUCCEEDED( pIClientPlayer->SetPosition( position ) ) ) ? true : false ) : false;}/*!  @function ClientPlayerStopSeeking  @param clientPlayerToken  @abstract finish seeking*/void ClientPlayerStopSeeking( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer ) pIClientPlayer->StopSeeking();}/*!  @function ClientPlayerGetPosition  @param clientPlayerToken  @result the current position in milliseconds  @abstract return the current position of playback*/UInt32 ClientPlayerGetPosition( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->GetPosition() : 0;}/*!  @function ClientPlayerGetLength  @param clientPlayerToken  @result the length of the content in milliseconds  @abstract return the length of the presentation*/UInt32 ClientPlayerGetLength( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->GetLength() : 0;}/*!  @function ClientPlayerIsLive  @param clientPlayerToken  @result true if live (or simulated live,) false if on-demand  @abstract return the live state of the presentation*/bool ClientPlayerIsLive( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->IsLive() : false;}/*!  @function ClientPlayerGetTitle  @param clientPlayerToken  @result the title of the current presentation  @abstract return the presentation's title*/const char* ClientPlayerGetTitle( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->GetTitle() : NULL;}/*!  @function ClientPlayerGetContextURL  @param clientPlayerToken  @result the context URL of the current presentation  @abstract return the context URL*/const char* ClientPlayerGetContextURL( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->GetContextURL() : NULL;}/*!  @function ClientPlayerHasVisualContent  @param clientPlayerToken  @result true if video is present, else false  @abstract determine if the current presentation has video or not*/bool ClientPlayerHasVisualContent( HXClientPlayerToken clientPlayerToken ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	return pIClientPlayer ? pIClientPlayer->HasVisualContent() : false;}/*!  @function ClientPlayerGetIdealSize  @param clientPlayerToken  @param pSiteIdealWidth out parameter for natural width of presentation  @param pSiteIdealHeight out parameter for natural height of presentation  @abstract obtain the natural width & height of the presentation*/void ClientPlayerGetIdealSize( HXClientPlayerToken clientPlayerToken, SInt32* pSiteIdealWidth, SInt32* pSiteIdealHeight ){	IHXClientPlayer* pIClientPlayer = ( IHXClientPlayer* ) clientPlayerToken;	if ( pIClientPlayer )	{		pIClientPlayer->GetIdealSize( pSiteIdealWidth, pSiteIdealHeight );	}	else	{		*pSiteIdealWidth = 0;		*pSiteIdealHeight = 0;	}}/*!

⌨️ 快捷键说明

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