📄 nshxplayer.h
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: nsHXPlayer.h,v 1.3.8.6 2004/11/23 00:24:25 rggammon Exp $ * * * Portions Copyright (c) 1995-2002 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 ***** */#ifndef __NS_HXPLAYER_H__#define __NS_HXPLAYER_H__#include "nsISupports.h"#include "nsIClassInfo.h"#include "nsIHXPlayer.h"#include "nsISupportsImpl.h"#include "embddef.h"#include "npapi.h"#include "pluginbase.h"class CHXPlayerBackend;class nsHXPlayer : public nsIHXPlayer, public nsIClassInfo, public nsPluginInstanceBase{public: NS_DECL_ISUPPORTS // NS_DECL_ICLASSINFO (Implemented inline below) // NS_DECL_IHXPLAYER (Implemented inline below) nsHXPlayer(CHXPlayerBackend *pBackend); virtual ~nsHXPlayer(); nsresult Init(nsPluginCreateData *aCreateDataStruct); nsresult Destroy(void); // Backend support functions const char* GetName(void) { return m_szName; } int GetId(void) { return m_iPlayerID; } NPP GetInstance(void) { return m_instance; } nsresult OnGetURL(const char *szUrl, const char *szTarget); // NPP_* method overrides (via nsPluginInstanceBase) NPError NewStream(NPMIMEType type, NPStream* stream, NPBool /* seekable */, uint16* stype); NPError DestroyStream(NPStream *stream, NPError /* reason */); int32 Write(NPStream *stream, int32 offset, int32 nDataLen, void *pData); NPError GetValue(NPPVariable variable, void *value); NPError SetWindow(NPWindow* aWindow); void URLNotify(const char*, NPReason, void *data); // other nsPluginInstanceBase pure virtual methods, not particularly useful for us. NPBool init(NPWindow*) { m_bIsInitialized = TRUE; return TRUE; } void shut() { m_bIsInitialized = FALSE; } NPBool isInitialized() { return m_bIsInitialized; };private: char *GetQuotedString(const char *szString); nsresult GetGenericResponse(PRBool* result); nsresult GetPlayerUINT32Prop(const char *szPropName, PRInt32 *uiValue); nsresult GetPlayerStringProp(const char *szPropName, char **pszValue); nsresult GetEntryStringProp(const char *szPropName, PRInt32 uIndex, char **pszValue); nsresult SetPlayerUINT32Prop(const char *szPropName, PRInt32 uiPropValue, PRBool *retval); nsresult SetPlayerStringProp(const char *szPropName, const char *szValue, PRBool *retval); nsresult DoCommand(const char *szCommand, PRBool *_retval); nsresult ReadGenericResponse(PRBool* retval); nsresult SendBrowserInfo(void); // private data int m_iPlayerID; NPP m_instance; char *m_szName; NPBool m_bIsFirstNewStream; NPBool m_bReceivedXEmbedQuery; NPBool m_bIsInitialized; NPBool m_bReceivedScriptableInstanceQuery; NPBool m_bSentBrowserInfo; // Backend shared between all nsHXPlayer's CHXPlayerBackend *m_pBackend; public: // nsIHXPlayer implementation // Commands NS_IMETHOD DoPlayPause(PRBool *_retval) { return DoCommand("PlayPause", _retval); } NS_IMETHOD DoPause(PRBool *_retval) { return DoCommand("Pause", _retval); } NS_IMETHOD DoPlay(PRBool *_retval) { return DoCommand("Play", _retval); } NS_IMETHOD DoStop(PRBool *_retval) { return DoCommand("Stop", _retval); } // Seek takes a position argument, unlike the above. NS_IMETHOD SetPosition(PRInt32 Position, PRBool *_retval); // Property Get/Set's NS_IMETHOD DoNextItem(PRBool *_retval) { return DoNextEntry(_retval); } NS_IMETHOD DoPrevItem(PRBool *_retval) { return DoPrevEntry(_retval); } NS_IMETHOD DoNextEntry(PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_DONEXT, 0, _retval); } NS_IMETHOD DoPrevEntry(PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_DOPREV, 0, _retval); } NS_IMETHOD SetSource(const char *szSource, PRBool *_retval) { return SetPlayerStringProp(EMBD_PROP_SOURCE, szSource, _retval); } NS_IMETHOD SetControlString(const char *szControls, PRBool *_retval) { return SetPlayerStringProp(EMBD_PROP_CONTROLS, szControls, _retval); } NS_IMETHOD SetConsoleName(const char *szConsole, PRBool /* a */, PRBool *_retval) { // XXXVD,RGG: Same as SetConsole? What is the PRBool? return SetPlayerStringProp(EMBD_PROP_CONSOLE, szConsole, _retval); } NS_IMETHOD SetConsole(const char *szConsole, PRBool *_retval) { return SetPlayerStringProp(EMBD_PROP_CONSOLE, szConsole, _retval); } NS_IMETHOD SetAutoStart(PRBool bAutoStart, PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_AUTOSTART, bAutoStart, _retval); } NS_IMETHOD SetNoLabels(PRBool /* bNoLabels */, PRBool *_retval) { // XXXVD unsupported *_retval = PR_FALSE; return NS_OK; } NS_IMETHOD GetPosition(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_POSITION, _retval); } NS_IMETHOD GetLength(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_LENGTH, _retval); } NS_IMETHOD GetPlayState(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_PLAYSTATE, _retval); } NS_IMETHOD GetStereoState(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_STEREO, _retval); } NS_IMETHOD GetTitle(char **_retval) { return GetPlayerStringProp(EMBD_PROP_TITLE, _retval); } NS_IMETHOD GetAuthor(char **_retval) { return GetPlayerStringProp(EMBD_PROP_AUTHOR, _retval); } NS_IMETHOD GetCopyright(char **_retval) { return GetPlayerStringProp(EMBD_PROP_COPYRIGHT, _retval); } NS_IMETHOD GetLiveState(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_LIVE, _retval); } NS_IMETHOD IsZoomed(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_FULLSCR, _retval); } NS_IMETHOD SetZoomed(PRBool bIsZoomed, PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_FULLSCR, bIsZoomed, _retval); } NS_IMETHOD CanPlayPause(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_CANPLAYPAUSE, _retval); } NS_IMETHOD CanStop(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_CANSTOP, _retval); } NS_IMETHOD HasNextEntry(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_HASNEXTENTRY, _retval); } NS_IMETHOD HasPrevEntry(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_HASPREVENTRY, _retval); } NS_IMETHOD HasNextItem(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_HASNEXTENTRY, _retval); } NS_IMETHOD HasPrevItem(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_HASPREVENTRY, _retval); } NS_IMETHOD SetVolume(PRInt32 nNewVolume, PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_VOLUME, nNewVolume, _retval); } NS_IMETHOD SetMute(PRBool bIsMute, PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_MUTE, bIsMute, _retval); } NS_IMETHOD SetEnableContextMenu(PRBool bIsMenuOn, PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_CONTEXTMENU, bIsMenuOn, _retval); } NS_IMETHOD GetEnableContextMenu(PRBool *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_CONTEXTMENU, _retval); } NS_IMETHOD EnableMessageBox(PRBool /* isMessageBoxOn */, PRBool *_retval) { // XXXVD unsupported *_retval = PR_FALSE; return NS_OK; } NS_IMETHOD SetEnableMessageBox(PRBool /* isMessageBoxOn */, PRBool *_retval) { // XXXVD unsupported *_retval = PR_FALSE; return NS_OK; } NS_IMETHOD GetEnableMessageBox(PRBool *_retval) { // XXXVD unsupported *_retval = PR_FALSE; return NS_OK; } NS_IMETHOD GetPacketsTotal(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_PKTSTOTAL, _retval); } NS_IMETHOD GetPacketsReceived(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_PKTSRECV, _retval); } NS_IMETHOD GetPacketsOutOfOrder(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_PKTSORDER, _retval); } NS_IMETHOD GetPacketsMissing(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_PKTSMISSING, _retval); } NS_IMETHOD GetPacketsLate(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_PKTSLATE, _retval); } NS_IMETHOD GetBandwidthAverage(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_BWAVG, _retval); } NS_IMETHOD GetBandwidthCurrent(PRInt32 *_retval) { return GetPlayerUINT32Prop(EMBD_PROP_BWCUR, _retval); } NS_IMETHOD AboutBox(PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_ABOUTDLG, PR_TRUE, _retval); } NS_IMETHOD EditPreferences(PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_PREFSDLG, PR_TRUE, _retval); } NS_IMETHOD SetShowPreferences(PRBool bShowPref, PRBool *_retval) { return SetPlayerUINT32Prop(EMBD_PROP_PREFSDLG, bShowPref, _retval); } NS_IMETHOD HideShowStatistics(PRBool *_retval)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -