Re-send [Client-dev] CR: Add a library that provides C interface allowing applications to get decoded images easily

"Zhao, Halley" <[email protected]>
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <8FED46E8A9CA574792FC7AACAC38FE7701E7908E2E@PDSMSX501.ccr.corp.intel.com>
Hi dev:
Resend the patch for review.
This patch enables Helix rendering to targets not limit to window/site, make it possible to let clutter (clutter-media) work based on Helix Framework.
Details see below thread.

BR
-----Original Message-----
From: Bu, Long 
Sent: 2009年5月31日 11:31
To: Gregory Wright
Cc: [email protected]; Guo, Young; Zhao, Halley; Lynch, Rusty
Subject: RE: [Client-dev] CR: Add a library that provides C interface allowing applications to get decoded images easily

Thanks for your suggestion.
Attached patches are made with -uw.

Cheers.
Long

>-----Original Message-----
>From: Gregory Wright [mailto:[email protected]]
>Sent: 2009年5月29日 22:23
>To: Bu, Long
>Cc: [email protected]; Guo, Young
>Subject: Re: [Client-dev] CR: Add a library that provides C interface allowing
>applications to get decoded images easily
>
>It doesn't look like you are 'ignoring white space' with your diffs,
>hence
>they are very large. Can you generate the diffs with:
>
>    cvs -uw
>
>and send again?
>
>--greg.
>
>
>On May 21, 2009, at 7:34 PM, Bu, Long wrote:
>
>> Hi,
>> 	This patch seemed too big to review.
>> 	I made some small patches against the simpleplayer.
>> 	Hope that can help review.
>>
>> Cheers.
>> Long
>>> -----Original Message-----
>>> From: [email protected]
>>> [mailto:[email protected]] On Behalf Of Bu, Long
>>> Sent: 2009年5月11日 16:06
>>> To: [email protected]
>>> Cc: Guo, Young
>>> Subject: [Client-dev] CR: Add a library that provides C interface
>>> allowing
>>> applications to get decoded images easily
>>>
>>> Hi,
>>> 	Now the helix implementation only can render decoded frames into a
>>> window(or site).
>>> It's not easy for an application just to want to get the decoded
>>> frames and some
>>> meta info. like
>>> clip info, position, duration etc. The clutter-helix uses this
>>> library to
>>> implement the ClutterMedia
>>> interface very easily.
>>>
>>> 	This library provides a simple and direct way to do that. It's
>>> based on
>>> the splay and implements
>>> a new RootSurface and Site class.
>>>
>>> The Library's APIs which are declared in player.h in the patch are
>>> as below:
>>>
>>> 	int init_main();	to initialize the library before using it.
>>> 	int deinit_main();	to de-intialize when applications are done with
>>> the
>>> library.
>>>
>>> 	int get_player(void **ppPlayerHandle, PlayerCallbacks *pCallbacks,
>>> void
>>> *context);
>>> 	This functions create a player instance which is identified by
>>> ppPlayerHandle.
>>> 	pCallbacks are a set of callbacks as below. context will be passed
>>> in these
>>> callbacks.
>>> 	typedef void (*on_pos_length_cb_t)(unsigned int, unsigned int,
>>> void *);
>>> 	typedef void (*on_buffering_cb_t)(unsigned int, unsigned short,
>>> void *);
>>> 	typedef void (*on_state_change_cb_t)(unsigned short, unsigned
>>> short, void
>>> *);
>>> 	typedef void (*on_new_frame_cb_t)(unsigned char *p, unsigned int
>>> size,
>>> PlayerImgInfo *rect, void *context);
>>> 	typedef void (*on_error_cb_t)(unsigned long code, char *message,
>>> void
>>> *context);
>>>
>>> 	typedef struct {
>>> 	    on_pos_length_cb_t   on_pos_length_cb;	/* called when helix's
>>> OnPosLength gets called */
>>> 	    on_buffering_cb_t    on_buffering_cb;		/*Called when helix's
>>> OnBuffering gets called */
>>> 	    on_state_change_cb_t on_state_change_cb;	/* called when state
>>> changed. States are:
>>> 			typedef enum _EHXPlayerState
>>> 			{
>>> 			    PLAYER_STATE_READY = 0,  // uninitialized
>>> 			    PLAYER_STATE_CONNECTING, // attempting to connect to sources
>>> 			    PLAYER_STATE_CONNECTED,  // connected to sources (realized)
>>> 			    PLAYER_STATE_OPENING,    // opening sources
>>> 			    PLAYER_STATE_OPENED,     // opened sources
>>> 			    PLAYER_STATE_PREFETCHING,    // obtaining resources,
>>> buffering, etc.
>>> 			    PLAYER_STATE_PREFETCHED, // ready for playback at time zero
>>> 			    PLAYER_STATE_PLAYING,    // currently playing
>>> 			    PLAYER_STATE_PAUSED,     // paused
>>> 			    PLAYER_STATE_SEEKING     // seeking
>>> 			} EHXPlayerState;
>>> 				*/
>>>
>>> 	    on_new_frame_cb_t    on_new_frame_cb;	/* called when a new
>>> frame is
>>> decoded */
>>> 	    on_error_cb_t        on_error_cb;	/* called when error occurs
>>> in helix
>>> */
>>> 	} PlayerCallbacks;
>>>
>>>
>>> 	int player_openurl( void *pPlayerHandle, char *pszRawURL);	/* Open a
>>> URL */
>>> 	int player_geturl( void *pPlayerHandle, char **pszURL);	/* Get the
>>> current used URL */
>>>
>>> 	int player_begin( void *pPlayerHandle );	/* start playing */
>>> 	 int player_stop( void *pPlayerHandle );	/* stop playing */
>>> 	int player_pause( void *pPlayerHandle );	/* pause playing */
>>>
>>> 	unsigned int get_curr_playtime(void *pPlayerHandle);	/* get the
>>> current position */
>>> 	int player_seek(void *pPlayerHandle, int pos);	/* seek */
>>> 	int player_canseek(void *pPlayerHandle);	/* can the media be
>>> seekable */
>>>
>>> 	int player_getvolume(void *pPlayerHandle);
>>> 	int player_setvolume(void *pPlayerHandle, unsigned short volumn);
>>>
>>>
>>>
>>> Please review. Thanks in advance.
>>>
>>> Cheers.
>>> Long
>>>
>>>
>>>
>>
><advsnk.h.diff><aumgr.cpp.diff><aumgr.h.diff><context.cpp.diff><context.h.d
>iff><error.cpp.diff><exerror.cpp.diff><exerror.h.diff><exprdnld.cpp.diff><e
>xprdnld.h.diff><exsite.cpp.diff><exsite.h.diff><globals.h.diff><iids.cpp.di
>ff><player.cpp.diff><preflist.cpp.diff><preflist.h.diff><print.h.diff><root
>surf.cpp.diff><rootsurf.h.diff><sitesupplier.cpp.diff><sitesupplier.h.diff>
><stateadvsink.cpp.diff><stateadvsink.h.diff><surf.cpp.diff><surf.h.diff>___
>____________________________________________
>> Client-dev mailing list
>> [email protected]
>> http://lists.helixcommunity.org/mailman/listinfo/client-dev

_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
CHXClientStateAdviceSink.cpp.diff (application/octet-stream, 5.6 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXClientStateAdviceSink.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -0,0 +1,192 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#include <stdio.h>
+
+#include "hxtypes.h"
+
+#include "hxcom.h"
+#include "hxcomm.h"
+#include "hxmon.h"
+#include "hxcore.h"
+#include "hxengin.h"
+#include "hxclsnk.h"
+#include "hxgroup.h"
+#include "hxstrutl.h"
+#include "hxstring.h"
+#include "hxprefs.h"
+
+#include "CHXClientStateAdviceSink.h"
+#include "CHXClientContext.h"
+#include "print.h"
+#include "globals.h"
+#include "player.h"
+
+struct _stGlobals*& GetGlobal(); //in main.cpp
+
+void PrintBuffer(const char* pszName,const unsigned char* pbBuf, unsigned int dwBytes);
+
+CHXClientStateAdviceSink::CHXClientStateAdviceSink(IUnknown* pUnknown, LONG32 lClientIndex, on_state_change_cb_t on_state_change_cb, void *context)
+    : m_lRefCount (0)
+    , m_lClientIndex (lClientIndex)
+    , m_pUnknown (NULL)
+    , m_state_change_cb(on_state_change_cb)
+    , m_context(context)
+    , m_State (HX_CLIENT_STATE_READY)
+{
+    if (pUnknown)
+    {
+        m_pUnknown = pUnknown;
+        m_pUnknown->AddRef();
+
+        IHXPlayer* pPlayer;
+        IHXClientStateAdviseSinkControl *pStateControl;
+        if(HXR_OK == m_pUnknown->QueryInterface(IID_IHXPlayer,
+                    (void**)&pPlayer))
+        {
+            m_pPlayer = pPlayer;
+
+
+        }
+
+        if (HXR_OK == m_pUnknown->QueryInterface(IID_IHXClientStateAdviseSinkControl, (void **)&pStateControl))
+        {
+            pStateControl->AddClientStateAdviseSink(this);
+        }
+    }
+
+}
+
+CHXClientStateAdviceSink::~CHXClientStateAdviceSink(void)
+{
+
+    if (m_pPlayer)
+    {
+        m_pPlayer->Release();
+        m_pPlayer = NULL;
+    }
+    if (m_pUnknown)
+    {
+        m_pUnknown->Release();
+        m_pUnknown = NULL;
+    }
+}
+
+
+// *** IUnknown methods ***
+
+/////////////////////////////////////////////////////////////////////////
+//  Method:
+//	IUnknown::QueryInterface
+//  Purpose:
+//	Implement this to export the interfaces supported by your 
+//	object.
+//
+STDMETHODIMP CHXClientStateAdviceSink::QueryInterface(REFIID riid, void** ppvObj)
+{
+    if (IsEqualIID(riid, IID_IUnknown))
+    {
+        AddRef();
+        *ppvObj = (IUnknown*)(IHXClientStateAdviseSink *)this;
+        return HXR_OK;
+    }
+    else if (IsEqualIID(riid, IID_IHXClientStateAdviseSink))
+    {
+        AddRef();
+        *ppvObj = (IHXClientStateAdviseSink*)this;
+        return HXR_OK;
+    }
+
+    *ppvObj = NULL;
+    return HXR_NOINTERFACE;
+}
+
+/////////////////////////////////////////////////////////////////////////
+//  Method:
+//	IUnknown::AddRef
+//  Purpose:
+//	Everyone usually implements this the same... feel free to use
+//	this implementation.
+//
+STDMETHODIMP_(ULONG32) CHXClientStateAdviceSink::AddRef()
+{
+    return InterlockedIncrement(&m_lRefCount);
+}
+
+/////////////////////////////////////////////////////////////////////////
+//  Method:
+//	IUnknown::Release
+//  Purpose:
+//	Everyone usually implements this the same... feel free to use
+//	this implementation.
+//
+STDMETHODIMP_(ULONG32) CHXClientStateAdviceSink::Release()
+{
+    if (InterlockedDecrement(&m_lRefCount) > 0)
+    {
+        return m_lRefCount;
+    }
+
+    delete this;
+    return 0;
+}
+
+
+/************************************************************************
+ *      Method:
+ *          IHXClientStateAdviseSink::OnStateChange
+ *      Purpose:
+ *          Called to advise the client state has changed state
+ */
+STDMETHODIMP CHXClientStateAdviceSink::OnStateChange(UINT16 uOldState, UINT16 uNewState)
+{
+    if (m_state_change_cb)
+        m_state_change_cb(uOldState, uNewState, m_context);
+
+    m_State = (EHXClientState) uNewState;
+    return HXR_OK;
+}
+
+EHXClientState CHXClientStateAdviceSink::GetState()
+{
+    return m_State;
+}
+
+
CHXClientStateAdviceSink.h.diff (application/octet-stream, 3.7 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXClientStateAdviceSink.h	2009-04-16 13:37:29.000000000 +0800
@@ -0,0 +1,112 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#ifndef _CHX_CLIENT_STATE_ADVISE_SINK_H_
+#define _CHX_CLIENT_STATE_ADVISE_SINK_H_
+
+#include "player.h"
+
+struct IHXClientStateAdviseSink;
+struct IHXGroupSink;
+struct IUnknown;
+struct IHXRegistry;
+struct IHXScheduler;
+struct IHXCallback;
+struct IHXPlayer;
+struct IHXGroup;
+
+class CHXClientStateAdviceSink : public IHXClientStateAdviseSink
+{
+private:
+    LONG32 m_lRefCount;
+    LONG32 m_lClientIndex;
+
+    IUnknown *m_pUnknown;
+
+    UINT32 m_ulStartTime;
+    UINT32 m_ulStopTime;
+
+    UINT32 m_lCurrentBandwidth;
+    UINT32 m_lAverageBandwidth;
+    HXBOOL m_bOnStop;
+
+    HXBOOL m_bWaitForTrackStart;
+
+    on_state_change_cb_t m_state_change_cb;
+    void                *m_context;
+    EHXClientState       m_State;
+
+    // IHXCallback
+    IHXPlayer *m_pPlayer;
+    ULONG32    m_hCallback;
+    ~CHXClientStateAdviceSink();
+
+public:
+    
+    CHXClientStateAdviceSink(IUnknown* /*IN*/ pUnknown, LONG32 /*IN*/ lClientIndex, on_state_change_cb_t on_state_change_cb = NULL, void *context = NULL);
+
+    /*
+     *  IUnknown methods
+     */
+    STDMETHOD(QueryInterface) (THIS_
+			       REFIID riid,
+			       void** ppvObj);
+
+    STDMETHOD_(ULONG32,AddRef) (THIS);
+
+    STDMETHOD_(ULONG32,Release) (THIS);
+
+    /***********************************************************************
+     *  Method:
+     *     IHXClientStateAdviseSink::OnStateChange
+     *    Purpose:
+     *       Called by client engine to inform the client that the state has changed.
+     *      States are defined in the enum EHXClientState, defined in this file.
+     *
+     */
+    STDMETHOD(OnStateChange) (THIS_
+			      UINT16 uOldState,
+			      UINT16 uNewState
+	);
+
+    EHXClientState GetState();
+};
+
+#endif // _CHX_CLIENT_STATE_ADVISE_SINK_H_
CHXRootSurf.cpp.diff (application/octet-stream, 13 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXRootSurf.cpp	2009-05-05 16:18:12.000000000 +0800
@@ -0,0 +1,422 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+// for shared memory
+#include <sys/types.h>
+
+#include "hxcom.h"
+#include "hxwintyp.h"
+#include "hxvsurf.h"
+#include "hxslist.h"
+#include "colormap.h"
+#include "hxprefs.h"
+#include "hxtick.h"
+#include "hxthread.h"
+#include "basesite.h"
+
+#include "CHXRootSurf.h"
+#include "CHXSite.h"
+
+#  define MAX_SHARED_REGIONS ((UINT32)9999)
+
+#ifndef BI_LIBVA
+#define BI_LIBVA         MAKEFOURCC('L','B','V','A') /* using LibVa surface */
+#endif
+
+#ifndef BI_I420
+#define BI_I420         MAKEFOURCC('I','4','2','0') /* planar YCrCb   */
+#endif
+
+
+
+CHXRootSurf::CHXRootSurf(IUnknown* pContext, CHXBaseSite* pSite, on_new_frame_cb_t on_new_frame_cb, void *context )
+    : CBaseRootSurface(pContext, pSite)
+    , m_nBitsPerPixel(0)
+    , m_pYUVScratchBits(NULL)
+    , m_nYUVScratchPitch(0)
+    , m_pScratchBits(NULL)
+    , m_nScratchPitch(0)
+    , m_nCompositionSize(0)
+    , m_on_new_frame_cb(on_new_frame_cb)
+      , m_context(context)
+{
+    memset(&m_bmiSave, 0, sizeof(HXBitmapInfo));
+}
+
+HX_RESULT CHXRootSurf::Init()
+{
+    //get window and display from main Site.
+    HXxWindow* pWindow = m_pSite->GetWindow();
+    HX_ASSERT(pWindow);
+
+    m_window   = (FakeWindow *)pWindow->window;
+
+    HX_ASSERT( m_window );
+    memset(&m_bmiSave, 0, sizeof(HXBitmapInfo));
+	
+	m_nBitsPerPixel = 12;
+	m_bmiSave.bmiHeader.biBitCount    = 12;
+	m_bmiSave.bmiHeader.biCompression = BI_I420;
+
+    //Set primary surface CID.
+    m_nCompositionSurfaceCID = GetBitmapColor(&m_bmiSave);
+    return HXR_OK;
+}
+
+CHXRootSurf::~CHXRootSurf()
+{
+    _DestroyCompositionSurface();
+
+    HX_DELETE(m_pCompositionSurface);
+    m_nCompositionSize=0;
+    m_bCompositionSurfaceCreated=FALSE;
+
+    HX_VECTOR_DELETE( m_pScratchBits );
+    HX_VECTOR_DELETE( m_pYUVScratchBits );
+
+}
+
+
+HX_RESULT CHXRootSurf::_ResizeVideoBuffer( INT32 nSize)
+{
+    HX_RESULT retVal=HXR_OK;
+
+    if(nSize <= m_nCompositionSize)
+        return retVal;
+
+    //We need to fall through here so that if the shared memory stuff
+    //above fails we can create it the old fashioned way.
+    if(m_pCompositionSurface == NULL)
+    {
+        m_pCompositionSurface = (UCHAR*) malloc(nSize);
+    }
+    else
+    {
+        m_pCompositionSurface = (UCHAR*) realloc(m_pCompositionSurface, nSize);
+    }
+    if( m_pCompositionSurface )
+    {
+        m_nCompositionSize = nSize;
+    }
+    else
+    {
+        HX_ASSERT("We can't alloc the composition surface." == NULL );
+        m_nCompositionSize = 0;
+    }
+
+    return retVal;
+}
+
+HX_RESULT CHXRootSurf::_DebugBlt( UCHAR* pImageData, HXBitmapInfoHeader* pBitmapInfo,
+        HXxRect& rDestRect, HXxRect& rSrcRect)
+{
+    return HXR_OK;
+}
+
+void CHXRootSurf::_GetYUVScratchWidthHeight(UINT32* pWidth, UINT32* pHeight)
+{
+    *pWidth     = m_bmiYUVScratch.bmiHeader.biWidth;
+    *pHeight    = m_bmiYUVScratch.bmiHeader.biHeight;
+}
+
+void CHXRootSurf::_CreateYUVScratchSurface(UINT32 width, UINT32 height)
+{
+}
+
+void CHXRootSurf::_GetYUVScratchSurfacePointer(UCHAR** pYUVBits, INT32* YUVPitch)
+{
+    *pYUVBits = m_pYUVScratchBits;
+    *YUVPitch = m_nYUVScratchPitch;
+}
+
+HX_RESULT CHXRootSurf::CreateScratchSurface( int nCompositionSurfaceCID, HXxSize* pSize)
+{
+    //Remove old bits....
+    HX_DELETE(m_pScratchBits);
+
+    //Clear BitmapInfo struct....
+    memset(&m_bmiScratch, 0, sizeof(HXBitmapInfo));
+    int nResult = MakeBitmap( &m_bmiScratch,
+            sizeof(m_bmiScratch),
+            nCompositionSurfaceCID,
+            pSize->cx,
+            pSize->cy,
+            NULL,
+            0);
+    if( nResult )
+    {
+        m_pScratchBits  = new UCHAR[m_bmiScratch.bmiHeader.biSizeImage];
+        m_nScratchPitch = GetBitmapPitch(&m_bmiScratch);
+    }
+
+    return nResult? HXR_OK : HXR_FAIL;
+}
+
+HX_RESULT CHXRootSurf::ScratchLock(UCHAR** pBits, INT32* pPitch)
+{
+    *pBits  = m_pScratchBits;
+    *pPitch = m_nScratchPitch;
+    return HXR_OK;
+}
+
+HX_RESULT CHXRootSurf::ScratchUnlock(UCHAR* pBits)
+{
+    return HXR_OK;
+}
+
+HX_RESULT CHXRootSurf::_MinimalUnlock(HXxWindow* pWindow)
+{
+    return HXR_OK;
+}
+
+HX_RESULT CHXRootSurf::_LockComposition(UCHAR** pBits, INT32* pPitch)
+{
+    HX_RESULT retVal = HXR_OK;
+    if( !m_bCompositionSurfaceCreated || m_pCompositionSurface==NULL )
+    {
+        retVal = _CreateCompositionSurface();
+    }
+    HX_ASSERT( m_pCompositionSurface );
+    *pBits  = m_pCompositionSurface;
+    *pPitch = m_nCompositionPitch;
+    return HXR_OK;
+}
+
+
+void CHXRootSurf::_BltFromScratchToComposition( HXxRect& rDestRect, HXxRect& rSrcRect)
+{
+    HX_ASSERT( "Not implemented on unix yet...."==NULL );
+}
+
+HX_RESULT CHXRootSurf::_CreateCompositionSurface()
+{
+    HX_RESULT retVal = HXR_FAIL;
+
+    if(m_bCompositionSurfaceCreated)
+    {
+        return HXR_OK;
+    }
+
+    HX_ASSERT( !m_bCompositionSurfaceCreated );
+    HX_ASSERT( m_pSite );
+
+    //Create a BMI to describe the composition surface
+    HXxSize hxxSize;
+    m_pSite->GetSize(hxxSize);
+    memcpy(&m_compositionSize, &hxxSize, sizeof(HXxSize)); /* Flawfinder: ignore */
+
+    // find out how big we want to allocate.
+    if (m_pSite->IsFullScreen())
+    {
+        UINT16 unDummy=0;
+        UINT16 unHorzRes=0;
+        UINT16 unVertRes=0;
+        m_pSite->_GetDeviceCaps(NULL, unDummy, unHorzRes, unVertRes );
+        m_allocatedCompositionSize.cx = unHorzRes;
+        m_allocatedCompositionSize.cy = unVertRes;
+    }
+    else
+    {
+        // we use root surface for BASIC_BLT and it assumes the offset(position) 
+        // of the root site it cooresponding to is (0, 0).
+        //
+        // this is not true for "windowless" mode where the root site can be given
+        // an offset, as a result, we fail to blt the video.
+        //
+        // to fix this, we'll take the m_positionOrg into consideration when
+        // creating the composition surface, this may not be optimal but good enough
+        // for now.
+        //
+        // similar logic is also added for other platforms, we need to move this
+        // common code to the base class when we have chance to clean it up
+        if (m_compositionSize.cx && m_compositionSize.cy)
+        {
+            m_compositionSize.cx += m_pSite->m_positionOrig.x;
+            m_compositionSize.cy += m_pSite->m_positionOrig.y;
+        }
+
+        m_allocatedCompositionSize.cx = m_compositionSize.cx;
+        m_allocatedCompositionSize.cy = m_compositionSize.cy;
+    }
+
+    //XXXgfw uhhhh, OK.
+    if( m_compositionSize.cx > m_allocatedCompositionSize.cx ||
+            m_compositionSize.cy > m_allocatedCompositionSize.cy )
+    {
+        m_allocatedCompositionSize.cx = m_compositionSize.cx;
+        m_allocatedCompositionSize.cy = m_compositionSize.cy;
+    }
+
+    //Make the bitmap header struct.
+    m_bmiComposition.bmiHeader.biBitCount    = m_bmiSave.bmiHeader.biBitCount;
+    m_bmiComposition.bmiHeader.biCompression = m_bmiSave.bmiHeader.biCompression;
+    m_bmiComposition.un.dwBitMask[0]         = m_bmiSave.un.dwBitMask[0];
+    m_bmiComposition.un.dwBitMask[1]         = m_bmiSave.un.dwBitMask[1];
+    m_bmiComposition.un.dwBitMask[2]         = m_bmiSave.un.dwBitMask[2];
+    MakeBitmap( &m_bmiComposition,
+		sizeof(m_bmiComposition),
+		m_nCompositionSurfaceCID,
+		m_allocatedCompositionSize.cx,
+		m_allocatedCompositionSize.cy,
+		NULL,
+		0);
+    m_bmiComposition.bmiHeader.biBitCount    = m_bmiSave.bmiHeader.biBitCount;
+    m_bmiComposition.bmiHeader.biCompression = m_bmiSave.bmiHeader.biCompression;
+    m_bmiComposition.un.dwBitMask[0]         = m_bmiSave.un.dwBitMask[0];
+    m_bmiComposition.un.dwBitMask[1]         = m_bmiSave.un.dwBitMask[1];
+    m_bmiComposition.un.dwBitMask[2]         = m_bmiSave.un.dwBitMask[2];
+
+    //Now create the bits....
+    _ResizeVideoBuffer( m_bmiComposition.bmiHeader.biSizeImage );
+    m_nCompositionPitch = GetBitmapPitch( &m_bmiComposition );
+
+    m_bCompositionSurfaceCreated = TRUE;
+    retVal = HXR_OK;
+    return retVal;
+}
+
+void CHXRootSurf::_MinimalBlt(HXxRect& destRect)
+{
+    UINT32 len;
+    if (m_on_new_frame_cb) {
+        PlayerImgInfo Info;
+        Info.Rect.left = destRect.left;
+        Info.Rect.right = destRect.right;
+        Info.Rect.top = destRect.top;
+        Info.Rect.bottom = destRect.bottom;
+        Info.cx = m_allocatedCompositionSize.cx;
+        Info.cy = m_allocatedCompositionSize.cy;
+
+		if (m_nCompositionSurfaceCID == CID_LIBVA) {
+            Info.cid = CID_LIBVA;
+            len = 4;    /* m_pCompositionSurface contains only refid. FIXME: replace 4 with sizeof(refid) */
+		} else if (m_nCompositionSurfaceCID == CID_I420) {
+			Info.cid = CID_I420;
+            len = m_bmiComposition.bmiHeader.biSizeImage;
+		}else {
+			fprintf(stderr, "unknown m_nCompositionSurfaceCID:%d\n", m_nCompositionSurfaceCID);
+			return;
+		}
+        m_on_new_frame_cb(m_pCompositionSurface, len, &Info, m_context);
+    }
+}
+
+HX_RESULT CHXRootSurf::_DestroyCompositionSurface()
+{
+    HX_RESULT retVal = HXR_OK;
+    if( m_bCompositionSurfaceCreated )
+    {
+        m_bCompositionSurfaceCreated = FALSE;
+    }
+
+    return retVal;
+}
+
+
+
+HX_RESULT CHXRootSurf::BeginOptimizedBlt(HXBitmapInfoHeader* pBitmapInfo)
+{
+#ifdef _DEBUG
+    fprintf(stderr, "CHXRootSurf::BeginOptimizedBlt Needs to be written\n" );
+#endif
+    return HXR_NOTIMPL;
+}
+
+HX_RESULT CHXRootSurf::Blt (THIS_ UCHAR*                pImageData,
+                          HXBitmapInfoHeader*   pBitmapInfo,
+                          REF(HXxRect)          rDestRect,
+                          REF(HXxRect)          rSrcRect,
+                          CHXBaseSite*          pSite)
+{
+	if (m_bmiSave.bmiHeader.biCompression != pBitmapInfo->biCompression &&
+			(m_bmiSave.bmiHeader.biCompression == BI_LIBVA || pBitmapInfo->biCompression == BI_LIBVA)) {
+		memset(&m_bmiSave, 0, sizeof(HXBitmapInfo));
+		if (pBitmapInfo->biCompression == BI_LIBVA) {
+			m_nBitsPerPixel = 1;
+			m_bmiSave.bmiHeader.biBitCount    = 1;
+			m_bmiSave.bmiHeader.biCompression = BI_LIBVA;
+		} else {
+			m_nBitsPerPixel = 12;
+			m_bmiSave.bmiHeader.biBitCount    = 12;
+			m_bmiSave.bmiHeader.biCompression = BI_I420;
+		}
+		//Set primary surface CID.
+		m_nCompositionSurfaceCID = GetBitmapColor(&m_bmiSave);
+	}
+
+	return CBaseRootSurface::Blt(pImageData, pBitmapInfo, rDestRect, rSrcRect, pSite);
+}
+
+
+
+HX_RESULT CHXRootSurf::OptimizedBlt( UCHAR*   pImageBits,
+        HXxRect& rDestRect,
+        HXxRect& rSrcRect)
+{
+#ifdef _DEBUG
+    fprintf(stderr, "CHXRootSurf::OptimizedBlt Needs to be written\n" );
+#endif
+    return HXR_NOTIMPL;
+}
+
+HX_RESULT CHXRootSurf::EndOptimizedBlt(void)
+{
+#ifdef _DEBUG
+    fprintf(stderr, "CHXRootSurf::EndOptimizedBlt Needs to be written\n" );
+#endif
+    return HXR_NOTIMPL;
+}
+
+HX_RESULT CHXRootSurf::GetOptimizedFormat(HX_COMPRESSION_TYPE& ulType)
+{
+#ifdef _DEBUG
+    fprintf(stderr, "CHXRootSurf::GetOptimizedFormat Needs to be written\n" );
+#endif
+    return HXR_NOTIMPL;
+}
+
+HX_RESULT CHXRootSurf::GetPreferredFormat(HX_COMPRESSION_TYPE& ulType)
+{
+#ifdef _DEBUG
+    fprintf(stderr, "CHXRootSurf::GetPreferredFormat Needs to be written\n" );
+#endif
+    return HXR_NOTIMPL;
+}
+
CHXRootSurf.h.diff (application/octet-stream, 5.1 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXRootSurf.h	2009-04-29 14:40:19.000000000 +0800
@@ -0,0 +1,125 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#ifndef _CHX_ROOT_SURF_H_
+#define _CHX_ROOT_SURF_H_
+
+#include "baseroot.h"
+#include "player.h"
+#include "CHXSite.h"
+
+class CHXRootSurf : public CBaseRootSurface
+{
+public:
+   CHXRootSurf(IUnknown* pContext, CHXBaseSite* pSite, on_new_frame_cb_t on_new_frame_cb = NULL, void *context = NULL);
+
+   //Helpers....
+   HX_RESULT Init();
+
+   //public inherited stuff
+   virtual HX_RESULT CreateScratchSurface(int nCompositionSurfaceCID, 
+                                          HXxSize* pSize);
+   virtual HX_RESULT ScratchLock(UCHAR** pBits, INT32* pPitch);
+   virtual HX_RESULT ScratchUnlock(UCHAR* pBits);
+
+   virtual HX_RESULT BeginOptimizedBlt(HXBitmapInfoHeader* pBitmapInfo);
+   virtual HX_RESULT OptimizedBlt( UCHAR*   pImageBits,
+                                   HXxRect& rDestRect,
+                                   HXxRect& rSrcRect);
+   virtual HX_RESULT EndOptimizedBlt(void);
+   virtual HX_RESULT GetOptimizedFormat(HX_COMPRESSION_TYPE& ulType);
+   virtual HX_RESULT GetPreferredFormat(HX_COMPRESSION_TYPE& ulType);
+   virtual HX_RESULT Blt (THIS_ UCHAR*                pImageData,
+                          HXBitmapInfoHeader*   pBitmapInfo,
+                          REF(HXxRect)          rDestRect,
+                          REF(HXxRect)          rSrcRect,
+                          CHXBaseSite*          pSite);
+
+
+
+protected:
+
+   //Smartly handle resizing of shm buffer.
+   HX_RESULT _ResizeVideoBuffer(INT32 nSize);
+
+   //Inherited from CBaseRootSurface....
+   virtual void _BltFromScratchToComposition(HXxRect& rDestRect,
+                                             HXxRect& rSrcRect);
+   virtual HX_RESULT _DebugBlt( UCHAR*               pImageData,
+                                HXBitmapInfoHeader* pBitmapInfo,
+                                HXxRect&             rDestRect,
+                                HXxRect&             rSrcRect);
+   virtual void _GetYUVScratchWidthHeight(UINT32* pWidth, UINT32* pHeight);
+   virtual void _CreateYUVScratchSurface(UINT32 width, UINT32 height);
+   virtual void _GetYUVScratchSurfacePointer(UCHAR** pYUVBits, INT32* YUVPitch);
+   virtual HX_RESULT _MinimalUnlock(HXxWindow* pWindow);
+   virtual HX_RESULT _LockComposition(UCHAR** pBits, INT32* pPitch);
+   virtual HX_RESULT _CreateCompositionSurface();
+   virtual HX_RESULT _DestroyCompositionSurface();
+   virtual void      _MinimalBlt(HXxRect& dest);
+   
+private:
+
+   virtual ~CHXRootSurf();
+   
+   //Protect unintentional copy and default ctors.
+   CHXRootSurf();
+   CHXRootSurf( const CHXRootSurf& );
+   CHXRootSurf& operator=( const CHXRootSurf& it );
+
+   //General display and GC stuff.
+   FakeWindow   *m_window;
+   //Colormap     m_colormap;
+   int          m_nBitsPerPixel;
+
+   //Bitmap stuff.
+   UCHAR*            m_pYUVScratchBits;
+   HXBitmapInfo      m_bmiYUVScratch;
+   int               m_nYUVScratchPitch;
+   UCHAR*            m_pScratchBits;
+   HXBitmapInfo      m_bmiScratch;
+   int               m_nScratchPitch;
+   HXBitmapInfo      m_bmiSave;
+   int               m_nCompositionSize;
+   on_new_frame_cb_t m_on_new_frame_cb;
+   void *            m_context;
+};
+
+#endif // _CHX_ROOT_SURF_H_
CHXSite.h.diff (application/octet-stream, 6.6 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXSite.h	2009-04-16 13:37:29.000000000 +0800
@@ -0,0 +1,174 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#ifndef _CHX_SITE_H_
+#define _CHX_SITE_H_
+
+#include "basesite.h"
+#include "hxcbobj.h"
+#include "player.h"
+#include "hxwin.h"
+
+typedef struct  {
+	HXxSize	size;
+} FakeWindow;
+
+class CHXSite : public CHXBaseSite
+{
+public:
+
+   friend class CHXSurf;
+   friend class CHXRootSurf;
+   
+   CHXSite( IUnknown* pContext,
+                IUnknown* pUnkOuter,
+                INT32 lInitialZorder,
+                on_new_frame_cb_t on_new_frame_cb = NULL,
+                void *context = NULL);
+   
+   void _ForwardUpdateEvent(HXxEvent* pEvent);
+
+   void _UpdateOverlayIfNeeded();
+   HXBOOL m_bIgnoreFocusOutInFS;
+
+   //We override this.
+   void CheckColorSettings();
+
+protected:
+   
+   virtual ~CHXSite();
+   
+   //
+   // CHXSite only methods....
+   //
+
+   //
+   // CHXBaseSite inherited methods
+   //
+   virtual void  _NeedWindowedSite();
+   virtual void  _AttachWindow();
+   virtual void  _DetachWindow();
+   virtual void* _Create(void* ParentWindow, UINT32 style);
+   virtual void  _Destroy(HXxWindow* pWindow); 
+   virtual void  _SetSize(HXxSize size); 
+   virtual void  _SetPosition(HXxPoint position); 
+   virtual void  _DamageRect(HXxRect rect);
+   virtual void  _DamageRegion(HXxRegion rect);
+   virtual HXBOOL  _ShouldEnterForceRedraw(); 
+   virtual void  _ExitForceRedraw(); 
+   virtual void  _SendOSUpdateMessage(); 
+   virtual void  _ShowSite(HXBOOL bShow); 
+   virtual HXBOOL  _AtSystemTime(); 
+   virtual void  _GetDeviceCaps( void* hdc,
+                                 UINT16& uBitesPerPixel,
+                                 UINT16& uHorzRes,
+                                 UINT16& uVertRes ); 
+   virtual void  _GetWindowRect(HXxRect* destRect);
+   virtual void  _DestroySliders();
+   virtual HXBOOL  _HandleOSEvents(HXxEvent* pEvent);
+   virtual HXBOOL  _ConvertToHXEvent(HXxEvent* pEvent);
+   virtual void  _GenerateOSEvent(HXxEvent* pEvent, HXxEvent* pEvent2);
+   virtual void  _GenerateSetCursorEvent();
+   virtual void  _TryCreateXSlider();
+   virtual void  _SetXSliderValues(INT32 range, INT32 pageSize);
+   virtual void  _TryCreateYSlider();
+   virtual void  _SetYSliderValues(INT32 range, INT32 pageSize);
+   virtual void  _GetSystemSizeOfSliders(INT32* pWidth, INT32* pHeight);
+   virtual HXBOOL  _IsWindowVisible();
+   virtual void  _ShowXSlider(HXBOOL bShow);
+   virtual void  _MoveXSlider( INT32 left,
+                               INT32 top,
+                               INT32 right,
+                               INT32 bottom,
+                               HXBOOL bRedraw );
+   virtual void  _ShowYSlider(HXBOOL bShow);
+   virtual void  _MoveYSlider( INT32 left,
+                               INT32 top,
+                               INT32 right,
+                               INT32 bottom,
+                               HXBOOL bRedraw);
+   virtual HXBOOL  _DoesXSliderExist();
+   virtual void* _GetContainingWindow();
+   virtual void  _GetCursorPos(HXxPoint* pPoint);
+   virtual void  _MapPointToOSWindow(HXxPoint* pPt, void** pWindowHandle);
+   virtual void* _GetWindowWithCursor();
+   virtual void  _ReInitPrimarySurface();
+   virtual HXBOOL  _MoveWindow( void* ,
+                              INT32 X,
+                              INT32 Y,
+                              INT32 nWidth,
+                              INT32 nHeight,
+                              HXBOOL bRepaint);
+   virtual HXBOOL  _UpdateWindow(void* hWnd);
+   virtual HXBOOL  _ShowWindow(void* hWnd, INT32 nCmdShow);
+   virtual HXBOOL  _SetWindowPos(void* hWnd,
+                               void* hWndInsertAfter,
+                               INT32 X,
+                               INT32 Y,
+                               INT32 cx,
+                               INT32 cy,
+                               INT32 uFlags);
+   virtual HXBOOL  _SetWindowRgn(void* hWnd, HXREGION* hRgn, HXBOOL bRedraw);
+   virtual void _SetFocus(void* pWindow);
+    
+   virtual HX_RESULT _EnterFullScreen(HXxWindow* pWindow = NULL);
+   virtual HX_RESULT _EventOccurred(HXxEvent* pEvent);
+   virtual HX_RESULT _ExitFullScreen();
+   virtual HX_RESULT _TestFullScreen( void* hTestBitmap,
+                                      const char* pszStatusText );
+   virtual HX_RESULT _EnterFullScreenExt(HXxWindow* pWindow, IHXValues* pValues);
+   virtual HX_RESULT _ExitFullScreenExt();
+   HXBOOL                  m_bReparent;   
+
+private:
+
+   //Protect unintentional copy and default ctors.
+   CHXSite();
+   CHXSite( const CHXSite& );
+   CHXSite& operator=( const CHXSite& it );
+   
+   HXBOOL          m_bLastPointInSite;
+   HXBOOL          m_bDamaged;
+
+   on_new_frame_cb_t m_on_new_frame_cb;
+   void *m_context;
+};
+
+#endif // _CHX_SITE_H_
CHXSurf.cpp.diff (application/octet-stream, 5 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXSurf.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -0,0 +1,193 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#include <errno.h>
+
+#include "hxcom.h"
+#include "hxtypes.h"
+#include "hxwintyp.h"
+#include "hxvsurf.h"
+#include "hxslist.h"
+#include "hxheap.h"
+#include "hxtick.h"
+#include "colormap.h"
+#include "hxthread.h"
+#include "ihxpckts.h"
+#include "basesite.h"
+#include "hxprefutil.h"
+
+#include "CHXSurf.h"
+#include "CHXRootSurf.h"
+#include "CHXSite.h"
+
+CHXSurf::CHXSurf( IUnknown* pContext, CHXBaseSite* pSite )
+    : CBaseSurface( pContext, pSite )
+{
+
+}
+
+CHXSurf::~CHXSurf()
+{
+}
+
+void CHXSurf::_ReleaseSurface(CBaseRootSurface* pSurface)
+{
+    //Release our grab on the port and assorted memory.....
+    _ReleaseSurface();
+}
+
+void CHXSurf::_DrawBlack(void* pWindow)
+{
+    //XXXgfw fill whole window with black? Just our rect?
+}
+
+HX_RESULT CHXSurf::_BltToPrimary(HXxRect& rDestRect, HXxRect& rSrcRect)
+{
+#ifdef _DEBUG
+    fprintf( stderr, "CHXSurf::_BltToPrimary is called...\n" );
+#endif
+    return HXR_FAIL;
+}
+
+void CHXSurf::_CreateBuffer()
+{
+}
+
+HX_RESULT CHXSurf::_GetCaps(UINT32 *pfSurfaceCaps)
+{
+    *pfSurfaceCaps = 0;
+    return HXR_OK;
+}
+
+HX_RESULT CHXSurf::_CreateOverlay(HXBOOL bOverlay, int cid, int x, int y)
+{
+    HX_ASSERT("CHXSurf::_CreateOverlay should not be called" == NULL);
+    return FALSE;
+}
+
+HX_RESULT CHXSurf::_LockInternalSurface( UCHAR**  ppSurfPtr,
+        LONG32*  pnSurfPitch,
+        HXxSize& notused )
+{
+    HX_ASSERT("CHXSurf::_LockInternalSurface should not be called" == NULL);
+    return HXR_OK;
+}
+
+HX_RESULT CHXSurf::_UnlockInternalSurface(UCHAR* pSurfPtr)
+{
+    HX_ASSERT("CHXSurf::_UnLockInternalSurface should not be called" == NULL);
+    return HXR_OK;
+}
+
+void CHXSurf::_SetupDCObjects(HXxDC hxxDC, void** phOldBrush, void** phOldPen)
+{
+}
+
+void CHXSurf::_FillRectangle(HXxDC hxxDC,
+        UINT32 left, UINT32 top,
+        UINT32 right, UINT32 bottom)
+{
+}
+
+void CHXSurf::_RestoreDCObjects(HXxDC hxxDC, void* hOldBrush, void* hOldPen)
+{
+}
+
+void CHXSurf::_GetCompositionSurfaceHXxDC(HXxDC *hdc)
+{
+    HX_ASSERT("CHXSurf::_GetCompositionSurfaceHXxDC not implemented" == NULL);
+}
+
+void CHXSurf::_ReleaseCompositionSurfaceHXxDC(HXxDC hdc)
+{
+    //Nothing to do on unix...
+}
+
+INT32 CHXSurf::_InsureColorMatch(INT32 InColor)
+{
+    return InColor;
+}
+
+void CHXSurf::_SetColorKey(INT32 nColorSpaceLowValue,INT32 nColorSpaceHighValue)
+{
+}
+
+#if defined(HELIX_FEATURE_HARDWARE_COLOR_CONTROLS)
+
+HXBOOL CHXSurf::HasHWColorConrols()
+{
+    return FALSE;
+}
+
+void CHXSurf::SetHWColorControls()
+{
+}
+#endif
+
+void CHXSurf::_UpdateOverlay(HXxRect* dest, HXxRect* src, INT32 inFlags)
+{
+    HX_ASSERT("CHXSurf::_UpdateOverlay not implemented" == NULL);
+}
+
+HXBOOL CHXSurf::_IsSurfaceVisible()
+{
+    return TRUE;
+}
+
+void CHXSurf::_ReleaseSurface()
+{
+}
+
+HXxDC CHXSurf::_GetDC(HXxWindow*)
+{
+    HX_ASSERT("CHXSurf::_GetDC not implemented" == NULL);
+    return NULL;
+}
+
+void CHXSurf::_ReleaseDC(HXxWindow*, HXxDC)
+{
+    HX_ASSERT("CHXSurf::_GetDC not implemented" == NULL);
+}
+
+void CHXSurf::_GetWindowDeviceCords(HXxRect* rect )
+{
+    memset( rect, 0, sizeof( HXxRect) );
+}
+
CHXSurf.h.diff (application/octet-stream, 4.3 KB)
--- /dev/null	2009-04-21 11:12:45.000000000 +0800
+++ mediasinklib/CHXSurf.h	2009-04-16 13:37:29.000000000 +0800
@@ -0,0 +1,96 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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.  
+ *  
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#ifndef _CHX_SURF_H_
+#define _CHX_SURF_H_
+
+#include "basesurf.h"
+#include "baseroot.h"
+
+class CHXSurf : public CBaseSurface
+{
+    public:
+        CHXSurf( IUnknown* pContext, CHXBaseSite* pSite );
+
+    protected:
+        virtual void      _ReleaseSurface(CBaseRootSurface* pSurface);
+        virtual void      _DrawBlack(void* pWindow);
+        virtual HX_RESULT _BltToPrimary(HXxRect& rDestRect, HXxRect& rSrcRect);
+        virtual void      _CreateBuffer();
+        virtual HX_RESULT _GetCaps(UINT32 *pfSurfaceCaps);
+        virtual HX_RESULT _CreateOverlay(HXBOOL bOverlay, int cid, int x, int y);
+        virtual HX_RESULT _LockInternalSurface(UCHAR** ppSurfPtr,
+                LONG32* pnSurfPitch,
+                HXxSize& notused);
+        virtual HX_RESULT _UnlockInternalSurface(UCHAR* pSurfPtr);
+        virtual void      _SetupDCObjects(HXxDC hxxDC,
+                void** phOldBrush, void** phOldPen);
+        virtual void      _FillRectangle(HXxDC hxxDC,
+                UINT32 left, UINT32 top,
+                UINT32 right, UINT32 bottom);
+        virtual void      _RestoreDCObjects(HXxDC hxxDC,
+                void* hOldBrush, void* hOldPen);
+        virtual void      _GetCompositionSurfaceHXxDC(HXxDC *hdc);
+        virtual void      _ReleaseCompositionSurfaceHXxDC(HXxDC hdc);
+        virtual INT32     _InsureColorMatch(INT32 InColor);
+        virtual void      _SetColorKey(INT32 nColorSpaceLowValue,
+                INT32 nColorSpaceHighValue);
+        virtual void      _UpdateOverlay(HXxRect* src, HXxRect* dest, INT32 inFlags);
+        virtual HXBOOL      _IsSurfaceVisible();
+        virtual void      _ReleaseSurface();
+        virtual HXxDC     _GetDC(HXxWindow*);
+        virtual void      _ReleaseDC(HXxWindow*, HXxDC);
+
+        //Converts window coordinates into device coordinates
+        //if needed. This is used on Windows at least because
+        //its overlays use screen coords instead of window coords.
+        //This is a noop on unix as its overlays are in window coords.
+        virtual void _GetWindowDeviceCords(HXxRect* rect );
+
+    private:
+        virtual ~CHXSurf();
+
+        //Protect unintentional copy and default ctors.
+        CHXSurf();
+        CHXSurf( const CHXSurf& );
+        CHXSurf& operator=(const CHXSurf& it );
+};
+
+#endif // _CHX_SURF_H_
exadvsnk.cpp.diff (application/octet-stream, 16.5 KB)
--- simpleplayer/exadvsnk.cpp	2006-08-21 20:15:38.000000000 +0800
+++ mediasinklib/CHXClientAdviceSink.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,6 +33,8 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
@@ -45,56 +50,20 @@
 #include "hxclsnk.h"
 #include "hxgroup.h"
 #include "hxstrutl.h"
-#include "exadvsnk.h"
-
 #include "hxstring.h"
+#include "hxprefs.h"
 
+#include "CHXClientAdviceSink.h"
+#include "CHXClientContext.h"
 #include "print.h"
-
 #include "globals.h"
+#include "player.h"
 
-struct _stGlobals*& GetGlobal(); //in main.cpp
-
-#ifdef __TCS__
-extern unsigned long   gStreamTime;
- 
-static int		iOpened = 0;
-
-
-#if	defined(__cplusplus)
-extern	"C"	{
-#endif	/* defined(__cplusplus) */
-
-typedef enum hookBuffering {
-	eContacting = 0,
-	eConnecting = 1,
-	eBuffering = 2,
-	ePlaying = 3
-}hookBuffering;
-
-void hookRealAudio_Buffering(hookBuffering connectState, int pct);
-
-void hookRealAudio_PlayPosition(unsigned long current,unsigned long duration);
-
-typedef enum hookState {
-	ePlay = 0,
-	ePause = 1,
-	eStop = 2,
-	eResume = 3,
-	eComplete				// Clip is done playing
-}hookState;
-void hookRealAudio_State(hookState newState);
-
-
-#if	defined(__cplusplus)
-}
-#endif	/* defined(__cplusplus) */
-
-#endif // __TCS__
+struct _stGlobals*& GetGlobal();
 
 void PrintBuffer(const char* pszName,const unsigned char* pbBuf, unsigned int dwBytes);
 
-ExampleClientAdviceSink::ExampleClientAdviceSink(IUnknown* pUnknown, LONG32 lClientIndex)
+CHXClientAdviceSink::CHXClientAdviceSink(IUnknown* pUnknown, LONG32 lClientIndex, on_buffering_cb_t on_buffering_cb, on_pos_length_cb_t on_pos_length_cb, void *context)
     : m_lRefCount (0)
     , m_lClientIndex (lClientIndex)
     , m_pUnknown (NULL)
@@ -103,8 +72,11 @@
     , m_lCurrentBandwidth(0)
     , m_lAverageBandwidth(0)
     , m_bOnStop(0)
-	, m_pPlayer(0)
     , m_bWaitForTrackStart(0)
+    , m_on_buffering_cb(on_buffering_cb)
+    , m_on_pos_length_cb(on_pos_length_cb)
+    , m_context(context)
+    , m_pPlayer(0)
 {
     if (pUnknown)
     {
@@ -140,13 +112,9 @@
 	}
     }
 
-#ifdef __TCS__
-    bEnableAdviceSink = TRUE;
-    iOpened = 0;
-#endif 
 }
 
-ExampleClientAdviceSink::~ExampleClientAdviceSink(void)
+CHXClientAdviceSink::~CHXClientAdviceSink(void)
 {
     if (m_pScheduler)
     {
@@ -182,7 +150,7 @@
 //	Implement this to export the interfaces supported by your 
 //	object.
 //
-STDMETHODIMP ExampleClientAdviceSink::QueryInterface(REFIID riid, void** ppvObj)
+STDMETHODIMP CHXClientAdviceSink::QueryInterface(REFIID riid, void** ppvObj)
 {
     if (IsEqualIID(riid, IID_IUnknown))
     {
@@ -214,7 +182,7 @@
 //	Everyone usually implements this the same... feel free to use
 //	this implementation.
 //
-STDMETHODIMP_(ULONG32) ExampleClientAdviceSink::AddRef()
+STDMETHODIMP_(ULONG32) CHXClientAdviceSink::AddRef()
 {
     return InterlockedIncrement(&m_lRefCount);
 }
@@ -226,7 +194,7 @@
 //	Everyone usually implements this the same... feel free to use
 //	this implementation.
 //
-STDMETHODIMP_(ULONG32) ExampleClientAdviceSink::Release()
+STDMETHODIMP_(ULONG32) CHXClientAdviceSink::Release()
 {
     if (InterlockedDecrement(&m_lRefCount) > 0)
     {
@@ -249,38 +217,17 @@
  *	    current playback context has changed.
  */
 
-#ifdef __TCS__
-static long	lastPosition = -1;
-#endif
 
 STDMETHODIMP
-ExampleClientAdviceSink::OnPosLength(UINT32	  ulPosition,
+CHXClientAdviceSink::OnPosLength(UINT32	  ulPosition,
 				   UINT32	  ulLength)
 {
-#ifdef __TCS__
-    gStreamTime = ulPosition;
-    if (iOpened == 1)
-    {
-	if (lastPosition < 0)
-	{
-	    hookRealAudio_PlayPosition(ulPosition, ulLength);
-	    lastPosition = 0;
-	}
-	else
-	{
-	    if ((ulPosition/1000) != lastPosition)
-	    {
-		hookRealAudio_PlayPosition(ulPosition, ulLength);
-		lastPosition = ulPosition/1000;
-	    }
-	}
-    }
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
-        STDOUT("OnPosLength(%lu,%lu)\n", ulPosition, ulLength);
+        STDOUT("OnPosLength(%ld, %ld)\n", ulPosition, ulLength);
     }
-#endif /* __TCS__ */
+#endif
 
     // Are we doing a multi-seek?
     if (GetGlobal()->g_bMultiSeek)
@@ -288,8 +235,6 @@
         // Have we run out of seek times?
         if (GetGlobal()->g_ulMultiSeekIndex < GetGlobal()->g_ulNumMultiSeeks)
         {
-            STDOUT("Multi-seeking the first player to %lu\n",
-                   GetGlobal()->g_ulMultiSeekTime[GetGlobal()->g_ulMultiSeekIndex]);
             GetGlobal()->g_Players[0]->Seek(GetGlobal()->g_ulMultiSeekTime[GetGlobal()->g_ulMultiSeekIndex++]);
         }
         else
@@ -301,6 +246,9 @@
         }
     }
 
+    if (m_on_pos_length_cb)
+        m_on_pos_length_cb(ulPosition, ulLength, m_context);
+
     return HXR_OK;
 }
 
@@ -310,16 +258,14 @@
  *	Purpose:
  *	    Called to advise the client a presentation has been opened.
  */
-STDMETHODIMP ExampleClientAdviceSink::OnPresentationOpened()
+STDMETHODIMP CHXClientAdviceSink::OnPresentationOpened()
 {
-#ifdef __TCS__
-    iOpened = 1;
-    lastPosition = -1;
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnPresentationOpened()\n");
     }
+#endif
 #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
     // Try to get the IHXPlaybackVelocity interface
     // from the first player
@@ -333,25 +279,18 @@
             rv = pVel->QueryVelocityCaps(GetGlobal()->g_pVelocityCaps);
             if (SUCCEEDED(rv) && GetGlobal()->bEnableAdviceSink)
             {
-                STDOUT("Available Velocity Ranges:");
                 UINT32 ulNumRanges = GetGlobal()->g_pVelocityCaps->GetNumRanges();
                 for (UINT32 i = 0; i < ulNumRanges && SUCCEEDED(rv); i++)
                 {
                     INT32 lMin = 0;
                     INT32 lMax = 0;
                     rv = GetGlobal()->g_pVelocityCaps->GetRange(i, lMin, lMax);
-                    if (SUCCEEDED(rv))
-                    {
-                        STDOUT(" [%ld,%ld]", lMin, lMax);
                     }
                 }
-                STDOUT("\n");
-            }
         }
         HX_RELEASE(pVel);
     }
 #endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
-#endif
 
     UINT32 sourceCount = m_pPlayer->GetSourceCount();	
     for (UINT32 sourceID = 0; sourceID < sourceCount; sourceID ++)
@@ -416,7 +355,9 @@
 
     if (!m_bWaitForTrackStart)
     {
+#ifdef _DEBUG
 	STDOUT("----------------clip info--------------------\n");
+#endif
 	if(m_pScheduler)	{
 		m_hCallback = m_pScheduler->RelativeEnter(this,50);
 	}
@@ -431,12 +372,9 @@
  *	Purpose:
  *	    Called to advise the client a presentation has been closed.
  */
-STDMETHODIMP ExampleClientAdviceSink::OnPresentationClosed()
+STDMETHODIMP CHXClientAdviceSink::OnPresentationClosed()
 {
-#ifdef __TCS__
-    iOpened = 0;
-    lastPosition = -1;
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnPresentationClosed()\n");
@@ -446,7 +384,7 @@
     return HXR_OK;
 }
 
-void ExampleClientAdviceSink::GetStatistics (char* pszRegistryKey)
+void CHXClientAdviceSink::GetStatistics (char* pszRegistryKey)
 {
     char    szRegistryValue[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */
     INT32   lValue = 0;
@@ -454,9 +392,6 @@
     INT32   lStatistics = 8;
     UINT32 *plValue;
     
-#ifdef __TCS__    
-    return;	  // DISABLED FOR NOW
-#endif
 
     // collect statistic
     for (i = 0; i < lStatistics; i++)
@@ -506,25 +441,18 @@
 		*plValue = lValue;
 	    }
 	}
-	if (GetGlobal()->bEnableAdviceSink || (GetGlobal()->bEnableVerboseMode && m_bOnStop))
-	{
-	    STDOUT("%s = %ld\n", szRegistryValue, lValue);
-	}
     }
 }
 
-void ExampleClientAdviceSink::GetAllStatistics(void)
+void CHXClientAdviceSink::GetAllStatistics(void)
 {
     UINT32  unPlayerIndex = 0;
     UINT32  unSourceIndex = 0;
     UINT32  unStreamIndex = 0;
 
-    char*   pszRegistryPrefix = "Statistics";
+    char   pszRegistryPrefix[] = "Statistics";
     char    szRegistryName[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */
 
-#ifdef __TCS__    
-    return;	  // DISABLED FOR NOW
-#endif
     
     // display the content of whole statistic registry
     if (m_pRegistry)
@@ -574,16 +502,12 @@
  *	    Called to advise the client that the presentation statistics
  *	    have changed. 
  */
-STDMETHODIMP ExampleClientAdviceSink::OnStatisticsChanged(void)
+STDMETHODIMP CHXClientAdviceSink::OnStatisticsChanged(void)
 {
     char        szBuff[1024]; /* Flawfinder: ignore */
     HX_RESULT   res     = HXR_OK;
-    UINT16      uPlayer = 0;
-
-#ifdef __TCS__    
-    return HXR_OK;	  // DISABLED FOR NOW
-#endif
 
+#ifdef _DEBUG
     if(GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnStatisticsChanged():\n");
@@ -591,11 +515,13 @@
         SafeSprintf(szBuff, 1024, "Statistics");        
         res = DumpRegTree( szBuff );
     }
+#endif
 
     return HXR_OK;
 }
 
-HX_RESULT ExampleClientAdviceSink::DumpRegTree(const char* pszTreeName )
+#ifdef _DEBUG
+HX_RESULT CHXClientAdviceSink::DumpRegTree(const char* pszTreeName )
 {
     const char* pszName = NULL;
     ULONG32     ulRegID   = 0;
@@ -661,6 +587,7 @@
     
     return HXR_OK;
 }
+#endif
 
 
 /************************************************************************
@@ -673,10 +600,10 @@
  *	    time for the stream's time line after the seek will be completed.
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnPreSeek(	ULONG32	ulOldTime,
+STDMETHODIMP CHXClientAdviceSink::OnPreSeek(	ULONG32	ulOldTime,
 						ULONG32	ulNewTime)
 {
-#if !defined(__TCS__)
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnPreSeek(%ld, %ld)\n", ulOldTime, ulNewTime);
@@ -697,12 +624,10 @@
  *	    time for the stream's time line after the seek.
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnPostSeek(	ULONG32	ulOldTime,
+STDMETHODIMP CHXClientAdviceSink::OnPostSeek(	ULONG32	ulOldTime,
 						ULONG32	ulNewTime)
 {
-#ifdef __TCS__
-    lastPosition = -1;
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnPostSeek(%ld, %ld)\n", ulOldTime, ulNewTime);
@@ -721,25 +646,21 @@
  *	    just occured. 
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnStop(void)
+STDMETHODIMP CHXClientAdviceSink::OnStop(void)
 {
     HXTimeval now;
-
-#ifdef __TCS__
-    hookRealAudio_State(eStop);
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnStop()\n");
     }
+#endif
 
     if (GetGlobal()->bEnableVerboseMode)
     {
-        STDOUT("Player %ld stopped.\n", m_lClientIndex);
         m_bOnStop = TRUE;
 	GetAllStatistics();
     }
-#endif
 
     // Find out the current time and subtract the beginning time to
     // figure out how many seconds we played
@@ -760,11 +681,9 @@
  *	    stream's time line before the pause.
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnPause(ULONG32 ulTime)
+STDMETHODIMP CHXClientAdviceSink::OnPause(ULONG32 ulTime)
 {
-#ifdef __TCS__
-    hookRealAudio_State(ePause);
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnPause(%ld)\n", ulTime);
@@ -784,20 +703,15 @@
  *	    for the stream's time line after the resume.
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnBegin(ULONG32 ulTime)
+STDMETHODIMP CHXClientAdviceSink::OnBegin(ULONG32 ulTime)
 {
     HXTimeval now;
 
-#if !defined(__TCS__)
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnBegin(%ld)\n", ulTime);
     }
-
-    if (GetGlobal()->bEnableVerboseMode)
-    {
-        STDOUT("Player %ld beginning playback...\n", m_lClientIndex);
-    }
 #endif
 
     GetGlobal()->g_bOnBeginOccurred = TRUE;
@@ -821,32 +735,17 @@
  *	    buffering process.
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnBuffering(ULONG32	ulFlags,
+STDMETHODIMP CHXClientAdviceSink::OnBuffering(ULONG32	ulFlags,
 						UINT16	unPercentComplete)
 {
-#ifdef __TCS__
-static UINT16	lastPct = 0;
-    if (unPercentComplete > 0)
-    {
-	UINT16	nextPct = lastPct + 10;
-	if (unPercentComplete < lastPct)
-	{
-	    lastPct = 0;
-	    nextPct = lastPct + 10;
-	}
-	if (unPercentComplete >= nextPct)
-	{
-	    lastPct = (unPercentComplete / 10) * 10;
-	    nextPct = lastPct + 10;
-	    hookRealAudio_Buffering(eBuffering,lastPct);
-	}
-    }
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnBuffering(%ld, %d)\n", ulFlags, unPercentComplete);
     }
 #endif
+    if (m_on_buffering_cb)
+        m_on_buffering_cb(ulFlags, unPercentComplete, m_context);
 
     return HXR_OK;
 }
@@ -860,12 +759,9 @@
  *	    hosts(s).
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::OnContacting(const char* pHostName)
+STDMETHODIMP CHXClientAdviceSink::OnContacting(const char* pHostName)
 {
-#ifdef __TCS__
-    printf("Contacting\n");
-    hookRealAudio_Buffering(eContacting,0);
-#else
+#ifdef _DEBUG
     if (GetGlobal()->bEnableAdviceSink)
     {
         STDOUT("OnContacting(\"%s\")\n", pHostName);
@@ -875,7 +771,8 @@
     return HXR_OK;
 }
 
-void ExampleClientAdviceSink::PrintPropName( IHXValues* pHeader )
+#ifdef _DEBUG
+void CHXClientAdviceSink::PrintPropName( IHXValues* pHeader )
 {
     if ( pHeader == NULL )
     {
@@ -916,11 +813,12 @@
     
     fflush(stdout);
 }
+#endif
 
 
-void ExampleClientAdviceSink::SetClipInfo( IHXPlayer* m_pRMAPlayer)
+void CHXClientAdviceSink::SetClipInfo( IHXPlayer* m_pRMAPlayer)
 {
-    bool bSendOnClipInfo = false;
+#ifdef _DEBUG
 
     // Get HXSource and try to get clip infor. 
     UINT32 sourceCount = m_pRMAPlayer->GetSourceCount();	
@@ -986,10 +884,11 @@
 
         HX_RELEASE(pStreamSrc);
     }
+#endif
 }
 
 
-STDMETHODIMP ExampleClientAdviceSink::Func()
+STDMETHODIMP CHXClientAdviceSink::Func()
 {
     m_hCallback = 0;
 
@@ -1024,7 +923,7 @@
  *  Purpose:
  *		Notification of a new group being added to the presentation.
  */
-STDMETHODIMP ExampleClientAdviceSink::GroupAdded( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::GroupAdded( UINT16 /*IN*/ uGroupIndex,
 			    IHXGroup* /*IN*/ pGroup)
 {
     return HXR_OK;
@@ -1036,7 +935,7 @@
  *  Purpose:
  *		Notification of a group being removed from the presentation.
  */
-STDMETHODIMP ExampleClientAdviceSink::GroupRemoved( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::GroupRemoved( UINT16 /*IN*/ uGroupIndex,
 				IHXGroup*  /*IN*/ pGroup)
 {
     return HXR_OK;
@@ -1049,7 +948,7 @@
  *		Notification that all groups have been removed from the 
  *		current presentation.
  */
-STDMETHODIMP ExampleClientAdviceSink::AllGroupsRemoved()
+STDMETHODIMP CHXClientAdviceSink::AllGroupsRemoved()
 {
     return HXR_OK;
 }
@@ -1060,7 +959,7 @@
  *  Purpose:
  *		Notification of a new track being added to a group.
  */
-STDMETHODIMP ExampleClientAdviceSink::TrackAdded( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::TrackAdded( UINT16 /*IN*/ uGroupIndex,
 			    UINT16     /*IN*/ uTrackIndex,
 			    IHXValues* /*IN*/ pTrack)
 {
@@ -1073,7 +972,7 @@
  *  Purpose:
  *		Notification of a track being removed from a group.
  */
-STDMETHODIMP ExampleClientAdviceSink::TrackRemoved( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::TrackRemoved( UINT16 /*IN*/ uGroupIndex,
 				UINT16     /*IN*/ uTrackIndex,
 				IHXValues* /*IN*/ pTrack)
 {
@@ -1087,13 +986,12 @@
  *		Notification of a track being started (to get duration, for
  *		instance...)
  */
-STDMETHODIMP ExampleClientAdviceSink::TrackStarted( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::TrackStarted( UINT16 /*IN*/ uGroupIndex,
 				UINT16     /*IN*/ uTrackIndex,
 				IHXValues* /*IN*/ pTrack)
 {
     if ( m_bWaitForTrackStart )
     {
-        STDOUT("----------------clip info--------------------\n");
         if(m_pScheduler)
         {
             m_hCallback = m_pScheduler->RelativeEnter(this,50);
@@ -1110,7 +1008,7 @@
  *		Notification of a track being stopped
  *
  */
-STDMETHODIMP ExampleClientAdviceSink::TrackStopped( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::TrackStopped( UINT16 /*IN*/ uGroupIndex,
 				UINT16     /*IN*/ uTrackIndex,
 				IHXValues* /*IN*/ pTrack)
 {
@@ -1123,7 +1021,7 @@
  *  Purpose:
  *		This group is being currently played in the presentation.
  */
-STDMETHODIMP ExampleClientAdviceSink::CurrentGroupSet( UINT16 /*IN*/ uGroupIndex,
+STDMETHODIMP CHXClientAdviceSink::CurrentGroupSet( UINT16 /*IN*/ uGroupIndex,
 				IHXGroup* /*IN*/ pGroup)
 {
     return HXR_OK;
exadvsnk.h.diff (application/octet-stream, 2 KB)
--- simpleplayer/exadvsnk.h	2006-08-21 20:15:38.000000000 +0800
+++ mediasinklib/CHXClientAdviceSink.h	2009-04-16 13:37:29.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,11 +33,15 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-#ifndef _EXAMPLECLSNK_
-#define _EXAMPLECLSNK_
+#ifndef _CHX_CLIENT_ADVICE_SINK_
+#define _CHX_CLIENT_ADVICE_SINK_
+
+#include "player.h"
 
 struct IHXClientAdviseSink;
 struct IHXGroupSink;
@@ -45,7 +52,7 @@
 struct IHXPlayer;
 struct IHXGroup;
 
-class ExampleClientAdviceSink : public IHXClientAdviseSink,
+class CHXClientAdviceSink : public IHXClientAdviseSink,
                                 public IHXGroupSink,
                                 public IHXCallback
 {
@@ -66,11 +73,14 @@
   
     HXBOOL      m_bWaitForTrackStart;
     
+    on_buffering_cb_t  m_on_buffering_cb;
+    on_pos_length_cb_t m_on_pos_length_cb; 
+    void              *m_context;
     
     // IHXCallback
 	IHXPlayer*		m_pPlayer;
     ULONG32         m_hCallback;
-    ~ExampleClientAdviceSink();
+    ~CHXClientAdviceSink();
     HX_RESULT DumpRegTree(const char* pszTreeName );
 
 
@@ -81,7 +91,11 @@
 
   public:
 
-    ExampleClientAdviceSink(IUnknown* /*IN*/ pUnknown, LONG32 /*IN*/ lClientIndex);
+    CHXClientAdviceSink(IUnknown* /*IN*/ pUnknown, 
+			   LONG32 /*IN*/ lClientIndex, 
+			   on_buffering_cb_t on_buffer_cb, 
+			   on_pos_length_cb_t on_pos_length_cb, 
+			   void *context);
 
     /*
      *  IUnknown methods
@@ -316,4 +330,4 @@
 
 };
 
-#endif /* _EXAMPLECLSNK_ */
+#endif // _CHX_CLIENT_ADVICE_SINK_
exaumgr.cpp.diff (application/octet-stream, 2.2 KB)
--- simpleplayer/exaumgr.cpp	2003-10-03 02:50:23.000000000 +0800
+++ mediasinklib/CHXAuthenticationManager.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,36 +33,36 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
 #include <stdio.h>
+#include <ctype.h>
 #include "hxtypes.h"
 #include "hxcom.h"
 #include "hxauth.h"
 #include "hxstrutl.h"
-#include "exaumgr.h"
-#include <ctype.h>
 #include "print.h"
 
+#include "CHXAuthenticationManager.h"
 
 #include "globals.h"
-struct _stGlobals*& GetGlobal(); //in main.cpp
-
-
+struct _stGlobals*& GetGlobal();
 
-ExampleAuthenticationManager::ExampleAuthenticationManager() :
+CHXAuthenticationManager::CHXAuthenticationManager() :
     m_lRefCount(0),
     m_bSentPassword(FALSE)
 {
 }
 
-ExampleAuthenticationManager::~ExampleAuthenticationManager()
+CHXAuthenticationManager::~CHXAuthenticationManager()
 {
 }
 
 STDMETHODIMP
-ExampleAuthenticationManager::QueryInterface(REFIID riid, void**ppvObj)
+CHXAuthenticationManager::QueryInterface(REFIID riid, void**ppvObj)
 {
     if(IsEqualIID(riid, IID_IUnknown))
     {
@@ -78,13 +81,13 @@
 }
 
 STDMETHODIMP_(UINT32)
-ExampleAuthenticationManager::AddRef()
+CHXAuthenticationManager::AddRef()
 {
     return InterlockedIncrement(&m_lRefCount);
 }
 
 STDMETHODIMP_(UINT32)
-ExampleAuthenticationManager::Release()
+CHXAuthenticationManager::Release()
 {
     if (InterlockedDecrement(&m_lRefCount) > 0)
     {
@@ -96,7 +99,7 @@
 }
 
 STDMETHODIMP
-ExampleAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse)
+CHXAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse)
 {
     char      username[1024] = ""; /* Flawfinder: ignore */
     char      password[1024] = ""; /* Flawfinder: ignore */
exaumgr.h.diff (application/octet-stream, 1.5 KB)
--- simpleplayer/exaumgr.h	2005-05-26 01:50:01.000000000 +0800
+++ mediasinklib/CHXAuthenticationManager.h	2009-04-16 13:37:29.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,27 +33,30 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-#ifndef _EXAUMGR_H_
-#define _EXAUMGR_H_
+#ifndef _CHX_AUTHENTICATION_MANAGER_H_
+#define _CHX_AUTHENTICATION_MANAGER_H_
 
 #include "hxauth.h"
 
-class ExampleAuthenticationManager : public IHXAuthenticationManager
+class CHXAuthenticationManager : public IHXAuthenticationManager
 {
 private:
     INT32 m_lRefCount;
     HXBOOL  m_bSentPassword;
-    ~ExampleAuthenticationManager();
+    ~CHXAuthenticationManager();
 
 public:
-    ExampleAuthenticationManager();
+    CHXAuthenticationManager();
     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
     STDMETHOD_(UINT32,AddRef) (THIS);
     STDMETHOD_(UINT32,Release) (THIS);
 
     STDMETHOD(HandleAuthenticationRequest) (IHXAuthenticationManagerResponse* pResponse);
 };
-#endif
+
+#endif // _CHX_AUTHENTICATION_MANAGER_H_
excontext.cpp.diff (application/octet-stream, 6.4 KB)
--- simpleplayer/excontxt.cpp	2006-08-21 20:15:38.000000000 +0800
+++ mediasinklib/CHXClientContext.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,6 +33,8 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
@@ -39,7 +44,6 @@
 #include "hxcom.h"
 #include "hxcomm.h"
 #include "hxwin.h"
-#include "fivemmap.h"
 
 #include "hxbuffer.h"
 #include "hxmangle.h"
@@ -50,61 +54,61 @@
 #include "hxprefs.h"
 #include "hxstrutl.h"
 
-#include "exadvsnk.h"
-#include "exerror.h"
-#include "exsitsup.h"
-#include "exaumgr.h"
-#include "hxprdnld.h"
-#include "exprdnld.h"
-
-#include "excontxt.h"
+#include "CHXClientAdviceSink.h"
+#include "CHXClientStateAdviceSink.h"
+#include "CHXErrorSink.h"
+#include "CHXSiteSupplier.h"
+#include "CHXAuthenticationManager.h"
+#include "CHXPDStatusObserver.h"
+#include "CHXClientContext.h"
 
 extern HXBOOL bEnableAdviceSink;
 
-
-ExampleClientContext::ExampleClientContext(LONG32 lClientIndex)
+CHXClientContext::CHXClientContext(LONG32 lClientIndex)
     : m_lRefCount(0)
     , m_lClientIndex(lClientIndex)
     , m_pClientSink(NULL)
+    , m_pClientStateSink(NULL)
     , m_pErrorSink(NULL)
     , m_pAuthMgr(NULL)
     , m_pSiteSupplier(NULL)
     , m_pDefaultPrefs(NULL)
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     , m_pPrgDnldStatusObserver(NULL)
-#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+#endif
 {
 }
 
-
-ExampleClientContext::~ExampleClientContext()
+CHXClientContext::~CHXClientContext()
 {
     Close();
 };
 
-void ExampleClientContext::Init(IUnknown*	 /*IN*/ pUnknown,
+void CHXClientContext::Init(IUnknown*	 /*IN*/ pUnknown,
 				IHXPreferences* /*IN*/ pPreferences,
-				char*		 /*IN*/ pszGUID)
+        char*		 /*IN*/ pszGUID,
+        PlayerCallbacks* /*IN*/ pCallbacks,
+        void *context)
 {
     char* pszCipher = NULL;
 
+    m_pClientSink	= new CHXClientAdviceSink(pUnknown, m_lClientIndex, pCallbacks->on_buffering_cb, pCallbacks->on_pos_length_cb, context);
 	
-    m_pClientSink	= new ExampleClientAdviceSink(pUnknown, m_lClientIndex);
-    m_pErrorSink	= new ExampleErrorSink(pUnknown);
+    m_pClientStateSink	= new CHXClientStateAdviceSink(pUnknown, m_lClientIndex, pCallbacks->on_state_change_cb, context);
+    m_pErrorSink	= new CHXErrorSink(pUnknown, pCallbacks->on_error_cb, context);
 #if defined(HELIX_FEATURE_AUTHENTICATION)
-    m_pAuthMgr          = new ExampleAuthenticationManager();
+    m_pAuthMgr          = new CHXAuthenticationManager();
     if(m_pAuthMgr)
     {
 	m_pAuthMgr->AddRef();
     }
-
 #endif /* #if defined(HELIX_FEATURE_AUTHENTICATION) */
 #if defined(HELIX_FEATURE_VIDEO)
-    m_pSiteSupplier	= new ExampleSiteSupplier(pUnknown);
+    m_pSiteSupplier	= new CHXSiteSupplier(pUnknown, pCallbacks->on_new_frame_cb, context);
 #endif 
 
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
-    m_pPrgDnldStatusObserver = new ExamplePDStatusObserver(pUnknown);
+    m_pPrgDnldStatusObserver = new CHXPDStatusObserver(pUnknown);
 #endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
 
     if (m_pClientSink)
@@ -117,6 +121,9 @@
 	m_pErrorSink->AddRef();
     }
 
+    if (m_pClientStateSink)
+        m_pClientStateSink->AddRef();
+
     if(m_pSiteSupplier)
     {
 	m_pSiteSupplier->AddRef();
@@ -140,22 +147,21 @@
     }
 }
 
-void ExampleClientContext::Close()
+void CHXClientContext::Close()
 {
     HX_RELEASE(m_pClientSink);
+    HX_RELEASE(m_pClientStateSink);
     HX_RELEASE(m_pErrorSink);
 #if defined(HELIX_FEATURE_AUTHENTICATION)
     HX_RELEASE(m_pAuthMgr);
-#endif /* #if defined(HELIX_FEATURE_AUTHENTICATION) */
+#endif
     HX_RELEASE(m_pSiteSupplier);
     HX_RELEASE(m_pDefaultPrefs);
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     HX_RELEASE(m_pPrgDnldStatusObserver);
-#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+#endif
 }
 
-
-
 // *** IUnknown methods ***
 
 /////////////////////////////////////////////////////////////////////////
@@ -165,7 +171,7 @@
 //	Implement this to export the interfaces supported by your 
 //	object.
 //
-STDMETHODIMP ExampleClientContext::QueryInterface(REFIID riid, void** ppvObj)
+STDMETHODIMP CHXClientContext::QueryInterface(REFIID riid, void** ppvObj)
 {
     if (IsEqualIID(riid, IID_IUnknown))
     {
@@ -189,13 +195,18 @@
     {
 	return HXR_OK;
     }
+    else if (m_pClientStateSink &&
+            m_pClientStateSink->QueryInterface(riid, ppvObj) == HXR_OK)
+    {
+        return HXR_OK;
+    }
 #if defined(HELIX_FEATURE_AUTHENTICATION)
     else if(m_pAuthMgr &&
 	    m_pAuthMgr->QueryInterface(riid, ppvObj) == HXR_OK)
     {
 	return HXR_OK;
     }
-#endif /* #if defined(HELIX_FEATURE_AUTHENTICATION) */
+#endif
     else if(m_pSiteSupplier &&
 	    m_pSiteSupplier->QueryInterface(riid, ppvObj) == HXR_OK)
     {
@@ -212,7 +223,7 @@
 //	Everyone usually implements this the same... feel free to use
 //	this implementation.
 //
-STDMETHODIMP_(ULONG32) ExampleClientContext::AddRef()
+STDMETHODIMP_(ULONG32) CHXClientContext::AddRef()
 {
     return InterlockedIncrement(&m_lRefCount);
 }
@@ -224,7 +235,7 @@
 //	Everyone usually implements this the same... feel free to use
 //	this implementation.
 //
-STDMETHODIMP_(ULONG32) ExampleClientContext::Release()
+STDMETHODIMP_(ULONG32) CHXClientContext::Release()
 {
     if (InterlockedDecrement(&m_lRefCount) > 0)
     {
@@ -245,10 +256,9 @@
 //	Read a Preference from the registry.
 //
 STDMETHODIMP
-ExampleClientContext::ReadPref(const char* pref_key, IHXBuffer*& buffer)
+CHXClientContext::ReadPref(const char* pref_key, IHXBuffer*& buffer)
 {
     HX_RESULT hResult	= HXR_OK;
-    char*     pszCipher = NULL;
     
     if ((stricmp(pref_key, CLIENT_GUID_REGNAME) == 0) &&
 	(*m_pszGUID))
@@ -279,7 +289,7 @@
 //	Write a Preference to the registry.
 //
 STDMETHODIMP
-ExampleClientContext::WritePref(const char* pref_key, IHXBuffer* buffer)
+CHXClientContext::WritePref(const char* pref_key, IHXBuffer* buffer)
 {
     if (m_pDefaultPrefs)
     {
@@ -291,4 +301,7 @@
     }
 }
 
-
+EHXClientState CHXClientContext::GetState()
+{
+    return m_pClientStateSink->GetState();
+};
excontext.h.diff (application/octet-stream, 3 KB)
--- simpleplayer/excontxt.h	2004-08-13 08:29:52.000000000 +0800
+++ mediasinklib/CHXClientContext.h	2009-04-16 13:37:29.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,41 +33,58 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
+#ifndef _CHX_CLIENT_CONTEXT_H_
+#define _CHX_CLIENT_CONTEXT_H_
+
+#include "CHXErrorSink.h"
+#include "CHXSiteSupplier.h"
+
+#include "hxprefs.h"
+#include "player.h"
+#include "hxclsnk.h"
+
 struct IUnknown;
 struct IHXPreferences;
-class ExampleClientAdviceSink;
-class ExampleErrorMessages;
-class ExampleAuthenticationManager;
-class ExamplePDStatusObserver;
+class CHXClientAdviceSink;
+class CHXClientStateAdviceSink;
+class CHXAuthenticationManager;
+class CHXPDStatusObserver;
 
-
-class ExampleClientContext : public IHXPreferences
+class CHXClientContext : public IHXPreferences
 {
 private:
     LONG32			    m_lRefCount;
     LONG32                          m_lClientIndex;
 
-    ExampleClientAdviceSink*	    m_pClientSink;
-    ExampleErrorSink*		    m_pErrorSink;
-    ExampleAuthenticationManager*   m_pAuthMgr;
-    ExampleSiteSupplier*	    m_pSiteSupplier;
-    ExamplePDStatusObserver*        m_pPrgDnldStatusObserver;
+        CHXClientAdviceSink      *m_pClientSink;
+        CHXClientStateAdviceSink *m_pClientStateSink;
+        CHXErrorSink*	     m_pErrorSink;
+        CHXAuthenticationManager *m_pAuthMgr;
+
+        CHXSiteSupplier          *m_pSiteSupplier;
     IHXPreferences*		    m_pDefaultPrefs;
+        CHXPDStatusObserver      *m_pPrgDnldStatusObserver;
     char			    m_pszGUID[256]; /* Flawfinder: ignore */
 
 public:
 
-    ExampleClientContext(LONG32 /*IN*/ lClientIndex);
-    ~ExampleClientContext();
+        CHXClientContext(LONG32 /*IN*/ lClientIndex);
+        ~CHXClientContext();
 
     void Init(IUnknown*	       /*IN*/ pUnknown,
 	      IHXPreferences* /*IN*/ pPreferences,
-	      char*	       /*IN*/ pszGUID);
+		  char*	           /*IN*/ pszGUID,
+		  PlayerCallbacks* /*IN*/ pCallbacks,
+		  void *context = NULL);
     void Close();
 
+        EHXClientState GetState(); 
+
     /*
      * IUnknown methods
      */
@@ -78,8 +98,8 @@
     /*
      * IHXPreferences methods
      */
-    STDMETHOD(ReadPref)		(THIS_ const char* pref_key, 
-				 IHXBuffer*& buffer);
-    STDMETHOD(WritePref)	(THIS_ const char* pref_key,
-				 IHXBuffer* buffer);
+        STDMETHOD(ReadPref)  (THIS_ const char* pref_key, IHXBuffer*& buffer);
+        STDMETHOD(WritePref) (THIS_ const char* pref_key, IHXBuffer* buffer);
 };
+
+#endif // _CHX_CLIENT_CONTEXT_H_
exerror.cpp.diff (application/octet-stream, 3.8 KB)
--- simpleplayer/exerror.cpp	2005-06-25 00:09:36.000000000 +0800
+++ mediasinklib/CHXErrorSink.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,6 +33,8 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
@@ -43,15 +48,11 @@
 #include "hxassert.h"
 #include "hxbuffer.h"
 
-#ifdef __TCS__
-#include "hxresult.h"
-#endif
-
 #if !defined(HELIX_CONFIG_MINIMIZE_SIZE)
 #include "HXErrorCodeStrings.h"
 #endif
 
-#include "exerror.h"
+#include "CHXErrorSink.h"
 
 #include <stdio.h>
 #include "print.h"
@@ -59,21 +60,14 @@
 #include "globals.h"
 struct _stGlobals*& GetGlobal(); //in main.cpp
 
-#ifdef __TCS__
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-void hookRealAudio_ReportError(int err, long errVal);
 
-#ifdef __cplusplus
-}
-#endif
-#endif
-
-ExampleErrorSink::ExampleErrorSink(IUnknown* pUnknown) 
+CHXErrorSink::CHXErrorSink(IUnknown* pUnknown, 
+			     on_error_cb_t on_error_cb,
+			     void *context) 
     : m_lRefCount(0),
-      m_pPlayer(NULL)
+      m_pPlayer(NULL),
+      m_pErrorCB(on_error_cb),
+      m_pContext(context)
 {
     IHXClientEngine* pEngine = NULL;
     pUnknown->QueryInterface(IID_IHXClientEngine, (void**)&pEngine );
@@ -88,7 +82,7 @@
     HX_ASSERT(m_pPlayer);
 }
 
-ExampleErrorSink::~ExampleErrorSink()
+CHXErrorSink::~CHXErrorSink()
 {
     HX_RELEASE(m_pPlayer);
 }
@@ -102,7 +96,7 @@
 //  Implement this to export the interfaces supported by your 
 //  object.
 //
-STDMETHODIMP ExampleErrorSink::QueryInterface(REFIID riid, void** ppvObj)
+STDMETHODIMP CHXErrorSink::QueryInterface(REFIID riid, void** ppvObj)
 {
     if (IsEqualIID(riid, IID_IUnknown))
     {
@@ -128,7 +122,7 @@
 //  Everyone usually implements this the same... feel free to use
 //  this implementation.
 //
-STDMETHODIMP_(ULONG32) ExampleErrorSink::AddRef()
+STDMETHODIMP_(ULONG32) CHXErrorSink::AddRef()
 {
     return InterlockedIncrement(&m_lRefCount);
 }
@@ -140,7 +134,7 @@
 //  Everyone usually implements this the same... feel free to use
 //  this implementation.
 //
-STDMETHODIMP_(ULONG32) ExampleErrorSink::Release()
+STDMETHODIMP_(ULONG32) CHXErrorSink::Release()
 {
     if (InterlockedDecrement(&m_lRefCount) > 0)
     {
@@ -156,7 +150,7 @@
  */
 
 STDMETHODIMP 
-ExampleErrorSink::ErrorOccurred(const UINT8 unSeverity,  
+CHXErrorSink::ErrorOccurred(const UINT8 unSeverity,  
                                 const ULONG32   ulHXCode,
                                 const ULONG32   ulUserCode,
                                 const char* pUserString,
@@ -165,14 +159,10 @@
 {
     char HXDefine[256]; /* Flawfinder: ignore */
 
-    // Store the code, so we can return it from main()
     GetGlobal()->g_Error = ulHXCode;
 
     ConvertErrorToString(ulHXCode, HXDefine, 256);
 
-#ifdef __TCS__
-    hookRealAudio_ReportError(ulHXCode,ulUserCode);
-#else
     STDOUT("Report(%d, %ld, \"%s\", %ld, \"%s\", \"%s\")\n",
            unSeverity,
            ulHXCode,
@@ -180,13 +170,13 @@
            ulUserCode,
            (pMoreInfoURL && *pMoreInfoURL) ? pMoreInfoURL : "(NULL)",
            HXDefine);
-#endif
+    m_pErrorCB(ulHXCode, HXDefine, m_pContext);
 
     return HXR_OK;
 }
 
 void
-ExampleErrorSink::ConvertErrorToString(const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen)
+CHXErrorSink::ConvertErrorToString(const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen)
 {
     IHXErrorMessages* pErrMsg = NULL;
exerror.h.diff (application/octet-stream, 1.5 KB)
--- simpleplayer/exerror.h	2003-03-04 09:42:52.000000000 +0800
+++ mediasinklib/CHXErrorSink.h	2009-04-16 13:37:29.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,22 +33,27 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-#ifndef _EXAMPLEERRORMESSAGES_
-#define _EXAMPLEERRORMESSAGES_
+#ifndef _CHX_ERROR_SINK_
+#define _CHX_ERROR_SINK_
+
+#include "player.h"
+#include "hxerror.h"
 
 struct IUnknown;
 struct IHXErrorMessages;
 struct IHXPlayer;
 
-class ExampleErrorSink : public IHXErrorSink
+class CHXErrorSink : public IHXErrorSink
 {
 public:
 
-    ExampleErrorSink(IUnknown* pUnknown);
-    ~ExampleErrorSink();
+    CHXErrorSink(IUnknown* pUnknown, on_error_cb_t on_error_cb, void *context = NULL);
+    ~CHXErrorSink();
 
     /*
      *  IUnknown methods
@@ -84,7 +92,9 @@
 protected:
     LONG32 m_lRefCount;
     IHXPlayer* m_pPlayer;
+    on_error_cb_t m_pErrorCB;
+    void *m_pContext;
 
     void   ConvertErrorToString (const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen);
 };
-#endif /*_EXAMPLEERRORMESSAGES_*/
+#endif // _CHX_ERROR_SINK_
exprdnld.cpp.diff (application/octet-stream, 4.1 KB)
--- simpleplayer/exprdnld.cpp	2005-05-26 01:50:01.000000000 +0800
+++ mediasinklib/CHXPDStatusObserver.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -1,7 +1,10 @@
 /* ***** BEGIN LICENSE BLOCK ***** 
  * Version: RCSL 1.0/RPSL 1.0 
  *  
- * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. 
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
  *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
@@ -30,6 +33,8 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
@@ -37,7 +42,8 @@
 #include "hxtypes.h"
 #include "hxcore.h"
 #include "hxprdnld.h"
-#include "exprdnld.h"
+
+#include "CHXPDStatusObserver.h"
 #include "print.h"
 
 #include "globals.h"
@@ -45,12 +51,11 @@
 
 UINT32 GetTime(); // /In main.cpp.
 
-// /#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
 /************************************************************************
  *  Method:
  *    Constructor
  */
-ExamplePDStatusObserver::ExamplePDStatusObserver(IUnknown* pUnkPlayer)
+CHXPDStatusObserver::CHXPDStatusObserver(IUnknown* pUnkPlayer)
     : m_lRefCount(0)
     , m_pPrgDnldStatusMgr(NULL)
     , m_pUnkPlayer(pUnkPlayer)
@@ -91,7 +96,7 @@
  *  Method:
  *    Destructor
  */
-ExamplePDStatusObserver::~ExamplePDStatusObserver()
+CHXPDStatusObserver::~CHXPDStatusObserver()
 {
     if (m_pPrgDnldStatusMgr)
     {
@@ -107,7 +112,7 @@
  *    IUnknown::QueryInterface
  */
 STDMETHODIMP 
-ExamplePDStatusObserver::QueryInterface(REFIID riid, void** ppvObj)
+CHXPDStatusObserver::QueryInterface(REFIID riid, void** ppvObj)
 {
     if (IsEqualIID(riid, IID_IUnknown))
     {
@@ -131,7 +136,7 @@
  *    IUnknown::AddRef
  */
 STDMETHODIMP_(ULONG32) 
-ExamplePDStatusObserver::AddRef()
+CHXPDStatusObserver::AddRef()
 {
     return InterlockedIncrement(&m_lRefCount);
 }
@@ -141,7 +146,7 @@
  *    IUnknown::Release
  */
 STDMETHODIMP_(ULONG32) 
-ExamplePDStatusObserver::Release()
+CHXPDStatusObserver::Release()
 {
     if (InterlockedDecrement(&m_lRefCount) > 0)
     {
@@ -182,7 +187,7 @@
  *      convert the bytes to a duration for the IHXPDStatusMgr calling this:
  */
 STDMETHODIMP
-ExamplePDStatusObserver::OnDownloadProgress(
+CHXPDStatusObserver::OnDownloadProgress(
               IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource,
               UINT32 /*IN*/ ulNewDurSoFar,
               UINT32 /*IN*/ ulNewBytesSoFar,
@@ -343,7 +348,7 @@
  *      object.
  */
 STDMETHODIMP
-ExamplePDStatusObserver::OnTotalDurChanged(
+CHXPDStatusObserver::OnTotalDurChanged(
             IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource,
             UINT32 ulNewTotalDur)
 {
@@ -370,7 +375,7 @@
  *      
  */
 STDMETHODIMP
-ExamplePDStatusObserver::OnDownloadComplete(
+CHXPDStatusObserver::OnDownloadComplete(
             IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource)
 {
     m_bDownloadIsComplete = TRUE;
@@ -411,7 +416,7 @@
  *      server claims this when it doesn't actually support it).
  */
 STDMETHODIMP
-ExamplePDStatusObserver::SrcClaimsSeekSupport(IHXStreamSource* pStreamSource,
+CHXPDStatusObserver::SrcClaimsSeekSupport(IHXStreamSource* pStreamSource,
                                               HXBOOL bClaimsSupport)
 {
     if (GetGlobal()->bEnableVerboseMode)
@@ -434,7 +439,7 @@
  *      object.
  */
 STDMETHODIMP
-ExamplePDStatusObserver::OnDownloadPause(
+CHXPDStatusObserver::OnDownloadPause(
             IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource)
 {
     if (GetGlobal()->bEnableVerboseMode)
@@ -456,7 +461,7 @@
  *      object.
  */
 STDMETHODIMP
-ExamplePDStatusObserver::OnDownloadResume(
+CHXPDStatusObserver::OnDownloadResume(
             IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource)
 {
     if (GetGlobal()->bEnableVerboseMode)
@@ -465,4 +470,3 @@
     }
     return HXR_OK;
 }
-// /#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
exprdnld.h.diff (application/octet-stream, 2 KB)
--- simpleplayer/exprdnld.h	2005-05-26 01:50:01.000000000 +0800
+++ mediasinklib/CHXPDStatusObserver.h	2009-04-16 13:37:29.000000000 +0800
@@ -1,7 +1,10 @@
 /* ***** BEGIN LICENSE BLOCK ***** 
  * Version: RCSL 1.0/RPSL 1.0 
  *  
- * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. 
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
  *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
@@ -30,19 +33,21 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-#ifndef _EXPRDNLD_H_
-#define _EXPRDNLD_H_
+#include "hxprdnld.h"
 
-// /#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
+#ifndef _CHX_PD_STATUS_OBSERVER_H_
+#define _CHX_PD_STATUS_OBSERVER_H_
 
 /****************************************************************************
  * 
  *  Class:
  *
- *	ExamplePDStatusObserver
+ *	CHXPDStatusObserver
  *
  *  Purpose:
  *
@@ -50,7 +55,7 @@
  *      download status reports:
  *
  */
-class ExamplePDStatusObserver : 
+class CHXPDStatusObserver : 
 	public IHXPDStatusObserver
 {
 private:
@@ -66,11 +71,11 @@
     HXBOOL                  m_bInitialPrerollUpateGranularitySet;
     HXBOOL                  m_bDownloadIsComplete;
 
-    ExamplePDStatusObserver();
-    ~ExamplePDStatusObserver();
+    CHXPDStatusObserver();
+    ~CHXPDStatusObserver();
 
 public:
-    ExamplePDStatusObserver(IUnknown* pUnkPlayer);
+    CHXPDStatusObserver(IUnknown* pUnkPlayer);
     
     /*
      * IUnknown methods
@@ -190,7 +195,6 @@
     STDMETHOD(OnDownloadResume)    (THIS_
             IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource);
 };
-// /#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
 
-#endif // _EXPRDNLD_H_
+#endif // _CHX_PD_STATUS_OBSERVER_H_
exsitsup.cpp.diff (application/octet-stream, 10.5 KB)
--- simpleplayer/exsitsup.cpp	2006-09-02 01:28:56.000000000 +0800
+++ mediasinklib/CHXSiteSupplier.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,45 +33,176 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-#ifdef _WIN16
-#include <windows.h>
-#endif
-
 #include "hxcom.h"
 #include "hxtypes.h"
 #include "hxwintyp.h"
 #include "hxwin.h"
 #include "ihxpckts.h"
 #include "hxcomm.h"
-#include "fivemmap.h"
 #include "hxstring.h" // CHXString
-#include "exsitsup.h"
 #include "pckunpck.h" // CreateBufferCCF
 #include "ciddefs.h"  // CID_RGB32
-#if defined(HELIX_FEATURE_PNG)
-#include "pxpngenc.h" // PXPNGEncode::EncodeToPNGBuffer
-#endif //  HELIX_FEATURE_PNG
-#include "print.h"
+#include <string.h>
+#include "hxtypes.h"
 
+#include "CHXSite.h"
+#include "CHXSiteSupplier.h"
+#include "print.h"
 
 #include "globals.h"
 struct _stGlobals*& GetGlobal();
 
+void* FiveMinuteMap::GetFirstValue()
+{
+    m_nCursor = 0;
+
+    if (m_nMapSize)
+    {
+       return m_pValueArray[m_nCursor];
+    }
+    else
+    {
+       return NULL;
+    }
+}
+
+void* FiveMinuteMap::GetNextValue()
+{
+    m_nCursor++;
+
+    if (m_nCursor < m_nMapSize)
+    {
+       return m_pValueArray[m_nCursor];
+    }
+    else
+    {
+       return NULL;
+    }
+}
+
+HXBOOL FiveMinuteMap::Lookup(void* Key, void*& Value) const
+{
+    HXBOOL bFound = FALSE;
+    int nIndex = 0;
+
+    // If Key is alrady in the list, replace value
+    for (; nIndex < m_nMapSize; nIndex++)
+    {
+	if (m_pKeyArray[nIndex] == Key)
+	{
+	    Value = m_pValueArray[nIndex];
+	    bFound = TRUE;
+	    goto exit;
+	}
+    }
+
+exit:
+    return bFound;    
+}
+
+void FiveMinuteMap::RemoveKey(void* Key)
+{
+    int nIndex = 0;
+
+    // If Key is alrady in the list, replace value
+    for (; nIndex < m_nMapSize; nIndex++)
+    {
+	if (m_pKeyArray[nIndex] == Key)
+	{
+	    if (nIndex < (m_nMapSize-1))
+	    {
+		memmove(&(m_pKeyArray[nIndex]),&(m_pKeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
+		memmove(&(m_pValueArray[nIndex]),&(m_pValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
+	    }
+	    m_nMapSize--;
+	    goto exit;
+	}
+    }
+
+exit:
+    return;
+}
+
+void FiveMinuteMap::RemoveValue(void* Value)
+{
+    int nIndex = 0;
+
+    // If Value is alrady in the list, replace value
+    for (; nIndex < m_nMapSize; nIndex++)
+    {
+	if (m_pValueArray[nIndex] == Value)
+	{
+	    if (nIndex < (m_nMapSize-1))
+	    {
+		memmove(&(m_pKeyArray[nIndex]),&(m_pKeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
+		memmove(&(m_pValueArray[nIndex]),&(m_pValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
+	    }
+	    m_nMapSize--;
+	    goto exit;
+	}
+    }
+
+exit:
+    return;
+}
+
+
+void FiveMinuteMap::SetAt(void* Key, void* Value)
+{
+    int nIndex = 0;
+
+    // If Key is alrady in the list, replace value
+    for (; nIndex < m_nMapSize; nIndex++)
+    {
+	if (m_pKeyArray[nIndex] == Key)
+	{
+	    m_pValueArray[nIndex] = Value;
+	    goto exit;
+	}
+    }
+
+    // If we have room, add it to the end!
+    if (m_nAllocSize == m_nMapSize)
+    {
+	m_nAllocSize += AllocationSize;
+	void** pNewKeys   = new void*[m_nAllocSize];
+	void** pNewValues = new void*[m_nAllocSize];
+
+	memcpy(pNewKeys,m_pKeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
+	memcpy(pNewValues,m_pValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
+
+	delete [] m_pKeyArray;
+	delete [] m_pValueArray;
+
+	m_pKeyArray = pNewKeys;
+	m_pValueArray = pNewValues;
+    }
+
+    m_pKeyArray[m_nMapSize] = Key;
+    m_pValueArray[m_nMapSize] = Value;
+    m_nMapSize++;
+
+exit:
+    return;
+}
+
 /************************************************************************
  *  Method:
  *    Constructor
  */
-ExampleSiteSupplier::ExampleSiteSupplier(IUnknown* pUnkPlayer)
+CHXSiteSupplier::CHXSiteSupplier(IUnknown* pUnkPlayer, on_new_frame_cb_t on_new_frame_cb, void *context)
     : m_lRefCount(0)
     , m_pSiteManager(NULL)
     , m_pSite(NULL)
-    , m_pSiteCapture(NULL)
-    , m_pCaptureBuffer(NULL)
     , m_pCCF(NULL)
     , m_pUnkPlayer(pUnkPlayer)
+    , m_on_new_frame_cb(on_new_frame_cb)
+    , m_context(context)
 {
     if (m_pUnkPlayer)
     {
@@ -86,12 +220,10 @@
  *  Method:
  *    Destructor
  */
-ExampleSiteSupplier::~ExampleSiteSupplier()
+CHXSiteSupplier::~CHXSiteSupplier()
 {
     HX_RELEASE(m_pSiteManager);
     HX_RELEASE(m_pSite);
-    HX_RELEASE(m_pSiteCapture);
-    HX_RELEASE(m_pCaptureBuffer);
     HX_RELEASE(m_pCCF);
     HX_RELEASE(m_pUnkPlayer);
 }
@@ -101,7 +233,7 @@
  *    IUnknown::QueryInterface
  */
 STDMETHODIMP 
-ExampleSiteSupplier::QueryInterface(REFIID riid, void** ppvObj)
+CHXSiteSupplier::QueryInterface(REFIID riid, void** ppvObj)
 {
     if (IsEqualIID(riid, IID_IUnknown))
     {
@@ -125,7 +257,7 @@
  *    IUnknown::AddRef
  */
 STDMETHODIMP_(ULONG32) 
-ExampleSiteSupplier::AddRef()
+CHXSiteSupplier::AddRef()
 {
     return InterlockedIncrement(&m_lRefCount);
 }
@@ -135,7 +267,7 @@
  *    IUnknown::Release
  */
 STDMETHODIMP_(ULONG32) 
-ExampleSiteSupplier::Release()
+CHXSiteSupplier::Release()
 {
     if (InterlockedDecrement(&m_lRefCount) > 0)
     {
@@ -159,22 +291,13 @@
  *    site is no longer needed.
  */
 STDMETHODIMP 
-ExampleSiteSupplier::SitesNeeded
+CHXSiteSupplier::SitesNeeded
 (
     UINT32	uRequestID,
     IHXValues*	pProps
 )
 {
     /*
-     * Don't create a site if the -NULL_RENDER command line option
-     * was given. - jfarr
-     */
-    if (GetGlobal()->g_bNullRender)
-    {
-	return (HXR_OK);
-    }
-    
-    /*
      * If there are no properties, then we can't really create a
      * site, because we have no idea what type of site is desired!
      */
@@ -190,12 +313,14 @@
     UINT32		style		= 0;
     IHXSite*		pSite		= NULL;
 
-    // Just let the RMA client core create a windowed site for us.
-    hres = m_pCCF->CreateInstance(CLSID_IHXSiteWindowed,(void**)&pSiteWindowed);
+    {
+        *(void **)&pSiteWindowed = (IUnknown*)(IHXSiteWindowed*)(new CHXSite(GetGlobal()->pMediaPlatform, NULL, 0, m_on_new_frame_cb, m_context));
+        hres = ((IUnknown*)*(void **)&pSiteWindowed)->QueryInterface(IID_IHXSiteWindowed, (void**)&pSiteWindowed);
     if (HXR_OK != hres)
     {
 	goto exit;
     }
+    }
 
     hres = pSiteWindowed->QueryInterface(IID_IHXSite,(void**)&pSite);
     if (HXR_OK != hres)
@@ -238,9 +363,6 @@
 	}
     }
 
-#ifdef _WINDOWS
-    style = WS_OVERLAPPED | WS_VISIBLE | WS_CLIPCHILDREN;
-#endif
 
     hres = pSiteWindowed->Create(NULL, style);
     if (HXR_OK != hres)
@@ -257,12 +379,6 @@
     {
 	goto exit;
     }
-#ifdef _WINDOWS
-    {
-       HXxWindow* pWindow = pSiteWindowed->GetWindow();
-       if (pWindow && pWindow->window) ::SetForegroundWindow( (HWND)(pWindow->window) );
-    }
-#endif
     m_CreatedSites.SetAt((void*)uRequestID,pSite);
     pSite->AddRef();
 
@@ -286,7 +402,7 @@
  *    and remove those sites.
  */
 STDMETHODIMP 
-ExampleSiteSupplier::SitesNotNeeded(UINT32 uRequestID)
+CHXSiteSupplier::SitesNotNeeded(UINT32 uRequestID)
 {
     IHXSite*		pSite = NULL;
     IHXSiteWindowed*	pSiteWindowed = NULL;
@@ -326,7 +442,7 @@
  *    while a layout change is in progress,
  */
 STDMETHODIMP 
-ExampleSiteSupplier::BeginChangeLayout()
+CHXSiteSupplier::BeginChangeLayout()
 {
     return HXR_OK;
 }
@@ -339,101 +455,7 @@
  *    completed.
  */
 STDMETHODIMP 
-ExampleSiteSupplier::DoneChangeLayout()
+CHXSiteSupplier::DoneChangeLayout()
 {
     return HXR_OK;
 }
-
-HX_RESULT
-ExampleSiteSupplier::CaptureImage(CHXString pszFileName, INT32 dWidth, INT32 dHeight)
-{
-    HX_RESULT res=HXR_FAIL;
-
-    // Get the IHXSiteCapture object from the site
-    if (m_pSiteCapture == NULL)
-    {
-	if (m_pSite && m_pSite->QueryInterface(IID_IHXSiteCapture, (void**)&m_pSiteCapture) == HXR_OK)
-	{
-	    m_pSiteCapture->AddRef();
-	}
-    }
-
-    // Create the buffer that will receive the image data
-    if (m_pCaptureBuffer == NULL)
-    {
-    	CreateBufferCCF(m_pCaptureBuffer, m_pCCF);
-	if (!m_pCaptureBuffer)
-	{
-	    return HXR_OUTOFMEMORY;
-	}
-    }
-
-    HXBOOL bCanCapture = FALSE;
-
-    // Check if the site is available to capture an image
-    if (m_pSiteCapture && (res = m_pSiteCapture->CanCapture(bCanCapture)) == HXR_OK && bCanCapture)
-    {
-	HX_RESULT res;
-	HXxSize outputSize;
-	outputSize.cx  = dWidth;
-	outputSize.cy  = dHeight;
-	m_strFileName = pszFileName;
-
-	// Asynchronous call. CaptureDone() will be called with result.
-	res = m_pSiteCapture->Capture((IHXSiteCaptureResponse*)this, m_pCaptureBuffer, &outputSize, CID_RGB32);
-    }
-
-    return res;
-
-}
-
-//
-// IHXSiteCaptureResponse::CaptureDone
-//
-// Called when the site has captured the next frame.
-// bmiOutputFormat points to image format description which
-// is valid until the completion of CaptureDone.
-// bmiOutputFormat can be different for every capture.
-// pCaptureBuffer holds the image if supplied in
-// Capture() method.  pCaptureBuffer is automatically
-// resized if it has insufficient size to hold the image
-// data.
-//
-// status may be:
-//   HXR_FAIL  -- No capture was done. General Error. All data is invalid.
-//   HXR_OK    -- Capture was done. Both variables are valid.
-STDMETHODIMP
-ExampleSiteSupplier::CaptureDone(REF(HX_RESULT) status,
-			REF(HXBitmapInfoHeader) bmiOutputFormat,
-			REF(IHXBuffer*) pCaptureBuffer)
-{
-    if (status == HXR_OK)
-    {
-#if defined(HELIX_FEATURE_PNG)
-	// Convert capture buffer into PNG
-	IHXBuffer* pConvertedBuffer=NULL;
-	HX_RESULT res = HXR_OK;
-	res = PXPNGEncode::EncodeToPNGBuffer(pCaptureBuffer, &bmiOutputFormat, m_pCCF, pConvertedBuffer);
-	if (res == HXR_OK && !m_strFileName.IsEmpty())
-	{
-	    CHXString strTail = m_strFileName.Right(4);
-	    if (strTail.CompareNoCase(".png") != 0)
-	    {
-		m_strFileName += ".png";
-	    }
-
-	    FILE* fp = fopen(m_strFileName, "wb");
-	    if (fp)
-	    {
-	        fwrite(pConvertedBuffer->GetBuffer(), 1, pConvertedBuffer->GetSize(), fp);
-	        fclose(fp);
-		STDOUT("Captured image to PNG file: %s\n", (const char*)m_strFileName);
-		STDOUT("File size: %ld\n", pConvertedBuffer->GetSize());
-	    }
-	    HX_RELEASE(pConvertedBuffer);
-	}
-#endif //  HELIX_FEATURE_PNG
-    }
-
-    return status;
-}
exsitsup.h.diff (application/octet-stream, 3 KB)
--- simpleplayer/exsitsup.h	2006-04-28 06:40:10.000000000 +0800
+++ mediasinklib/CHXSiteSupplier.h	2009-04-16 13:37:29.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,42 +33,82 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-#ifndef _EXSITSUP_H_
-#define _EXSITSUP_H_
+#ifndef _CHX_SITE_SUPPLIER_H_
+#define _CHX_SITE_SUPPLIER_H_
+
+#include "player.h"
+
+class FiveMinuteMap
+{
+    const int AllocationSize;
+
+    void**  m_pKeyArray;
+    void**  m_pValueArray;
+    int	    m_nMapSize;
+    int	    m_nAllocSize;
+    int     m_nCursor;
+
+public:
+    FiveMinuteMap()
+	: AllocationSize(10)
+	, m_pKeyArray(NULL)
+	, m_pValueArray(NULL)
+	, m_nMapSize(0)
+	, m_nAllocSize(0)
+        , m_nCursor(0)
+	{};
+
+    ~FiveMinuteMap()
+	{
+	    delete [] m_pKeyArray;
+	    delete [] m_pValueArray;
+	};
+
+    int  GetCount() {return m_nMapSize;}
+
+    void* GetFirstValue();
+    void* GetNextValue();
+
+    HXBOOL Lookup(void* Key, void*& Value) const;
+    void RemoveKey(void* Key);
+    void RemoveValue(void* Value);
+    void SetAt(void* Key, void* Value);
+};
 
 /****************************************************************************
  * 
  *  Class:
  *
- *	ExampleSiteSupplier
+ *	CHXSiteSupplier
  *
  *  Purpose:
  *
  *	Implementation for ragui's IHXSiteSupplier
  *
  */
-class ExampleSiteSupplier : 
+class CHXSiteSupplier : 
 	public IHXSiteSupplier
-	, public IHXSiteCaptureResponse
 {
 private:
     LONG32		    m_lRefCount;
     IHXSiteManager*	    m_pSiteManager;
     IHXSite*		    m_pSite;
-    IHXSiteCapture*	    m_pSiteCapture;
-    IHXBuffer*		    m_pCaptureBuffer;
     IHXCommonClassFactory*  m_pCCF;
     IUnknown*		    m_pUnkPlayer;
     FiveMinuteMap	    m_CreatedSites;
     CHXString		    m_strFileName;
+        on_new_frame_cb_t      m_on_new_frame_cb;
+        void *                 m_context;
 
-    ~ExampleSiteSupplier();
+        ~CHXSiteSupplier();
 
 public:
-    ExampleSiteSupplier(IUnknown* pUnkPlayer);
+        CHXSiteSupplier(IUnknown* pUnkPlayer, on_new_frame_cb_t new_frame_cb = NULL, void *context = NULL);
     
     /*
      * IUnknown methods
@@ -132,18 +175,7 @@
      */
     STDMETHOD(DoneChangeLayout) (THIS);
 
-    /*
-     * IHXSiteCaptureResponse
-     */
-    STDMETHOD(CaptureDone)	(THIS_
-				REF(HX_RESULT) 		 status,
-                        	REF(HXBitmapInfoHeader)  bmiOutputFormat,
-                        	REF(IHXBuffer*)          pImageDataBuffer
-				);
-
-    HX_RESULT CaptureImage(CHXString pFileName, INT32 dWidth, INT32 dHeight);
-
 };
 
-#endif // _EXSITSUP_H_
+#endif // _CHX_SITE_SUPPLIER_H_
fivemmap.cpp.diff (application/octet-stream, 4.7 KB)
--- simpleplayer/fivemmap.cpp	2005-03-16 07:40:24.000000000 +0800
+++ /dev/null	2009-04-21 11:12:45.000000000 +0800
@@ -1,175 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK ***** 
- * Version: RCSL 1.0/RPSL 1.0 
- *  
- * 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 
- * Version 1.0 (the "RPSL") available at 
- * http://www.helixcommunity.org/content/rpsl unless you have licensed 
- * the file under the RealNetworks Community Source License Version 1.0 
- * (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.  
- *  
- * 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 <string.h>
-#include "hxtypes.h"
-#include "fivemmap.h"
-
-void* FiveMinuteMap::GetFirstValue()
-{
-    m_nCursor = 0;
-
-    if (m_nMapSize)
-    {
-       return m_pValueArray[m_nCursor];
-    }
-    else
-    {
-       return NULL;
-    }
-}
-
-void* FiveMinuteMap::GetNextValue()
-{
-    m_nCursor++;
-
-    if (m_nCursor < m_nMapSize)
-    {
-       return m_pValueArray[m_nCursor];
-    }
-    else
-    {
-       return NULL;
-    }
-}
-
-HXBOOL FiveMinuteMap::Lookup(void* Key, void*& Value) const
-{
-    HXBOOL bFound = FALSE;
-    int nIndex = 0;
-
-    // If Key is alrady in the list, replace value
-    for (; nIndex < m_nMapSize; nIndex++)
-    {
-	if (m_pKeyArray[nIndex] == Key)
-	{
-	    Value = m_pValueArray[nIndex];
-	    bFound = TRUE;
-	    goto exit;
-	}
-    }
-
-exit:
-    return bFound;    
-}
-
-void FiveMinuteMap::RemoveKey(void* Key)
-{
-    HXBOOL bFound = FALSE;
-    int nIndex = 0;
-
-    // If Key is alrady in the list, replace value
-    for (; nIndex < m_nMapSize; nIndex++)
-    {
-	if (m_pKeyArray[nIndex] == Key)
-	{
-	    if (nIndex < (m_nMapSize-1))
-	    {
-		memmove(&(m_pKeyArray[nIndex]),&(m_pKeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
-		memmove(&(m_pValueArray[nIndex]),&(m_pValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
-	    }
-	    m_nMapSize--;
-	    goto exit;
-	}
-    }
-
-exit:
-    (NULL); // We're done!
-}
-
-void FiveMinuteMap::RemoveValue(void* Value)
-{
-    HXBOOL bFound = FALSE;
-    int nIndex = 0;
-
-    // If Value is alrady in the list, replace value
-    for (; nIndex < m_nMapSize; nIndex++)
-    {
-	if (m_pValueArray[nIndex] == Value)
-	{
-	    if (nIndex < (m_nMapSize-1))
-	    {
-		memmove(&(m_pKeyArray[nIndex]),&(m_pKeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
-		memmove(&(m_pValueArray[nIndex]),&(m_pValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
-	    }
-	    m_nMapSize--;
-	    goto exit;
-	}
-    }
-
-exit:
-    (NULL); // We're done!
-}
-
-
-void FiveMinuteMap::SetAt(void* Key, void* Value)
-{
-    int nIndex = 0;
-
-    // If Key is alrady in the list, replace value
-    for (; nIndex < m_nMapSize; nIndex++)
-    {
-	if (m_pKeyArray[nIndex] == Key)
-	{
-	    m_pValueArray[nIndex] = Value;
-	    goto exit;
-	}
-    }
-
-    // If we have room, add it to the end!
-    if (m_nAllocSize == m_nMapSize)
-    {
-	m_nAllocSize += AllocationSize;
-	void** pNewKeys   = new void*[m_nAllocSize];
-	void** pNewValues = new void*[m_nAllocSize];
-
-	memcpy(pNewKeys,m_pKeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
-	memcpy(pNewValues,m_pValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
-
-	delete [] m_pKeyArray;
-	delete [] m_pValueArray;
-
-	m_pKeyArray = pNewKeys;
-	m_pValueArray = pNewValues;
-    }
-
-    m_pKeyArray[m_nMapSize] = Key;
-    m_pValueArray[m_nMapSize] = Value;
-    m_nMapSize++;
-
-exit:
-    (NULL); // We're done!
-}
-
fivemmap.h.diff (application/octet-stream, 2.7 KB)
--- simpleplayer/fivemmap.h	2005-03-16 07:40:24.000000000 +0800
+++ /dev/null	2009-04-21 11:12:45.000000000 +0800
@@ -1,79 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK ***** 
- * Version: RCSL 1.0/RPSL 1.0 
- *  
- * 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 
- * Version 1.0 (the "RPSL") available at 
- * http://www.helixcommunity.org/content/rpsl unless you have licensed 
- * the file under the RealNetworks Community Source License Version 1.0 
- * (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.  
- *  
- * 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 _FIVEMMAP_H_
-#define _FIVEMMAP_H_
-
-#ifndef _HXTYPES_H_
-#error FiveMinuteMap assumes pntypes.h.
-#endif
-
-class FiveMinuteMap
-{
-    const int AllocationSize;
-
-    void**  m_pKeyArray;
-    void**  m_pValueArray;
-    int	    m_nMapSize;
-    int	    m_nAllocSize;
-    int     m_nCursor;
-public:
-    FiveMinuteMap()
-	: m_pKeyArray(NULL)
-	, m_pValueArray(NULL)
-	, m_nMapSize(0)
-	, m_nAllocSize(0)
-        , m_nCursor(0)
-	, AllocationSize(10)
-	{};
-
-    ~FiveMinuteMap()
-	{
-	    delete [] m_pKeyArray;
-	    delete [] m_pValueArray;
-	};
-
-    int  GetCount() {return m_nMapSize;}
-
-    void* GetFirstValue();
-    void* GetNextValue();
-
-    HXBOOL Lookup(void* Key, void*& Value) const;
-    void RemoveKey(void* Key);
-    void RemoveValue(void* Value);
-    void SetAt(void* Key, void* Value);
-};
-
-#endif /* _FIVEMMAP_H_ */
globals.h.diff (application/octet-stream, 3.5 KB)
--- simpleplayer/globals.h	2006-08-25 07:03:02.000000000 +0800
+++ mediasinklib/globals.h	2009-04-16 13:37:29.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,20 +33,13 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
-/****************************************************************************
- * 
- *  Test Client:
- *  
- *
- *  This is an test client running on Windows, Mac, and Unix without a GUI.
- *
- */ 
-
-#ifndef _SPLAY_GLOBALS_H
-#define _SPLAY_GLOBALS_H
+#ifndef _GLOBALS_H_
+#define _GLOBALS_H_
 
 #include "dllacces.h"
 #include "dllpath.h"
@@ -52,13 +48,15 @@
 #include "hxcore.h"
 #include "ihxmedpltfm.h"
 
+#include "CHXClientContext.h"
+#include "preflist.h"
+
 #define HX_COMMAND_BUFFER_SIZE 256
 #define HX_MAX_NUM_MULTI_SEEKS 10
-
 struct _stGlobals
 {
     _stGlobals()
-        : g_Players(NULL),
+        : g_pDLLAccess(NULL),
 	  g_nPlayers(0),
 	  m_fpHXMediaPlatformOpen(NULL),
 	  m_fpHXCreateMediaPlatform(NULL),
@@ -78,6 +76,7 @@
 	  g_ulNumSecondsPlayed(0),
 	  pMediaPlatform(NULL),
           g_pIHXKicker(NULL),
+	  g_uThreadIDForKicker(-1),
           bUseLegacyAPIs(FALSE),
 	  pEngine(NULL),
           g_pQuickSeek(NULL),
@@ -92,11 +91,19 @@
     {
         memset(g_szCommandBuffer, 0, HX_COMMAND_BUFFER_SIZE);
         memset(g_szPriorCommandBuffer, 0, HX_COMMAND_BUFFER_SIZE);
+        memset(g_Players, 0, sizeof(g_Players));
+        memset(g_pszURLs, 0, sizeof(g_pszURLs));
+        memset(g_pClientContexts, 0, sizeof(g_pClientContexts));
     }
 
-    IHXPlayer**              g_Players;
-    int                      g_nPlayers;
+    #define MAX_NUM_PLAYERS 256
+    IHXPlayer*              g_Players[MAX_NUM_PLAYERS];
+    char                   *g_pszURLs[MAX_NUM_PLAYERS];
+    CHXClientContext    *g_pClientContexts[MAX_NUM_PLAYERS];
     DLLAccessPath            g_statclnt;
+    DLLAccess*              g_pDLLAccess;
+    int                     g_nPlayers;
+    CHXPrefList             g_prefList;
 
     FPHXMEDIAPLATFORMOPEN    m_fpHXMediaPlatformOpen;
     FPHXCREATEMEDIAPLATFORM  m_fpHXCreateMediaPlatform;
@@ -118,6 +125,8 @@
     UINT32                   g_ulNumSecondsPlayed;
     IHXMediaPlatform*	     pMediaPlatform;
     IHXMediaPlatformKicker*  g_pIHXKicker;
+    UINT32	             g_uThreadIDForKicker;
+    pthread_t	             g_pThreadKickmanId;
     HXBOOL                   bUseLegacyAPIs;
     IHXClientEngine*         pEngine;
     IHXQuickSeek*            g_pQuickSeek;
@@ -126,13 +135,12 @@
     HXBOOL                   g_bInitVelocity;
     HXBOOL                   g_bABD;
     IHXPlaybackVelocityCaps* g_pVelocityCaps;
-    HXBOOL                   g_bMultiSeek;
     UINT32                   g_ulMultiSeekTime[HX_MAX_NUM_MULTI_SEEKS];
     UINT32                   g_ulNumMultiSeeks;
     UINT32                   g_ulMultiSeekIndex;
+    HXBOOL                   g_bMultiSeek;
     char                     g_szCommandBuffer[HX_COMMAND_BUFFER_SIZE];
     char                     g_szPriorCommandBuffer[HX_COMMAND_BUFFER_SIZE];
 };
 
-
-#endif // _SPLAY_GLOBALS_H
+#endif // _GLOBALS_H_
iids.cpp.diff (application/octet-stream, 1 KB)
--- simpleplayer/iids.cpp	2003-07-16 07:33:56.000000000 +0800
+++ mediasinklib/iids.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *  
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  *      
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are 
  * subject to the current version of the RealNetworks Public Source License 
  * Version 1.0 (the "RPSL") available at 
@@ -30,6 +33,8 @@
  *    http://www.helixcommunity.org/content/tck 
  * 
  * Contributor(s): 
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *  
  * ***** END LICENSE BLOCK ***** */ 
 
@@ -40,11 +45,3 @@
 #include "hxcom.h"
 #include "hxiids.h"
 #include "hxpiids.h"
-#if defined _WINDOWS
-#if defined (HELIX_FEATURE_DIRECT_SOUND)
-#include "dsound.h"
-#endif /* HELIX_FEATURE_DIRECT_SOUND */
-#if defined (HELIX_FEATURE_VIDEO) && !defined(_WINCE)
-#include "ddraw.h"
-#endif /* HELIX_FEATURE_VIDEO */
-#endif
player.cpp.diff (application/octet-stream, 91.4 KB)
--- simpleplayer/main.cpp	2009-04-14 13:29:53.000000000 +0800
+++ mediasinklib/player.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -3,6 +3,9 @@
  *
  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
  *
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
  * The contents of this file, and the files included with this file, are
  * subject to the current version of the RealNetworks Public Source License
  * Version 1.0 (the "RPSL") available at
@@ -30,17 +33,11 @@
  *    http://www.helixcommunity.org/content/tck
  *
  * Contributor(s):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  *
  * ***** END LICENSE BLOCK ***** */
 
-/****************************************************************************
- *
- *  Test Client:
- *
- *
- *  This is an test client running on Windows, Mac, and Unix without a GUI.
- *
- */
 #include "hxtypes.h"
 
 #include <stdlib.h>
@@ -62,7 +59,6 @@
 #include "hxwin.h"
 #include "hxprefs.h"
 #include "hxtbuf.h"
-#include "fivemmap.h"
 #include "dllacces.h"
 #include "hxausvc.h"
 #include "hxstrutl.h"
@@ -73,6 +69,8 @@
 #include "hxplayvelocity.h"
 #include "pckunpck.h"  //  For CreateAndSetBufferCCF()
 #include "hxvctrl.h"
+#include "hxbsrc.h"
+#include "pthread.h"
 
 #if defined(HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION)
 #include "hxpfs.h"
@@ -80,19 +78,14 @@
 
 #if defined(HELIX_FEATURE_PREFERENCES)
 #include "preflist.h"
-#endif /* #if defined(HELIX_FEATURE_PREFERENCES) */
-#include "exadvsnk.h"
-#include "exerror.h"
-#include "exsitsup.h"
-#include "exaumgr.h"
-#if defined(_WIN32)
-#include "exabd.h"
 #endif
-#include "excontxt.h"
+#include "CHXClientAdviceSink.h"
+#include "CHXErrorSink.h"
+#include "CHXSiteSupplier.h"
+#include "CHXAuthenticationManager.h"
+#include "CHXClientContext.h"
 #include "print.h"
-#if defined(USE_XWINDOWS)
-#include <X11/Xlib.h>
-#endif
+
 #if defined (_UNIX)
 #include <stdio.h>
 #include <sys/time.h>
@@ -100,65 +93,22 @@
 #include <unistd.h>
 #include <termios.h>
 #endif
-#if defined(_WINDOWS)
-#include <conio.h>
-#endif
-
-#ifdef __TCS__
-#include <unistd.h>
-#if defined(__cplusplus)
-extern      "C"     {
-#endif      /* defined(__cplusplus) */
-    extern      unsigned long  tmosTimSleep(unsigned long ticks);
-    unsigned long       gForcePlayerToStop = 0;
-#if defined(__cplusplus)
-}
-#endif      /* defined(__cplusplus) */
-#endif
-
-#if defined (_MACINTOSH) || defined (_MAC_UNIX)
-bool gMacPlayerIsDone = false;
-#endif
-
-
-#if defined _VXWORKS
-#include "sys/times.h"
-#include "string.h"
-#include "hxtime.h"
-#endif
-
-#if defined(_MACINTOSH)
-#ifndef _MAC_MACHO
-#include <sioux.h>
-#include <console.h>
-#endif
-#endif
 
 #include "dllpath.h"
 
-#ifdef _SYMBIAN
-#include <e32svr.h>
-#include "platform/symbian/symbian_event_hndlr.h"
-#endif
-
 ENABLE_DLLACCESS_PATHS(g_SPlayAccessPath);
 
 // typedef for SetDLLAccessPath
 
-
 #include "thrdutil.h"
 
-#if defined(_AIX)
-#include <strings.h>
-#endif
-
 #if defined _DEBUG || defined DEBUG
 #include "debug.h"
 #endif
 
 #ifndef MAX_PATH
 #define MAX_PATH    256
-#endif //!MAX_PATH
+#endif
 
 #if defined(HELIX_CONFIG_NOSTATICS)
 # include "globals/hxglobals.h"
@@ -168,9 +118,7 @@
 
 #include "globals.h" //for global struct.
 
-#if defined(_WINDOWS) && defined(_STATICALLY_LINKED)
-HINSTANCE g_hInstance = NULL;
-#endif
+#include "player.h"
 
 struct _stGlobals*& GetGlobal()
 {
@@ -188,7 +136,6 @@
 
 }
 
-
 // Constants
 const int DEFAULT_TIME_DELTA = 2000;
 const int DEFAULT_STOP_TIME  = -1;
@@ -196,223 +143,9 @@
 const int GUID_LEN           = 64;
 
 // Function prototypes
-void  PrintUsage(const char* pszAppName);
 HXBOOL  AllPlayersDone(int nNumPlayers, IHXPlayer** ppPlayers);
 void  StopAllPlayers(int nNumPlayers, IHXPlayer** ppPlayers);
 HXBOOL  ReadGUIDFile();
-char* GetAppName(char* pszArgv0);
-
-#ifdef __TCS__
-#if defined(__cplusplus)
-extern      "C"     {
-#endif      /* defined(__cplusplus) */
-
-    extern      void    _alloc_stats(int verbose);
-#if defined(__cplusplus)
-}
-#endif      /* defined(__cplusplus) */
-
-static  IHXPlayer** g_Players;
-static  int         g_nPlayers = 0;
-static  long        evtCount = 0;
-static  long        evtFullCount = 0;
-#endif
-
-#ifdef _WIN32
-#if !defined(WIN32_PLATFORM_PSPC)
-void
-ProperShutdown()
-{
-    int i;
-    for (i = 0; i < GetGlobal()->g_nPlayers; i++)
-    {
-        GetGlobal()->g_Players[i]->Stop();
-    }
-}
-
-HXBOOL
-HandlerRoutine(DWORD dwType)
-{
-    switch (dwType)
-    {
-       case CTRL_C_EVENT:
-       case CTRL_BREAK_EVENT:
-       case CTRL_CLOSE_EVENT:
-       case CTRL_LOGOFF_EVENT:
-       case CTRL_SHUTDOWN_EVENT:
-           ProperShutdown();
-    }
-    return TRUE;
-}
-#endif /* !defined(WIN32_PLATFORM_PSPC) */
-
-#endif
-
-#if defined(HELIX_FEATURE_VIDEO)
-
-HX_RESULT GetFullScreenSite(IHXPlayer* pPlayer, REF(IHXSiteFullScreen*) rpSite)
-{
-    HX_RESULT retVal = HXR_FAIL;
-
-    if (pPlayer)
-    {
-        // Get the IHXSiteManager2 interface
-        IHXSiteManager2* pSiteMgr2 = NULL;
-        retVal = pPlayer->QueryInterface(IID_IHXSiteManager2, (void**) &pSiteMgr2);
-        if (SUCCEEDED(retVal))
-        {
-            // Get the number of sites
-            UINT32 ulNumSites = 0;
-            retVal = pSiteMgr2->GetNumberOfSites(ulNumSites);
-            if (SUCCEEDED(retVal))
-            {
-                // XXXMEH - for now, only allow this to 
-                // work when there's only 1 site
-                if (ulNumSites == 1)
-                {
-                    IHXSite* pSite = NULL;
-                    retVal = pSiteMgr2->GetSiteAt(0, pSite);
-                    if (SUCCEEDED(retVal))
-                    {
-                        IHXSiteFullScreen* pFSSite = NULL;
-                        retVal = pSite->QueryInterface(IID_IHXSiteFullScreen, (void**) &pFSSite);
-                        if (SUCCEEDED(retVal))
-                        {
-                            HX_RELEASE(rpSite);
-                            rpSite = pFSSite;
-                            rpSite->AddRef();
-                        }
-                        HX_RELEASE(pFSSite);
-                    }
-                    HX_RELEASE(pSite);
-                }
-                else
-                {
-                    retVal = HXR_FAIL;
-                }
-            }
-        }
-        HX_RELEASE(pSiteMgr2);
-    }
-
-    return retVal;
-}
-
-HX_RESULT GetAnySite(IHXPlayer* pPlayer, REF(IHXSite*) rpSite)
-{
-    HX_RESULT retVal = HXR_FAIL;
-
-    if( pPlayer )
-    {
-        // Get the IHXSiteManager2 interface
-        IHXSiteManager2* pSiteMgr2 = NULL;
-        retVal = pPlayer->QueryInterface(IID_IHXSiteManager2, (void**) &pSiteMgr2);
-        if (SUCCEEDED(retVal))
-        {
-            // Get the number of sites
-            UINT32 ulNumSites = 0;
-            retVal = pSiteMgr2->GetNumberOfSites(ulNumSites);
-            if (SUCCEEDED(retVal))
-            {
-                if (ulNumSites != 0)
-                {
-                    IHXSite* pSite = NULL;
-                    retVal = pSiteMgr2->GetSiteAt(0, pSite);
-                    if (SUCCEEDED(retVal))
-                    {
-                        rpSite = pSite;
-                        rpSite->AddRef();
-                        pSite = NULL;
-                    }
-                    else
-                    {
-                        HX_ASSERT( "can't get a site"==NULL);
-                    }
-                }
-                else
-                {
-                    retVal = HXR_FAIL;
-                }
-            }
-        }
-        HX_RELEASE(pSiteMgr2);
-    }
-    return retVal;
-}
-
-enum COLOR_CONTROL
-{
-    BRIGHTNESS,
-    CONTRAST,
-    HUE,
-    SATURATTION,
-};
-
-float LimitIt(float fValue )
-{
-    float fTmp = fValue;
-    if( fTmp < -1 )
-    {
-        fTmp = -1;
-    }
-    if( fTmp > 1 )
-    {
-        fTmp = 1;
-    }
-    return fTmp;
-}
-
-void SetColorControl( COLOR_CONTROL cc, float fAdjustment )
-{
-    IHXSite* pSite = NULL;
-    HX_RESULT rv = GetAnySite(GetGlobal()->g_Players[0], pSite);
-    if (SUCCEEDED(rv))
-    {
-        IHXVideoControl* pVC = NULL;
-        rv = pSite->QueryInterface( IID_IHXVideoControl, (void**)&pVC);
-        if( SUCCEEDED(rv) )
-        {
-            float fTmp = 0.0;
-            switch( cc )
-            {
-               case BRIGHTNESS:
-                   fTmp = pVC->GetBrightness();
-                   fTmp += fAdjustment;
-                   pVC->SetBrightness(LimitIt(fTmp));
-                   break;
-               case CONTRAST:
-                   fTmp = pVC->GetContrast();
-                   fTmp += fAdjustment;
-                   pVC->SetContrast(LimitIt(fTmp));
-                   break;
-               case HUE:
-                   fTmp = pVC->GetHue();
-                   fTmp += fAdjustment;
-                   pVC->SetHue(LimitIt(fTmp));
-                   break;
-               case SATURATTION:
-                   fTmp = pVC->GetSaturation();
-                   fTmp += fAdjustment;
-                   pVC->SetSaturation(LimitIt(fTmp));
-                   break;
-               default:
-                   HX_ASSERT("bad color command"==NULL);
-                   break;
-            };
-            fprintf( stderr, "Brightness:%f  Contrast:%f  Hue:%f  Saturation:%f\n",
-                     pVC->GetBrightness(),
-                     pVC->GetContrast(),
-                     pVC->GetHue(),
-                     pVC->GetSaturation()
-                     ); 
-        }
-        HX_RELEASE(pVC);
-    }
-    HX_RELEASE(pSite);
-}
-
-
-#endif /* #if defined(HELIX_FEATURE_VIDEO) */
 
 #if defined(HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION)
 HX_RESULT
@@ -501,1410 +234,78 @@
 }
 #endif //  HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION.
 
-
-/*
- *  handle one event
- */
-void
-DoEvent()
-{
-    char  ch = 0;
-#if defined(_WINDOWS)
-    MSG msg;
-
-    GetMessage(&msg, NULL, 0, 0);
-    DispatchMessage(&msg);
-
-    // Check for key hit
-    if (_kbhit())
-    {
-        ch = _getch();
-    }
-#elif defined (_UNIX) && !defined(_MAC_UNIX)
-
-    struct _HXxEvent* pNothing = 0;
-    struct timeval    mtime;
-    fd_set fds;
-    int retval;
-    
-    //To pass in events in Atlas you have two choices now. The first
-    //is for backwards compatibility with Cayenne; calling
-    //EventOccurred(). The second way is to ask the platform for the
-    //event handler and to use that. Neither of these are strictly
-    //needed because the site provides its own event gathering
-    //code. You only need to do this if you have a special site or
-    //want to do some custom event work.
-
-    UINT32 sleepTime = 0;
-    
-    if( GetGlobal()->bUseLegacyAPIs )
+char* RemoveWrappingQuotes(char* str)
     {
-        //Compatibility with Cayenne based systems.
-        GetGlobal()->pEngine->EventOccurred(pNothing);
-    }
-    else
+    int len = strlen(str);
+    if (len > 0)
     {
-        //The new Atlas platform method.
-
-        //Kick'ing the platforms gives time to all of its
-        //schedulers. This is usefull for systems that do
-        //not have threads enabled or do not have timers.
-        IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
-        if( pKicker )
+        if (str[len-1] == '"') str[--len] = 0;
+        if (str[0] == '"') 
         {
-            pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
+	  int i = 0; 
+	  do 
+	  { 
+	      str[i] = str[i+1]; 
+	      i++;
+	  } while(--len); 
         }
-
-//        //This is how to pass events into the site if needed.
-//         IHXMediaPlatform* pMediaPlatform = GetGlobal()->pMediaPlatform;
-//         IHXSiteEventHandler* pHandler = NULL;
-//         pMediaPlatform->QueryInterface(IID_IHXSiteEventHandler,
-//                                        (void**)&pHandler);
-//         pHandler->EventOccurred(pNothing);
-//         HX_RELEASE(pHandler);
     }
-
-
-    mtime.tv_sec  = 0;
-    mtime.tv_usec = sleepTime;
-    FD_ZERO(&fds);
-    FD_SET(0, &fds);
-    retval = select(1, &fds, NULL, NULL, &mtime);
-
-    if(retval)
-    {
-        ch = 0;
-#ifndef ANDROID
-        read(0, &ch, 1);
-#endif
+    return str;
     }
     
-#elif defined(__TCS__)
-    _HXxEvent* pNothing = 0;
-
-    // This is in units of 10ms.
-    tmosTimSleep( 10 );
+void *kickman(void *dummy)
+{
+    while(1) {
+        UINT32 sleepTime = 0;
     IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
     if( pKicker )
-        pKicker->Kick(HXGetCurrentThreadID());
-    evtCount++;
-
-    if (evtCount > 80)
-    {
-        evtFullCount++;
-        if (evtFullCount > 10)
-        {
-            _alloc_stats(1);
-            evtFullCount = 0;
-        }
-        else
-            _alloc_stats(0);
-        evtCount = 0;
-    }
-
-#elif defined (_MACINTOSH) || defined(_MAC_UNIX)
-
-    EventRecord event;
-
-    if (WaitNextEvent(everyEvent, &event, 1, nil))
-    {
-	switch (event.what)
 	{
-		case keyDown:
-			gMacPlayerIsDone = true;
-			//ExitToShell();
-			break;
-		default:
-			HXxEvent _HXxEvent;
-			_HXxEvent.event  = ((EventRecord*)&event)->what;
-			_HXxEvent.param1 = &event;
-			_HXxEvent.param2 = NULL; // IMPORTANT! Must be NULL or a RgnHandle!
-			GetGlobal()->pEngine->EventOccurred(&_HXxEvent);
+            pKicker->Kick(GetGlobal()->g_uThreadIDForKicker, &sleepTime);
 	}
+        usleep(sleepTime);
     }
-    else
-    {
-	GetGlobal()->pEngine->EventOccurred(NULL);
     }
 	
-#elif defined(_SYMBIAN)
-    // We have to allocate the object on the heap because
-    // CActive does not appear to initialize iActive to 0
-    // like it should
-    SplayEventHandler* pEventHandler = new SplayEventHandler();
-    pEventHandler->DoEvents(20); // Process events for 20ms
-    delete pEventHandler;
-#endif
-    // Do we have a key hit?
-    if (ch)
+PLAYER_API int init_main( )
     {
-        STDOUT("%c", ch);
-        //  XXXEH- NOTE: I moved the {ch=tolower(ch)} conversion out of here
-        // because the "pf" command is case-sensitive.  I moved the tolower()
-        // conversion to the code, below, that looks at the contents of
-        // g_szCommandBuffer for deciding what command to process.
 
-        //Do forward and backward frame scrubbing at constant
-        //rate
-        if( '<' == ch )
-        {
-            ULONG32 ulNow = GetGlobal()->g_Players[0]->GetCurrentPlayTime();
-	    GetGlobal()->g_pQuickSeek->QuickSeek((ulNow > 133) ? (ulNow - 133) : 0);
-        }
-        if( '>' == ch )
-        {
-            ULONG32 ulNow = GetGlobal()->g_Players[0]->GetCurrentPlayTime();
-            GetGlobal()->g_pQuickSeek->QuickSeek(ulNow + 133);
-        }
+    FPHXMEDIAPLATFORMOPEN   fpHXMediaPlatformOpen   = NULL;
+    FPHXCREATEMEDIAPLATFORM fpHXCreateMediaPlatform = NULL;
+    FPHXMEDIAPLATFORMCLOSE  fpHXMediaPlatformClose  = NULL;
 
-#if defined(HELIX_FEATURE_VIDEO)
-        //Support for controlling the Brightness, Contrast and Hue. The keys
-        //were chosen by ease of en-us keyboard layout and availability.
-        //
-        // Brightness:  . and /
-        // Contrast..:  ; and '
-        // Hue.......:  [ and ]
-        // Saturation:  - and =
-        //
-        if( '.' == ch )
-        {
-            SetColorControl(BRIGHTNESS, -0.05 );
-        }
-        if( '/' == ch )
-        {
-            SetColorControl(BRIGHTNESS, 0.05 );
-        }
-        if( ';' == ch )
-        {
-            SetColorControl(CONTRAST, -0.05 );
-        }
-        if( '\'' == ch )
-        {
-            SetColorControl(CONTRAST, 0.05 );
-        }
-        if( '[' == ch )
-        {
-            SetColorControl(HUE, -0.05 );
-        }
-        if( ']' == ch )
-        {
-            SetColorControl(HUE, 0.05 );
-        }
-        if( '-' == ch )
-        {
-            SetColorControl(SATURATTION,  -0.05 );
-        }
-        if( '=' == ch )
-        {
-            SetColorControl(SATURATTION, 0.05 );
-        }
-#endif
+    HX_RESULT               theErr                  = HXR_OK;
+#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
+#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
+    char*                   pszURL[MAX_NUM_URLS];
+    char*                   pszURLOrig[MAX_NUM_URLS];
+    char                    dllhome[MAX_PATH]       = "/opt/helix/lib";
+    DLLAccess*              pDLLAccess              = NULL;
+    char                    staticLibPath[MAX_PATH] = {0}; /* Flawfinder: ignore */
         
-        // Is this a carriage return or linefeed?
-        if (ch == '\r' || ch == '\n')
-        {
-            // Process the command buffer
-            //
-            // Get the command buffer
-            const char*  pszCmdBuffer = (char*) GetGlobal()->g_szCommandBuffer;
-            UINT32       ulLen        = strlen(pszCmdBuffer);
-
-            char ch0 = tolower(pszCmdBuffer[0]);
-            char ch1 = ulLen>1? tolower(pszCmdBuffer[1]):'\0';
-
-            // Switch on command
-            if (ulLen == 1 && 'q' == ch0)
-            {
-                GetGlobal()->g_bUserStop = TRUE;
-            }
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-            else if (ulLen > 1 && 'v' == ch0)
-            {
-                // This is a command to set the velocity
-                //
-                // Get the velocity
-                const char* pszVelocity = pszCmdBuffer + 1;
-                INT32 lVelocity         = 0;
-                INT32 lKeyFrameMode     = 0;
-                INT32 lAutoSwitch       = 0;
-                INT32 lNumArg           = (INT32) sscanf(pszVelocity, "%ld,%ld,%ld",
-                                                         &lVelocity, &lKeyFrameMode, &lAutoSwitch);
-                if (lNumArg == 3)
-                {
-                    // Set the velocity in the FIRST player only
-                    if (GetGlobal()->g_nPlayers >= 1)
-                    {
-                        IHXPlaybackVelocity* pPlaybackVelocity = NULL;
-                        GetGlobal()->g_Players[0]->QueryInterface(IID_IHXPlaybackVelocity,
-                                                                  (void**) &pPlaybackVelocity);
-                        if (pPlaybackVelocity)
-                        {
-                            if (!GetGlobal()->g_bInitVelocity)
-                            {
-                                STDOUT("Initializing playback velocity in first player\n");
-                                pPlaybackVelocity->InitVelocityControl(NULL); // don't need response for now
-                                GetGlobal()->g_bInitVelocity = TRUE;
-                            }
-                            if (pPlaybackVelocity->GetVelocity() != lVelocity)
-                            {
-                                // Check if we can set this velocity
-                                HXBOOL bCanSet = FALSE;
-                                if (GetGlobal()->g_pVelocityCaps)
-                                {
-                                    bCanSet = GetGlobal()->g_pVelocityCaps->IsCapable(lVelocity);
-                                }
-                                if (bCanSet)
-                                {
-                                    STDOUT("Calling SetVelocity(%ld,%s,%s) in first player\n",
-                                           lVelocity,
-                                           (lKeyFrameMode ? "TRUE" : "FALSE"),
-                                           (lAutoSwitch ? "TRUE" : "FALSE"));
-                                    pPlaybackVelocity->SetVelocity(lVelocity, lKeyFrameMode, lAutoSwitch);
-                                }
-                                else
-                                {
-                                    STDOUT("This presentation not capable of setting velocity to %ld\n", lVelocity);
-                                }
-                            }
-                        }
-                        HX_RELEASE(pPlaybackVelocity);
-                    }
-                }
-                else
-                {
-                    fprintf(stderr, "Velocity run-time command is \"vX,Y,Z\" where:\n"
-                            "      X   is the velocity in integer percent of normal playback speed,\n"
-                            "      Y   is 0 for keyframe mode = FALSE or 1 for keyframe mode = TRUE,\n"
-                            "      Z   is 0 for autoswitch = FALSE or 1 for autoswitch = TRUE\n");
-                }
-            }
-            else if (ulLen == 1 && 'k' == ch0)
-            {
-                // This is a command to go to toggle keyframe mode
-                //
-                // Resume the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    IHXPlaybackVelocity* pPlaybackVelocity = NULL;
-                    GetGlobal()->g_Players[0]->QueryInterface(IID_IHXPlaybackVelocity,
-                                                              (void**) &pPlaybackVelocity);
-                    if (pPlaybackVelocity &&
-                        pPlaybackVelocity->GetVelocity() != HX_PLAYBACK_VELOCITY_NORMAL)
-                    {
-                        if (!pPlaybackVelocity->GetKeyFrameMode())
-                        {
-                            STDOUT("Setting keyframe mode to TRUE in first player\n");
-                            pPlaybackVelocity->SetKeyFrameMode(TRUE);
-                        }
-                    }
-                    HX_RELEASE(pPlaybackVelocity);
-                }
-            }
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
-            else if (ulLen == 1 && 'p'== ch0)
-            {
-                // This is a command to pause the player
-                //
-                // Pause the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    STDOUT("Pausing the first player\n");
-                    GetGlobal()->g_Players[0]->Pause();
-                }
-            }
-            else if (ulLen == 1 && 'r' == ch0)
-            {
-                // This is a command to resume the player
-                //
-                // Resume the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    STDOUT("Resuming the first player\n");
-                    GetGlobal()->g_Players[0]->Begin();
-                }
-            }
-            else if (ulLen == 1 && 't'== ch0)
-            {
-                // This is a command to get the current playback time
-                if (GetGlobal()->g_nPlayers >= 1)
-		{
-                    STDOUT("Playback time for player 0 : %lu ms\n", 
-				    GetGlobal()->g_Players[0]->GetCurrentPlayTime());
-		}
-            }
-            else if (ulLen == 1 && 'm' == ch0)
-            {
-                // This is a command to mute/unmute the player
-                //
-                // Mute/Unmute the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    IHXAudioPlayer* pAudioPlayer = NULL;
-                    GetGlobal()->g_Players[0]->QueryInterface(IID_IHXAudioPlayer, (void**) &pAudioPlayer);
-                    if (pAudioPlayer)
-                    {
-                        // Get the IHXVolume
-                        IHXVolume* pVolume = pAudioPlayer->GetAudioVolume();
-                        if (pVolume)
-                        {
-                            // Get the current value of mute
-                            HXBOOL bMute = pVolume->GetMute();
-                            // Flip it
-                            pVolume->SetMute(!bMute);
-                        }
-                        HX_RELEASE(pVolume);
-                    }
-                    HX_RELEASE(pAudioPlayer);
-                }
-            }
-            else if (ulLen == 1 && 'f' == ch0)
-            {
-                // This is a command to go to the next group
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    IHXGroupManager* pManager = NULL;
-                    GetGlobal()->g_Players[0]->QueryInterface(IID_IHXGroupManager, (void**) &pManager);
-                    if (pManager)
-                    {
-                        // Get the number of groups
-                        UINT16 usNumGroups = pManager->GetGroupCount();
-                        UINT16 usCurGroup  = 0;
-                        if (usNumGroups > 1)
-                        {
-                            // Get the current group
-                            pManager->GetCurrentGroup(usCurGroup);
-                            // Make sure there is a next group to go to
-                            if (usCurGroup + 1 < usNumGroups)
-                            {
-                                // Increment the group
-                                usCurGroup++;
-                                // Set that group as the current group
-                                STDOUT("Switching to group %u of %u\n", usCurGroup, usNumGroups);
-                                pManager->SetCurrentGroup(usCurGroup);
-                            }
-                            else
-                            {
-                                STDOUT("Cannot go to next group (numGroups=%u, curGroup=%u)\n", usNumGroups, usCurGroup);
-                            }
-                        }
-                        else
-                        {
-                            STDOUT("Cannot go to next group (numGroups=%u, curGroup=%u)\n", usNumGroups, usCurGroup);
-                        }
-                    }
-                    HX_RELEASE(pManager);
-                }
-            }
-            else if (ulLen == 1 && 'b' == ch0)
-            {
-                // This is a command to go to the previous group
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    IHXGroupManager* pManager = NULL;
-                    GetGlobal()->g_Players[0]->QueryInterface(IID_IHXGroupManager, (void**) &pManager);
-                    if (pManager)
-                    {
-                        // Get the number of groups
-                        UINT16 usNumGroups = pManager->GetGroupCount();
-                        UINT16 usCurGroup  = 0;
-                        if (usNumGroups > 1)
-                        {
-                            // Get the current group
-                            pManager->GetCurrentGroup(usCurGroup);
-                            // Make sure there is a previous group to go to
-                            if (usCurGroup)
-                            {
-                                // Decrement the group
-                                usCurGroup--;
-                                // Set that group as the current group
-                                STDOUT("Switching to group %u of %u\n", usCurGroup, usNumGroups);
-                                pManager->SetCurrentGroup(usCurGroup);
-                            }
-                            else
-                            {
-                                STDOUT("Cannot go to previous group (numGroups=%u, curGroup=%u)\n", usNumGroups, usCurGroup);
-                            }
-                        }
-                        else
-                        {
-                            STDOUT("Cannot go to previous group (numGroups=%u, curGroup=%u)\n", usNumGroups, usCurGroup);
-                        }
-                    }
-                    HX_RELEASE(pManager);
-                }
-            }
-            else if (ulLen > 1 && ch0 == 'l')
-            {
-                // This is a command to change the volume.
-                const char* pszVolume = pszCmdBuffer + 1;
-                UINT16      usVolume  = (UINT16) atol(pszVolume);
-                // This value must be <= 100
-                if (usVolume <= 100)
-                {
-                    // Change the volume of the FIRST player only
-                    if (GetGlobal()->g_nPlayers >= 1)
-                    {
-                        IHXAudioPlayer* pAudioPlayer = NULL;
-                        GetGlobal()->g_Players[0]->QueryInterface(IID_IHXAudioPlayer, (void**) &pAudioPlayer);
-                        if (pAudioPlayer)
-                        {
-                            // Get the IHXVolume
-                            IHXVolume* pVolume = pAudioPlayer->GetAudioVolume();
-                            if (pVolume)
-                            {
-                                // Get the current volume
-                                UINT16 usCurVolume = pVolume->GetVolume();
-                                // Change the volume
-                                STDOUT("Changing the volume of the first player from %u to %u\n", usCurVolume, usVolume);
-                                pVolume->SetVolume(usVolume);
-                            }
-                            HX_RELEASE(pVolume);
-                        }
-                        HX_RELEASE(pAudioPlayer);
-                    }
-                }
-                else
-                {
-                    STDOUT("Volume value must be less than or equal to 100.\n");
-                }
-            }
-            else if (ulLen > 1 && 's' == ch0)
-            {
-                // Seek commands are in the form sXXXX where XXXX is the 
-                // time in ms to seek to
-                const char* pszSeekTime = pszCmdBuffer + 1;
-                UINT32      ulSeekTime  = (UINT32) atol(pszSeekTime);
-                // Seek the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    STDOUT("Seeking the first player to %lu\n", ulSeekTime);
-                    // First pause the player
-                    GetGlobal()->g_Players[0]->Pause();
-                    GetGlobal()->g_Players[0]->Seek(ulSeekTime);
-                    GetGlobal()->g_Players[0]->Begin();
-                }
-            }
-            else if (ulLen > 2 && 'q' == ch0 && 's' == ch1)
-            {
-                // Quick-Seek commands are in the form qsXXXX where XXXX is the 
-                // time in ms to seek to
-                const char* pszSeekTime = pszCmdBuffer + 2;
-                UINT32      ulSeekTime  = (UINT32) atol(pszSeekTime);
-                // Seek the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    STDOUT("Quick-seeking the first player to %lu\n", ulSeekTime);
-                    GetGlobal()->g_Players[0]->Seek(ulSeekTime);
-                }
-            }
-            else if (ulLen > 2 && 'm' == ch0 && 's' == ch1)
-            {
-                // Multi-Seek commands are in the form msXXX,YYY,...,ZZZ where XXX,
-                // YYY, and ZZZ are times to seek to.
-                UINT32      ulNumSeekTimes = 0;
-                const char* pszSeekTime    = pszCmdBuffer + 2;
-                char*       pszToken       = strtok((char*) pszSeekTime, ",");
-                while (pszToken && ulNumSeekTimes < HX_MAX_NUM_MULTI_SEEKS)
-                {
-                    GetGlobal()->g_ulMultiSeekTime[ulNumSeekTimes++] = (UINT32) atol(pszToken);
-                    pszToken = strtok(NULL, ",");
-                }
-                // Seek the FIRST player only
-                if (GetGlobal()->g_nPlayers >= 1)
-                {
-                    GetGlobal()->g_ulNumMultiSeeks  = ulNumSeekTimes;
-                    GetGlobal()->g_ulMultiSeekIndex = 0;
-                    GetGlobal()->g_bMultiSeek       = (ulNumSeekTimes > 1 ? TRUE : FALSE);
-                    STDOUT("Multi-seeking the first player to %lu\n",
-                           GetGlobal()->g_ulMultiSeekTime[GetGlobal()->g_ulMultiSeekIndex]);
-                    GetGlobal()->g_Players[0]->Seek(GetGlobal()->g_ulMultiSeekTime[GetGlobal()->g_ulMultiSeekIndex++]);
-                }
-            }
-#if defined(HELIX_FEATURE_VIDEO)
-            else if (ulLen >= 3  &&  'f' == ch0  &&  's' == ch1)
-            {
-                // Get the site
-                IHXSiteFullScreen* pSite = NULL;
-                HX_RESULT rv = GetFullScreenSite(GetGlobal()->g_Players[0], pSite);
-                if (SUCCEEDED(rv))
-                {
-                    // Are we coming or going from full-screen?
-                    if (pszCmdBuffer[2] == '+')
-                    {
-                        pSite->EnterFullScreen();
-                    }
-                    else if (pszCmdBuffer[2] == '-')
-                    {
-                        pSite->ExitFullScreen();
-                    }
-                }
-                HX_RELEASE(pSite);
-            }
-#if defined(HELIX_FEATURE_PNG)
-            else if (ulLen >= 1 && 'c' == ch0)
-            {
-                IHXPlayer* pPlayer0 = GetGlobal()->g_Players[0];
-                ExampleClientContext*  pExContext=NULL;
-                ExampleSiteSupplier*   pExSiteSupplier=NULL;
-
-                if (pPlayer0 && HXR_OK == pPlayer0->GetClientContext((IUnknown*&)pExContext) && 
-                    pExContext && HXR_OK == pExContext->QueryInterface(IID_IHXSiteSupplier, (void**)&pExSiteSupplier) && 
-                    pExSiteSupplier)
-                {
-                        CHXString pszFileName;
-                        INT32 dWidth=0, dHeight=0;
-
-                        // Image size 
-                        char* strXY;
-                        if (strXY=strchr((char*) pszCmdBuffer, ','))
-                        {
-                            *(strXY++) = '\0';
-                        }
-
-                        // File name
-                        char* strC=(char*)pszCmdBuffer+1;
-                        while (strC && isspace(*strC))
-                        {
-                            strC++;
-                        }
-
-                        if (*strC == '\0')
-                        {
-                            pszFileName = "image.png";
-                        }
-                        else
-                        {
-                            pszFileName = strC;
-                        }
-
-                        if (!strXY || *strXY == '\0' || sscanf(strXY, "%ld,%ld", &dWidth, &dHeight) != 2)
-                        {
-                            // Default to the size of the image source
-                            dWidth = 0;
-                            dHeight = 0;
-                        }
-
-                        // Call capture on the site
-                        HX_RESULT rv = pExSiteSupplier->CaptureImage(pszFileName, dWidth, dHeight);
-                        if (rv == HXR_RETRY)
-                        {
-                                STDOUT("Capture failed with HXR_RETRY.\n");
-                        }
-                        else if (rv != HXR_OK)
-                        {
-                                STDOUT("ERROR: Capture failed.\n");
-                        }
-                }
-                HX_RELEASE(pExContext);
-                HX_RELEASE(pExSiteSupplier);
-            }
-#endif /* #if defined(HELIX_FEATURE_PNG) */
-#endif /* #if defined(HELIX_FEATURE_VIDEO) */
-#if defined(HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION)
-            else if (2 <= ulLen  &&  'p' == ch0  &&  'f' == ch1)
-            {
-                // Get the P.F.Manager from the FIRST player:
-                IHXPresentationFeatureManager* pPFMgr = NULL;
-                IHXPlayer* pPlayer0 = GetGlobal()->g_Players[0];
-                if (pPlayer0)
-                {
-                    //  Go past whitespace after the "pf" and see if there's anything else:
-                    const char* pszPFName = pszCmdBuffer+2;
-                    while (*pszPFName  &&  isspace(*pszPFName))
-                    {
-                        pszPFName++;
-                    }
-
-                    HX_RESULT hxr = pPlayer0->QueryInterface(IID_IHXPresentationFeatureManager,
-                                                (void**)&pPFMgr);
-
-                    if ('\0' == *pszPFName) //  Then it's just "pf", so show all PFs' data:
-                    {
-                        STDOUT("Player[0]'s presentation features:\n");
-                        HXBOOL bHasAtLeastOnePF = FALSE;
-                        if (SUCCEEDED(hxr))
-                        {
-                            //  Get all the presentation features:
-                            IHXValues* pFeatures = NULL;
-                            hxr = pPFMgr->GetPresentationFeatures(pFeatures);
-                            if (SUCCEEDED(hxr))
-                            {
-                                //  Look at all PF options from PFS.[PF] registry:
-                                const char* pszPFName = NULL;
-                                UINT32 ulRegID = 0;
-
-                                HX_RESULT hxrGetProp = pFeatures->GetFirstPropertyULONG32(pszPFName,
-                                        ulRegID);
-                                while (SUCCEEDED(hxrGetProp))
-                                {
-                                    HX_ASSERT(*pszPFName  &&  strlen(pszPFName) >
-                                            strlen(PRESENTATION_FEATURE_SELECTION_REGISTRY_PREFIX)+1);
-                                    if (!(*pszPFName)  ||  strlen(pszPFName) <=
-                                            strlen(PRESENTATION_FEATURE_SELECTION_REGISTRY_PREFIX)+1)
-                                    {
-                                        //  Shouldn't be empty string and should
-                                        // have more bytes than just "PFS." :
-                                        hxr = HXR_UNEXPECTED;
-                                        STDOUT("\t(PF name \"%s\" as stored in the player registry is not valid)\n", pszPFName);
-                                        break;
-                                    }
-                                    else
-                                    {
-                                        bHasAtLeastOnePF = TRUE;
-
-                                        const char* pszPFNameNoPrefix =
-                                                pszPFName + 1 + strlen(
-                                                PRESENTATION_FEATURE_SELECTION_REGISTRY_PREFIX);
-
-                                        DumpPFdata(pPFMgr, pszPFNameNoPrefix);
-                                    }
-
-                                    hxrGetProp = pFeatures->GetNextPropertyULONG32(pszPFName,
-                                        ulRegID);
-
-                                } //  end "while (SUCCEEDED(hxrGetProp))".
-
-                            }
-
-                            if (!bHasAtLeastOnePF)
-                            {
-                                STDOUT("\t<none>\n");
-                            }
-
-                            STDOUT("\n");
-
-                            HX_RELEASE(pFeatures);
-                        }
-                    } //  End ...it's just "pf"...
-                    //  else it's either just "pf {PFname}" or it's
-                    // "pf {PFname} {PFvalue}" where both name and value must
-                    // each be an already-known and selectable quantity. 
-                    // PFvalue can be anything if the PF's options are
-                    // "freeform" (i.e., open-ended):
-                    else
-                    {
-                        CHXString strPFName = pszPFName;
-                        //  Now, find the {PFvalue}:
-                        const char* pszPFValue = pszPFName+1;
-                        while (*pszPFValue  &&  !isspace(*pszPFValue))
-                        {
-                            pszPFValue++;
-                        }
-                        //  we've found the end of the PFName:
-                        strPFName.SetAt(pszPFValue - pszPFName,'\0');
-
-                        //  Jump past the whitespace between:
-                        while (*pszPFValue  &&  isspace(*pszPFValue))
-                        {
-                            pszPFValue++;
-                        }
-
-                        //  If there was no {PFValue} specified, then just
-                        // show the PF's info:
-                        if ('\0' == *pszPFValue)
-                        {
-                            hxr = DumpPFdata(pPFMgr, pszPFName);
-                        }
-                        //  Else set the PF's current value as specified:
-                        else
-                        {
-                            IHXMediaPlatform* pMediaPlatform = GetGlobal()->pMediaPlatform;
-                            IHXCommonClassFactory* pCCF = NULL;
-                            hxr = pMediaPlatform? HXR_OK : HXR_UNEXPECTED;
-                            if (pMediaPlatform)
-                            {
-                                hxr = pMediaPlatform->QueryInterface(IID_IHXCommonClassFactory,
-                                                                     (void**)&pCCF);
-                                if (SUCCEEDED(hxr))
-                                {                                    
-                                    IHXBuffer*  /*IN*/ pPFNewCurrentSetting = NULL;
-                                    if (SUCCEEDED(CreateAndSetBufferCCF(
-                                            pPFNewCurrentSetting,
-                                            (BYTE*)pszPFValue,
-                                            strlen(pszPFValue)+1, pCCF)) )
-                                    {
-                                        pszPFName = (const char*)strPFName;
-                                        hxr = pPFMgr->SetPresentationFeatureValue(
-                                                pszPFName, pPFNewCurrentSetting);
-                                        STDOUT("\n");
-
-                                        if (HXR_PROP_INACTIVE == hxr)
-                                        {
-                                            STDOUT("Can not set PF \"%s\" to \"%s\"; that option is currently disabled.\n",
-                                                    pszPFName, pszPFValue);
-                                            hxr = DumpPFdata(pPFMgr, (const char*)strPFName);
-                                        }
-                                        else if (HXR_PROP_NOT_FOUND == hxr)
-                                        {
-                                            STDOUT("\"%s\" PF not found.\n",
-                                                    pszPFName, pszPFValue);
-                                        }
-                                        else if (HXR_INVALID_PARAMETER == hxr)
-                                        {
-                                            STDOUT("\"%s\" PF's option: \"%s\" not found.\n",
-                                                    pszPFName, pszPFValue);
-                                            hxr = DumpPFdata(pPFMgr, pszPFName);
-                                        }
-                                    }
-
-                                    HX_RELEASE(pPFNewCurrentSetting);
-                                }
-                            }
-
-                            HX_RELEASE(pCCF);
-                        }
-                    }
-                }
-
-                HX_RELEASE(pPFMgr);
-            }
-#endif //  HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION.
-
-            STDOUT("\n");
-
-            //  Copy the command buffer into the prior-command buffer:
-            char* pszPriorCmdBuffer = (char*) GetGlobal()->g_szPriorCommandBuffer;
-            memcpy((void*) pszPriorCmdBuffer, (void*) pszCmdBuffer, HX_COMMAND_BUFFER_SIZE);
-
-            // Clear the command buffer
-            memset((void*) pszCmdBuffer, 0, HX_COMMAND_BUFFER_SIZE);
-        }
-        else
-        {
-            // Add this character to the command buffer (if there's room)
-            char*  pszCmdBuffer = (char*) GetGlobal()->g_szCommandBuffer;
-            UINT32 ulLen        = strlen(pszCmdBuffer);
-            if (ulLen < HX_COMMAND_BUFFER_SIZE - 1)
-            {
-                //  If this is a 'tab' and nothing is in the buffer yet, then
-                // display the prior command as already-written text:
-                if ('\t' == ch  &&  0 == ulLen)
-                {
-                    const char* pszPriorCmdBuffer = (char*) GetGlobal()->g_szPriorCommandBuffer;
-                    memcpy((void*) pszCmdBuffer, (void*) pszPriorCmdBuffer, HX_COMMAND_BUFFER_SIZE);
-                    STDOUT("\n%s", pszCmdBuffer);
-                }
-                else if ('\b' == ch) //  Backspace, so back up buffer
-                {
-                    if (ulLen > 0) // (else ignore it)
-                    {
-                        pszCmdBuffer[ulLen-1] = '\0';
-                        UINT32 ulNumBkspaces = ulLen;
-                        while (--ulNumBkspaces)
-                        {
-                            STDOUT("\b");
-                        }
-                        // Space to clear the end char & then back up the cursor:
-                        STDOUT("%s \b", pszCmdBuffer);
-                    }
-                }
-                else
-                {
-                    // Add the character
-                    pszCmdBuffer[ulLen] = ch;
-                }
-            }
-        }
-    }
-}
-
-
-
-/*
- *  handle events for at most nTimeDelta milliseconds
- */
-void DoEvents(int nTimeDelta)
-{
-#if defined(_WINDOWS)
-    MSG msg;
-    DWORD starttime, endtime, i;
-    HXBOOL sleep = TRUE;
-    static const int checkinterval = 10;
-
-    starttime = GetTickCount();
-    endtime = starttime + (nTimeDelta);
-    i = 0;
-    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
-    {
-        DispatchMessage(&msg);
-        if ((i % checkinterval) == 0)
-        {
-            if (GetTickCount() > endtime)
-                break;
-            ++i;
-        }
-        sleep = FALSE;
-    }
-    if (sleep)
-        Sleep(SLEEP_TIME);
-
-#else
-    DoEvent();
-#endif
-}
-
-/*
- *  return the number of milliseconds since the epoch
- */
-UINT32 GetTime()
-{
-#if defined (_WINDOWS) || defined(__TCS__)
-    return (UINT32)GetTickCount();
-
-#elif defined (_VXWORKS)
-    HXTime t;
-    gettimeofday(&t, NULL);
-    return (UINT32)((t.tv_sec * 1000) + (t.tv_usec / 1000));
-
-#elif defined (_UNIX) || defined(_SYMBIAN) || defined(_MAC_UNIX)
-    timeval t;
-    gettimeofday(&t, NULL);
-    return (UINT32)((t.tv_sec * 1000) + (t.tv_usec / 1000));
-
-#elif defined (_MACINTOSH)
-
-    unsigned long long     micro_now;
-
-    Microseconds((UnsignedWide*)&micro_now);
-    return micro_now / 1000L;
-#endif
-}
-
-#ifdef _UNIX
-
-struct termios g_orig_termios;
-bool g_orig_termios_set = false;
-
-void SetupTerminal(void)
-{
-    int result;
-    
-    result = tcgetattr(0, &g_orig_termios);
-    if(result == 0)
-    {
-        // Sets terminal to cbreak mode
-        struct termios cbreak_termios;
-
-        g_orig_termios_set = true;
-        cbreak_termios = g_orig_termios;
-
-        cbreak_termios.c_lflag &= ~(ICANON);
-        cbreak_termios.c_cc[VMIN] = 1;
-        cbreak_termios.c_cc[VTIME] = 0;
-        tcsetattr(0, TCSANOW, &cbreak_termios);
-    }
-}
-
-void RestoreTerminal(void)
-{
-    // Restores terminal to normal mode
-    if(g_orig_termios_set)
-    {
-        tcsetattr(0, TCSANOW, &g_orig_termios);        
-    }    
-}
-
-#endif
-
-
-
-#if defined(_SYMBIAN) && defined(_ARM)
-//XXXGfw get rid of this...
-extern "C"
-{
-    void __gccmain()
-    {
-    }
-};
-#endif
-
-char* RemoveWrappingQuotes(char* str)
-{
-    int len = strlen(str);
-    if (len > 0)
-    {
-        if (str[len-1] == '"') str[--len] = 0;
-        if (str[0] == '"') { int i = 0; do { str[i++] = str[i+1]; } while(--len); }
-    }
-    return str;
-}
-
-#ifdef __TCS__
-extern  "C"     int helixmain( int argc, char *argv[] )
-#else
-    int main( int argc, char *argv[] )
-#endif
-{
-#if defined(_WIN32) && !defined(WIN32_PLATFORM_PSPC)
-    setvbuf(stdout, NULL, _IONBF, 0);
-#endif /* defined(_WIN32) && !defined(WIN32_PLATFORM_PSPC) */
-
-    FPHXMEDIAPLATFORMOPEN   fpHXMediaPlatformOpen   = NULL;
-    FPHXCREATEMEDIAPLATFORM fpHXCreateMediaPlatform = NULL;
-    FPHXMEDIAPLATFORMCLOSE  fpHXMediaPlatformClose  = NULL;
-
-    FPRMCREATEENGINE        fpCreateEngine          = NULL;
-    FPRMCLOSEENGINE         fpCloseEngine           = NULL;
-    FPRMSETDLLACCESSPATH    fpSetDll                = NULL;
-
-    HX_RESULT               theErr                  = HXR_OK;
-    ExampleClientContext**  ppExContexts            = NULL;
-#if defined(HELIX_FEATURE_AUTO_BANDWIDTH_DETECTION) && defined(_WIN32)
-    ExampleABD*             pABD                    = NULL;
-#endif
-    IHXPlayer**             ppPlayers               = NULL;
-    IHXQuickSeek*           ppQuickSeek             = NULL;
-    IHXErrorSink*           pErrorSink              = NULL;
-    IHXErrorSinkControl*    pErrorSinkControl       = NULL;
-    UINT32                  ulABDResult             = 0;
-    UINT32                  ulProbPktSize           = 0;
-    UINT32                  ulProbPktNum            = 0;
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-    INT32                   lVelocity               = 100;
-    INT32                   lKeyFrameMode           = 0;
-    INT32                   lAutoSwitch             = 0;
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
-    CHXString*              pABDServer              = NULL;
-    char*                   pszURL[MAX_NUM_URLS];
-    char*                   pszURLOrig[MAX_NUM_URLS];
-    UINT32                  ulNumURLsFound          = 0;
-    int                     nNumPlayers             = 1;
-    int                     nNumPlayRepeats         = 1;
-    int                     nTimeDelta              = DEFAULT_TIME_DELTA;
-    int                     nStopTime               = DEFAULT_STOP_TIME;
-    bool                    bStopTime               = true;
-    int                     i                       = 0;
-    char*                   pszGUIDList             = NULL;
-#ifdef _MACINTOSH
-    char                    dllhome[MAX_PATH]       = {'\0'}; /* Flawfinder: ignore */
-#elif defined(_SYMBIAN)
-    char                    dllhome[MAX_PATH]       = "c:"; /* Flawfinder: ignore */
-#else
-    char                    dllhome[MAX_PATH]       = {'.','\0'}; /* Flawfinder: ignore */
-#endif
-    DLLAccess*              pDLLAccess              = NULL;
-    char                    staticLibPath[MAX_PATH] = {0}; /* Flawfinder: ignore */
-#ifdef _WINDOWS
-    HINSTANCE               hDll                    = NULL;
-#endif
-    bool                    bStopping = false;
-    int                     nPlay = 0;
-#if defined(HELIX_FEATURE_PREFERENCES)
-    CHXPrefList             prefList;
-#endif /* #if defined(HELIX_FEATURE_PREFERENCES) */
-
-    // NULL out the URL arrays
-    memset(pszURL, 0, MAX_NUM_URLS * sizeof(char*));
-    memset(pszURLOrig, 0, MAX_NUM_URLS * sizeof(char*));
+    // NULL out the URL arrays
+    memset(pszURL, 0, MAX_NUM_URLS * sizeof(char*));
+    memset(pszURLOrig, 0, MAX_NUM_URLS * sizeof(char*));
 
 
     //See if the user has set their HELIX_LIBS env var. This is overridden by the
     //-l option.
     const char* pszHelixLibs = getenv("HELIX_LIBS");
     if( pszHelixLibs )
-        SafeStrCpy( dllhome,  pszHelixLibs, MAX_PATH);
-
-
-#ifdef _MACINTOSH
-    // on the Mac, look beside the application for its DLLs
-    // for now. If we wanted to look elsewhere we'd need to set dllhome
-    // appropriately, with colon-delimited paths.
-
-    // strcpy(dllhome, "Macintosh HD:helix:clientapps:simpleplayer:debug");
-#endif
-
-#if defined(_MAC_UNIX)
-	if (!pszHelixLibs)
-	{
-		CFBundleRef mainBundle;
-		CFURLRef mainBundleURL;
-		CFURLRef updirURL;
-		
-		// get the main bundle for the app
-		mainBundle = ::CFBundleGetMainBundle();
-		
-		// look for a resource in the main bundle by name
-		mainBundleURL = ::CFBundleCopyBundleURL( mainBundle );
-		updirURL = ::CFURLCreateCopyDeletingLastPathComponent(NULL, mainBundleURL);
-		
-		CFStringRef urlString = CFURLCopyPath(updirURL);
-		CFStringGetCString(urlString, dllhome, _MAX_PATH, kCFStringEncodingMacRoman);
-		
-		::CFRelease(updirURL);
-		::CFRelease(mainBundleURL);
-		::CFRelease(urlString);
-	}
-#endif	// _MAC_UNIX
-
-#if defined(_WINDOWS) && defined(_STATICALLY_LINKED)
-    g_hInstance = GetModuleHandle(NULL);
-#endif
-
-#ifdef _MACINTOSH
-#ifndef _MAC_MACHO
-    argc = ccommand( &argv );
-    SIOUXSettings.standalone     = FALSE;
-    SIOUXSettings.setupmenus     = FALSE;
-    SIOUXSettings.showstatusline = TRUE;
-#endif
-#endif
-
-#ifdef __TCS__
-    bEnableAdviceSink = TRUE;
-#endif
-
-#ifdef _UNIX
-#ifndef ANDROID
-    // Set the terminal to cbreak mode so that splay terminal commands work
-    SetupTerminal();
-#endif
-#endif
-    
-    for (i = 1; i < argc; i++)
-    {
-        if (0 == stricmp(argv[i], "-legacy"))
-        {
-            GetGlobal()->bUseLegacyAPIs = TRUE;
-        }
-        else if (0 == stricmp(argv[i], "-a"))
-        {
-            GetGlobal()->bEnableAdviceSink = TRUE;
-        }
-        else if (0 == stricmp(argv[i], "-s"))
-        {
-            GetGlobal()->bEnableVerboseMode = TRUE;
-        }
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-        else if (0 == strncmp(argv[i], "-v", 2))
-        {
-            // This is a command to set the velocity
-            if (sscanf(argv[i]+2, "%ld,%ld,%ld", &lVelocity, &lKeyFrameMode, &lAutoSwitch) != 3)
-            {
-                fprintf(stderr, "Set velocity command is \"vX,Y,Z\" where:\n"
-                            "      X   is the velocity in integer percent of normal playback speed,\n"
-                            "      Y   is 0 for keyframe mode = FALSE or 1 for keyframe mode = TRUE,\n"
-                            "      Z   is 0 for autoswitch = FALSE or 1 for autoswitch = TRUE\n");
-                return -1;
-            }
-        }
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
-        else if (0 == stricmp(argv[i], "-iss"))
-        {
-            GetGlobal()->g_bEnableSlowStart = FALSE;
-        }
-        else if (0 == stricmp(argv[i], "-0"))
-        {
-            GetGlobal()->g_bNullRender = TRUE;
-        }
-        else if (0 == stricmp(argv[i], "-abd"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -abd option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-
-            int n = 0;
-            char* pszToken = strtok(argv[i], ",");
-            while (pszToken)
-            {
-                switch (n)
-                {
-                   case 0:
-                       pABDServer = new CHXString(pszToken);
-                       pABDServer->TrimLeft();
-                       pABDServer->TrimRight();
-                       break;
-                   case 1:
-                       ulProbPktSize = atoi(pszToken);
-                       break;
-                   case 2:
-                       ulProbPktNum = atoi(pszToken);
-                       break;
-                   default:
-                       break;
-                }
-
-                n++;
-                pszToken = strtok(NULL, ",");
-            }
-            GetGlobal()->g_bABD = TRUE;
-        }
-        else if (0 == stricmp(argv[i], "-n"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -n option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            nNumPlayers = atoi(argv[i]);
-            if (nNumPlayers < 1)
-            {
-                STDOUT("\nError: Invalid value for -n option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-        }
-        else if (0 == stricmp(argv[i], "-rn"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -rn option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            nNumPlayRepeats = atoi(argv[i]);
-            if (nNumPlayRepeats < 1)
-            {
-                STDOUT("\nError: Invalid value for -rn option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-        }
-        else if (0 == stricmp(argv[i], "-t"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -t option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            nTimeDelta = atoi(argv[i]);
-            if (nTimeDelta < 0)
-            {
-                STDOUT("\nError: Invalid value for -t option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-        }
-        else if (0 == stricmp(argv[i], "-st"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -st option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            nStopTime = atoi(argv[i]);
-            if (nStopTime < 0)
-            {
-                STDOUT("\nError: Invalid value for -st option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-        }
-#if defined _DEBUG || defined DEBUG
-        else if (0 == stricmp(argv[i], "-d"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -d option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            debug_level() = (int)strtoul(argv[i], 0, 0);
-        }
-#endif
-        else if (0 == stricmp(argv[i], "-u"))
-        {
-            GetGlobal()->g_pszUsername = new char[1024];
-            strcpy(GetGlobal()->g_pszUsername, ""); /* Flawfinder: ignore */
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -u option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            SafeStrCpy(GetGlobal()->g_pszUsername,  argv[i], 1024);
-        }
-        else if (0 == stricmp(argv[i], "-p"))
-        {
-            GetGlobal()->g_pszPassword = new char[1024];
-            strcpy(GetGlobal()->g_pszPassword, ""); /* Flawfinder: ignore */
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -p option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            SafeStrCpy(GetGlobal()->g_pszPassword,  argv[i], 1024);
-        }
-        else if (0 == stricmp(argv[i], "-g"))
-        {
-            GetGlobal()->g_pszGUIDFile = new char[1024];
-            strcpy(GetGlobal()->g_pszGUIDFile, ""); /* Flawfinder: ignore */
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -g option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            SafeStrCpy(GetGlobal()->g_pszGUIDFile, RemoveWrappingQuotes(argv[i]), 1024);
-            if (!ReadGUIDFile())
-            {
-                STDOUT("\nError: Unable to read file specified by -g option.\n\n");
-                return -1;
-            }
-        }
-        else if (0 == stricmp(argv[i], "-l"))
-        {
-            if (++i == argc)
-            {
-                STDOUT("\nError: Invalid value for -l option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-            SafeStrCpy(dllhome, RemoveWrappingQuotes(argv[i]), MAX_PATH);
-        }
-#if defined(HELIX_FEATURE_PREFERENCES)
-        else if (0 == stricmp(argv[i], "-pref"))
-        {
-            if (i + 2 >= argc)
-            {
-                STDOUT("\nError: Invalid value for -pref option.\n\n");
-                PrintUsage(GetAppName(argv[0]));
-                return -1;
-            }
-
-            prefList.Add(argv[i + 1], argv[i + 2]);
-
-            i += 2;
-        }
-#endif /* #if defined(HELIX_FEATURE_PREFERENCES) */
-        else if (ulNumURLsFound < MAX_NUM_URLS)
-        {
-            pszURLOrig[ulNumURLsFound] = RemoveWrappingQuotes(argv[i]);
-
-            //if no "://" was found lets add file:// by default so that you
-            //can refer to local content as just ./splay ~/Content/startrek.rm,
-            //for example, and not ./splay file:///home/gregory/Content/startrek.rm
-            char* pszAddOn = NULL;
-            if( strstr( pszURLOrig[ulNumURLsFound], "://") )
-                pszAddOn = "";
-            else
-                pszAddOn = "file://";
-
-            pszURL[ulNumURLsFound] = new char[strlen(pszURLOrig[ulNumURLsFound])+strlen(pszAddOn)+1];
-            sprintf( pszURL[ulNumURLsFound], "%s%s", pszAddOn, pszURLOrig[ulNumURLsFound] ); /* Flawfinder: ignore */
-            // Increment the number of URLs we have found
-            ulNumURLsFound++;
-        }
-        else
-        {
-            PrintUsage(GetAppName(argv[0]));
-            return -1;
-        }
-    }
-
-    if (!ulNumURLsFound && !GetGlobal()->g_bABD)
-    {
-        if (argc > 1)
-        {
-            STDOUT("\nError: No media file or URL was specified.\n\n");
-        }
-        PrintUsage(GetAppName(argv[0]));
-        return -1;
-    }
-    else if (ulNumURLsFound > 1 && ((int) ulNumURLsFound) != nNumPlayers)
-    {
-        STDOUT("\nError: Number of URLs found doesn't match number of players specified.\n\n");
-        PrintUsage(GetAppName(argv[0]));
-        return -1;
-    }
-    else if (ulNumURLsFound == 1 && nNumPlayers > 1)
-    {
-        // Just copy the URLS - play all the same
-        // thing for each player
-        UINT32 ulLen = strlen(pszURL[0]) + 1;
-        for (i = 1; i < nNumPlayers; i++)
-        {
-            pszURL[i] = new char [ulLen];
-            if (pszURL[i])
-            {
-                strcpy(pszURL[i], pszURL[0]);
-            }
-        }
-    }
-
-
-#if defined (_STATICALLY_LINKED)
-    // Load "clntcore" by default
-    SafeSprintf(staticLibPath, MAX_PATH, "%s", "clntcore");
-#else
-#  if defined(_MAC_UNIX)
-    SafeSprintf(staticLibPath, MAX_PATH, "%s/%s", dllhome, "hxmedpltfm.bundle");
-#  elif defined(_UNIX)
-    SafeSprintf(staticLibPath, MAX_PATH, "%s/%s", dllhome, "hxmedpltfm.so");
-#  elif defined(_WINDOWS) || defined(_SYMBIAN)
-    SafeSprintf(staticLibPath, MAX_PATH, "%s\\%s", dllhome, "hxmedpltfm.dll");
-#  elif defined(_MACINTOSH)
-#ifdef _MAC_MACHO
-    SafeSprintf(staticLibPath, MAX_PATH, "clntcore.bundle");
-#else
-    if (strlen(dllhome) > 0 )
-    {
-        SafeSprintf(staticLibPath, MAX_PATH, "%s:%s", dllhome, "clntcore.shlb");
-    }
-    else
-    {
-        SafeSprintf(staticLibPath, MAX_PATH, "%s", "clntcore.shlb");
-    }
-#endif
-#  endif
-#endif
-
-	if (dllhome)
-    {
-        GetDLLAccessPath()->SetPath(DLLTYPE_COMMON, dllhome);
-        GetDLLAccessPath()->SetPath(DLLTYPE_PLUGIN, dllhome);
-        GetDLLAccessPath()->SetPath(DLLTYPE_CODEC, dllhome);
-    }
-	
-    // Allocate arrays to keep track of players and client
-    // context pointers
-    ppExContexts = new ExampleClientContext*[nNumPlayers];
-    ppPlayers    = new IHXPlayer*[nNumPlayers];
-
-    if (!ppExContexts || !ppPlayers)
-    {
-        if (nNumPlayers > 10)
-        {
-            STDOUT("Error: Out of Memory. Perhaps you are trying to launch too many players at once.\n");
-        }
-        else
-        {
-            STDOUT("Error: Out of Memory.\n");
-        }
-        theErr = HXR_UNEXPECTED;
-        goto cleanup;
-    }
-
-    for (i = 0; i < nNumPlayers; i++)
-    {
-        ppPlayers[i] = NULL;
-
-        ppExContexts[i] = new ExampleClientContext(i);
-        if (!ppExContexts[i])
-        {
-            if (nNumPlayers > 10)
-            {
-                STDOUT("Error: Out of Memory. Perhaps you are trying to launch too many players at once.\n");
-            }
-            else
-            {
-                STDOUT("Error: Out of Memory.\n");
-            }
-            theErr = HXR_UNEXPECTED;
-            goto cleanup;
-        }
-        ppExContexts[i]->AddRef();
-    }
+        SafeStrCpy( dllhome,  pszHelixLibs, MAX_PATH);
+
+    GetGlobal()->bEnableAdviceSink = TRUE;
+    GetGlobal()->g_prefList.Add("UseOverlay", "0");
+
+    SafeSprintf(staticLibPath, MAX_PATH, "%s/%s", dllhome, "hxmedpltfm.so");
+
+    GetDLLAccessPath()->SetPath(DLLTYPE_COMMON, dllhome);
+    GetDLLAccessPath()->SetPath(DLLTYPE_PLUGIN, dllhome);
+    GetDLLAccessPath()->SetPath(DLLTYPE_CODEC, dllhome);
 
     // initialize the globals
     GetGlobal()->m_fpCreateEngine    = NULL;
     GetGlobal()->m_fpCloseEngine = NULL;
+    GetGlobal()->g_nPlayers = 0;
 
     // prepare/load the HXCore module
     pDLLAccess = new DLLAccess();
@@ -1917,15 +318,12 @@
         pErrorString = pDLLAccess->getErrorString();
         STDERR("splayer: %s\n\n", pErrorString);
 #ifndef _STATICALLY_LINKED
-#ifndef _MACINTOSH
         //Make sure the user has told us where to find the DLLs at. Either
         //with the -l option or with the HELIX_LIBS env var.
         STDERR("You must tell the player where to find the client core and\n");
         STDERR("all of its supporting DLLs and codecs. Please use the -l\n");
         STDERR("option or set your HELIX_LIBS env variable to point the player.\n");
         STDERR("to where you have all of the DLLs installed.\n\n" );
-        PrintUsage(argv[0]);
-#endif
 #endif
         goto cleanup;
     }
@@ -1949,21 +347,7 @@
         goto cleanup;
     }
 
-#if defined(USE_XWINDOWS) && defined(HELIX_FEATURE_VIDEO)
-    XInitThreads();
-#endif
     
-    if( GetGlobal()->bUseLegacyAPIs )
-    {
-        // create client engine
-        fpCreateEngine = GetGlobal()->m_fpCreateEngine;
-        if (HXR_OK != fpCreateEngine((IHXClientEngine**) &GetGlobal()->pEngine))
-        {
-            theErr = HXR_FAILED;
-            goto cleanup;
-        }
-    }
-    else
     {
         fpHXMediaPlatformOpen = GetGlobal()->m_fpHXMediaPlatformOpen;
         fpHXCreateMediaPlatform = GetGlobal()->m_fpHXCreateMediaPlatform;
@@ -2017,47 +401,65 @@
         pMediaPlatform->QueryInterface(IID_IHXMediaPlatformKicker, (void**)&pKicker);
         HX_ASSERT(pKicker);
         GetGlobal()->g_pIHXKicker = pKicker;
+        GetGlobal()->g_uThreadIDForKicker = HXGetCurrentThreadID();
 
+        pthread_t thread_id;
+        pthread_create(&thread_id, NULL, kickman, NULL);
+        GetGlobal()->g_pThreadKickmanId = thread_id;
     }
 
-    // create players
-    for (i = 0; i < nNumPlayers; i++)
-    {
-        IHXClientEngine* pEngine = GetGlobal()->pEngine;
-        if (HXR_OK != pEngine->CreatePlayer(ppPlayers[i]))
-        {
-            theErr = HXR_FAILED;
-            goto cleanup;
-        }
-    }
+    return HXR_OK;
 
+cleanup:
+    deinit_main();
+    return HXR_FAIL;
+}
 
-#if defined(HELIX_FEATURE_AUTO_BANDWIDTH_DETECTION) && defined(_WIN32)
-    // perform ABD if requested
-    if (GetGlobal()->g_bABD)
+/* Get the least index to available entry in Getglobal()->gPlayers */
+static int get_index()
     {
-        IHXClientEngine* pEngine = GetGlobal()->pEngine;
+    int i;
+    /* an simple implementation */
+    for (i = 0; i < MAX_NUM_PLAYERS; i++)
+    {
+        if (GetGlobal()->g_Players[i] == NULL) 
+            return i;
+    }
 
-        pABD = new ExampleABD((IUnknown*)(IHXClientEngine*)GetGlobal()->pEngine);
-        pABD->AddRef();
+    return -1;
+}
 
-        if (HXR_OK == pABD->DoABD((const char*)*pABDServer, 1, ulProbPktSize, ulProbPktNum))
+PLAYER_API unsigned int get_curr_playtime(void *pPlayerHandle)
         {
-            ulABDResult = pABD->GetABD();
+    unsigned int time = 0;
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    if (pPlayer)
+        time = pPlayer->GetCurrentPlayTime();
+    return time;
         }
         
-        HX_RELEASE(pABD);
+PLAYER_API int get_player(void **ppPlayerHandle, PlayerCallbacks *pCallbacks, void *context)
+{
+    int index = get_index();
+    IHXPlayer **ppPlayer = (IHXPlayer **)ppPlayerHandle;
+    CHXClientContext*  pExContext       = NULL;
+    pExContext = new CHXClientContext(index);
+    if (!pExContext)
+    {
+        return HXR_UNEXPECTED;
     }
+    pExContext->AddRef();
 
-    if (!ulNumURLsFound)
+    ppPlayer[0] = NULL;
+    IHXClientEngine* pEngine = GetGlobal()->pEngine;
+    if (HXR_OK != pEngine->CreatePlayer(*ppPlayer))
     {
-        goto cleanup;
+        HX_RELEASE(pExContext);
+        return HXR_FAILED;
     }
-#endif
-
+    char*                   pszGUIDList             = NULL;
     //initialize the example context
     pszGUIDList = GetGlobal()->g_pszGUIDList;
-    for (i = 0; i < nNumPlayers; i++)
     {
         char pszGUID[GUID_LEN + 1]; /* Flawfinder: ignore */ // add 1 for terminator
         char* token = NULL;
@@ -2068,14 +470,9 @@
         if (pszGUIDList)
         {
             // Get next GUID from the GUID list
-            if (i == 0)
             {
                 token = strtok(pszGUIDList, "\n\0");
             }
-            else
-            {
-                token = strtok(NULL, "\n\0");
-            }
             if (token)
             {
                 strncpy(pszGUID, token, GUID_LEN); /* Flawfinder: ignore */
@@ -2083,286 +480,250 @@
             }
         }
 
-        ppPlayers[i]->QueryInterface(IID_IHXPreferences,
+        ppPlayer[0]->QueryInterface(IID_IHXPreferences,
                                      (void**) &pPreferences);
 
-        if (pPreferences && ulABDResult)
-        {
-            IHXBuffer* pValue = new CHXBuffer();
-            pValue->AddRef();
-            
-            pValue->SetSize(16);    
-            sprintf((char*)pValue->GetBuffer(), "%lu", ulABDResult * 1024); /* Flawfinder: ignore */
-            pPreferences->WritePref("Bandwidth", pValue);
+        pExContext->Init(ppPlayer[0], pPreferences, pszGUID, pCallbacks, context);
 
-            HX_RELEASE(pValue);
-        }
-
-        
-        ppExContexts[i]->Init(ppPlayers[i], pPreferences, pszGUID);
-
-        ppPlayers[i]->SetClientContext(ppExContexts[i]);
+        ppPlayer[0]->SetClientContext(pExContext);
 
         HX_RELEASE(pPreferences);
 
-        ppPlayers[i]->QueryInterface(IID_IHXErrorSinkControl,
+        IHXErrorSinkControl*    pErrorSinkControl       = NULL;
+        ppPlayer[0]->QueryInterface(IID_IHXErrorSinkControl,
                                      (void**) &pErrorSinkControl);
+
         if (pErrorSinkControl)
         {
-            ppExContexts[i]->QueryInterface(IID_IHXErrorSink,
+            IHXErrorSink*           pErrorSink              = NULL;
+            pExContext->QueryInterface(IID_IHXErrorSink,
                                             (void**) &pErrorSink);
-
             if (pErrorSink)
             {
                 pErrorSinkControl->AddErrorSink(pErrorSink, HXLOG_EMERG, HXLOG_INFO);
             }
-
             HX_RELEASE(pErrorSink);
         }
-
         HX_RELEASE(pErrorSinkControl);
+        GetGlobal()->g_prefList.SetPreferences(ppPlayer[0]);
 
-#if defined(HELIX_FEATURE_PREFERENCES)
-        prefList.SetPreferences(ppPlayers[i]);
-#endif /* #if defined(HELIX_FEATURE_PREFERENCES) */
     }
+    HX_ASSERT(GetGlobal()->g_nPlayers < MAX_NUM_PLAYERS);
+    GetGlobal()->g_Players[index] = ppPlayer[0];
+    GetGlobal()->g_pClientContexts[index] = pExContext;
+    GetGlobal()->g_nPlayers++;
 
-#if defined(HELIX_FEATURE_PREFERENCES)
-    // Clear the prefList since we don't need its values anymore
-    prefList.Clear();
-#endif /* #if defined(HELIX_FEATURE_PREFERENCES) */
+    return HXR_OK;
+}
 
-    nPlay = 0;
-    while(nPlay < nNumPlayRepeats) 
+static int get_index_by_player( IHXPlayer *pPlayer)
     {
-
-        nPlay++;
-        if (GetGlobal()->bEnableVerboseMode)
+    int i;
+    /* an simple implementation */
+    for (i = 0; i < MAX_NUM_PLAYERS; i++)
         {
-            STDOUT("Starting play #%d...\n", nPlay);
+        if (GetGlobal()->g_Players[i] && GetGlobal()->g_Players[i] == pPlayer)
+            return i;
         }
 
-        GetGlobal()->g_Players  = ppPlayers;
-        GetGlobal()->g_nPlayers = nNumPlayers;
-
-#if defined(_WIN32) && !defined(WIN32_PLATFORM_PSPC)
-        SetConsoleCtrlHandler((PHANDLER_ROUTINE)HandlerRoutine,
-                              TRUE);
-#endif
+    return -1;
+}
 
-        IHXQuickSeek* pTmp = NULL;
-        IHXPlayer* pPlayer = GetGlobal()->g_Players[0];
-        pPlayer->QueryInterface( IID_IHXQuickSeek,
-                                 (void**)&pTmp
-                                 );
-        GetGlobal()->g_pQuickSeek = pTmp;
-
-        // There is only one URL for this presentation, so open the URL
-        // for each player in the array
-        UINT32 starttime, endtime, now;
-        for (i = 0; i < nNumPlayers; i++)
+PLAYER_API int player_openurl( void *pPlayerHandle, char *pszRawURL)
         {
-            STDERR("opening %s on player %d\n", pszURL[i], i );
+    HX_RESULT ret;
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    if (!pPlayer)
+        return HXR_FAIL;
 
-            if (HXR_OK == ppPlayers[i]->OpenURL(pszURL[i]))
-            {
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-                // Set velocity, if not 100%
-                if (lVelocity != 100)
-                {
-                    STDOUT("Setting playback velocity to: %ld%%\n", lVelocity);
-                    IHXPlaybackVelocity* pPlaybackVelocity = NULL;
-                    ppPlayers[i]->QueryInterface(IID_IHXPlaybackVelocity, (void**) &pPlaybackVelocity);
-                    if (pPlaybackVelocity)
-                    { 
-                              STDOUT("Calling SetVelocity(%ld,%s,%s) in player %d\n",
-                                           lVelocity,
-                                           (lKeyFrameMode ? "TRUE" : "FALSE"),
-                                           (lAutoSwitch ? "TRUE" : "FALSE"),
-                                           i);
-                              pPlaybackVelocity->SetVelocity(lVelocity, lKeyFrameMode, lAutoSwitch);
-                    }
-                    HX_RELEASE(pPlaybackVelocity);
-                }
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
+    int index = get_index_by_player(pPlayer);
+    if (index < 0)
+        return HXR_FAIL;
 
-                if (GetGlobal()->bEnableVerboseMode)
+    char *pszURLOrig = RemoveWrappingQuotes(pszRawURL);
+
+    //if no "://" was found lets add file:// by default so that you
+    //can refer to local content as just ./splay ~/Content/startrek.rm,
+    //for example, and not ./splay file:///home/gregory/Content/startrek.rm
+    char* pszAddOn = NULL;
+    if( strstr( pszURLOrig, "://") )
+        pszAddOn = (char *)"";
+    else
+        pszAddOn = (char *)"file://";
+
+    char *pszURL = new char[strlen(pszURLOrig)+strlen(pszAddOn)+1];
+    sprintf( pszURL, "%s%s", pszAddOn, pszURLOrig ); /* Flawfinder: ignore */
+    // Increment the number of URLs we have found
+    STDERR("opening %s on player\n", pszURL);
+
+    GetGlobal()->g_pszURLs[index] = pszURL;
+    ret = pPlayer->OpenURL(pszURL);
+
+    UINT32 sleepTime = 0;
+
+    IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
+    if( pKicker )
                 {
-                    STDOUT("Starting player %d...\n", i);
+        pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
                 }
-                ppPlayers[i]->Begin();
+
+    return ret;
             }
-            starttime = GetTime();
-            endtime = starttime + nTimeDelta;
-            while (1)
-            {
-                DoEvents(nTimeDelta);
-                now = GetTime();
-                if (now >= endtime)
-                    break;
-#ifdef __TCS__
-                if (gForcePlayerToStop != 0)
-                    break;
-#endif
-#if defined(_MACINTOSH) || defined(_MAC_UNIX)
-                if (gMacPlayerIsDone)
+
+PLAYER_API int put_player( void *pPlayerHandle)
                 {
-                    break;
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    int index;
+    index = get_index_by_player(pPlayer);
+    if (index < 0)
+        return HXR_FAIL;
+
+    CHXClientContext *pClientContext = GetGlobal()->g_pClientContexts[index];
+    if (pClientContext) {
+        pClientContext->Release();
+        pClientContext = NULL;
                 }
-#endif
+
+    GetGlobal()->g_pClientContexts[index] = NULL;
+    if (pPlayer) {
+        if (GetGlobal()->pEngine) {
+            GetGlobal()->pEngine->ClosePlayer(pPlayer);
             }
+        pPlayer->Release();
+        pPlayer = NULL;
         }
+    GetGlobal()->g_Players[index] = NULL;
+    GetGlobal()->g_nPlayers--;
+    delete [] GetGlobal()->g_pszURLs[index];
+    GetGlobal()->g_pszURLs[index] = NULL;
 
-#ifdef __TCS__
-        g_Players = ppPlayers;
-        g_nPlayers = nNumPlayers;
-#endif
-
-        starttime = GetTime();
-        if (nStopTime == -1)
-        {
-            bStopTime = false;
-        }
-        else
-        {
-            endtime = starttime + nStopTime;
+    return HXR_OK;
         }
-        bStopping = false;
-        // Handle events coming from all of the players
-        while (!AllPlayersDone(nNumPlayers, ppPlayers))
-        {
-            now = GetTime();
-            if (!bStopping && bStopTime && now >= endtime)
-            {
-                // Stop all of the players, as they should all be done now
-                if (GetGlobal()->bEnableVerboseMode)
+
+PLAYER_API int player_geturl( void *pPlayerHandle, char **pszURL)
                 {
-                    STDOUT("\nEnd (Stop) time reached. Stopping all players...\n");
-                }
-                StopAllPlayers(nNumPlayers, ppPlayers);
-                bStopping = true;
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    int index = get_index_by_player(pPlayer);
+    if (index >= 0) {
+        *pszURL = GetGlobal()->g_pszURLs[index];
+        return HXR_OK;
             }
-            DoEvent();
-            if (GetGlobal()->g_bUserStop)
-            {
-                break;
+
+    return  HXR_FAIL;
             }
-#ifdef __TCS__
-            if (gForcePlayerToStop != 0)
-                break;
-#endif
-#if defined(_MACINTOSH) || defined(_MAC_UNIX)
-            if (gMacPlayerIsDone)
+
+PLAYER_API int player_begin( void *pPlayerHandle )
             {
-                break;
-            }
-#endif
-        }
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    UINT32 sleepTime = 0;
+    pPlayer->Begin();
 
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-        // Close the velocity control if we have opened it
-        // in the first player
-        if (GetGlobal()->g_bInitVelocity &&
-            GetGlobal()->g_nPlayers >= 1)
-        {
-            IHXPlaybackVelocity* pPlaybackVelocity = NULL;
-            GetGlobal()->g_Players[0]->QueryInterface(IID_IHXPlaybackVelocity,
-                                                      (void**) &pPlaybackVelocity);
-            if (pPlaybackVelocity)
-            {
-                STDOUT("Closing playback velocity in first player\n");
-                pPlaybackVelocity->CloseVelocityControl();
-                GetGlobal()->g_bInitVelocity = FALSE;
+    IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
+    if( pKicker )
+    {
+        pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
             }
-            HX_RELEASE(pPlaybackVelocity);
+    return HXR_OK;
         }
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
 
-        // Stop all of the players, as they should all be done now
-        if (GetGlobal()->bEnableVerboseMode)
+PLAYER_API int player_pause( void *pPlayerHandle )
         {
-            if (GetGlobal()->g_bUserStop)
-            {
-                STDOUT("\nUser stopped playback. Stopping all players...\n");
-            }
-            else
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    UINT32 sleepTime = 0;
+    pPlayer->Pause();
+
+    IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
+    if( pKicker )
             {
-                STDOUT("\nPlayback complete. Stopping all players...\n");
+        pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
             }
+    return HXR_OK;
         }
-        StopAllPlayers(nNumPlayers, ppPlayers);
 
-        // repeat until nNumRepeats
+PLAYER_API int player_stop( void *pPlayerHandle )
+{
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    pPlayer->Stop();
+    return HXR_OK;
     }
 
-  cleanup:
 
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-    if (GetGlobal()->g_pVelocityCaps)
+PLAYER_API int player_seek(void *pPlayerHandle, int pos)
     {
-        IHXPlaybackVelocityCaps* pCaps = GetGlobal()->g_pVelocityCaps;
-        pCaps->Release();
-        GetGlobal()->g_pVelocityCaps = NULL;
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    if (pPlayer == NULL)
+        return HXR_FAIL;
+
+    return pPlayer->Seek(pos);
     }
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
-    // Clean up the URL array
-    for (i = 0; i < ((int) ulNumURLsFound); i++)
+PLAYER_API int player_getvolume(void *pPlayerHandle)
     {
-        HX_VECTOR_DELETE(pszURL[i]);
-    }
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    if (pPlayer == NULL)
+        return HXR_FAIL;
 
-    if (ppExContexts)
-    {
-        for (i = 0; i < nNumPlayers; i++)
+    int volume = 0;
+
+    IHXAudioPlayer* pAudioPlayer = NULL;
+    pPlayer->QueryInterface(IID_IHXAudioPlayer, (void**) &pAudioPlayer);
+    if (pAudioPlayer)
         {
-            if (ppExContexts[i])
+        // Get the IHXVolume
+        IHXVolume* pVolume = pAudioPlayer->GetAudioVolume();
+        if (pVolume)
             {
-                ppExContexts[i]->Release();
-                ppExContexts[i] = NULL;
+            volume = pVolume->GetVolume();
             }
+        HX_RELEASE(pVolume);
         }
-        delete []ppExContexts;
-        ppExContexts = NULL;
+    HX_RELEASE(pAudioPlayer);
+
+    return volume;
     }
 
-    HX_RELEASE(GetGlobal()->g_pQuickSeek);
     
-    if (ppPlayers)
+PLAYER_API int player_setvolume(void *pPlayerHandle, unsigned short volume)
     {
-        for (i = 0; i < nNumPlayers; i++)
-        {
-            if (ppPlayers[i])
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    if (pPlayer == NULL)
+        return HXR_FAIL;
+
+    IHXAudioPlayer* pAudioPlayer = NULL;
+    pPlayer->QueryInterface(IID_IHXAudioPlayer, (void**) &pAudioPlayer);
+    if (pAudioPlayer)
             {
-                if (GetGlobal()->pEngine)
+        // Get the IHXVolume
+        IHXVolume* pVolume = pAudioPlayer->GetAudioVolume();
+        if (pVolume)
                 {
-                    GetGlobal()->pEngine->ClosePlayer(ppPlayers[i]);
-                }
-                ppPlayers[i]->Release();
-                ppPlayers[i] = NULL;
+            pVolume->SetVolume(volume);
             }
+        HX_RELEASE(pVolume);
         }
-        delete []ppPlayers;
-        ppPlayers = NULL;
-    }
-
-#ifdef __TCS__
-    g_nPlayers = 0;
-#endif
+    HX_RELEASE(pAudioPlayer);
 
-#ifdef _UNIX
-    RestoreTerminal();
-#endif
+    return 0;
+}
     
-    if( GetGlobal()->bUseLegacyAPIs )
-    {
-        if (GetGlobal()->pEngine)
+PLAYER_API int deinit_main()
         {
-            fpCloseEngine = GetGlobal()->m_fpCloseEngine;
-            fpCloseEngine(GetGlobal()->pEngine);
-            GetGlobal()->pEngine = NULL;
+
+    pthread_cancel(GetGlobal()->g_pThreadKickmanId);
+    int ret ;
+    ret = pthread_join(GetGlobal()->g_pThreadKickmanId, NULL);
+    if (ret < 0) {
+        perror("pthread_join error\n");
         }
+#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
+    if (GetGlobal()->g_pVelocityCaps)
+    {
+        IHXPlaybackVelocityCaps* pCaps = GetGlobal()->g_pVelocityCaps;
+        pCaps->Release();
+        GetGlobal()->g_pVelocityCaps = NULL;
     }
-    else
+#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
+
+
     {
         IHXClientEngine* pEngine = GetGlobal()->pEngine;
 
@@ -2381,25 +742,16 @@
         
         if (GetGlobal()->pMediaPlatform)
         {
-            // Reset() not only close the platform but also remove all
-            // persistent information(i.e. preferences) maintained by the
-            // platform
-            // GetGlobal()->pMediaPlatform->Reset(NULL);
             GetGlobal()->pMediaPlatform->Close();
             HX_RELEASE(GetGlobal()->pMediaPlatform);
         }
 
-        if (fpHXMediaPlatformClose)
+        if (GetGlobal()->m_fpHXMediaPlatformClose)
         {
-            fpHXMediaPlatformClose();
+            GetGlobal()->m_fpHXMediaPlatformClose();
         }
     }
 
-    pDLLAccess->close();
-    delete pDLLAccess;
-    pDLLAccess = NULL;
-
-    HX_DELETE(pABDServer);
 
     if (GetGlobal()->bEnableVerboseMode)
     {
@@ -2426,142 +778,19 @@
         delete [] GetGlobal()->g_pszGUIDList;
         GetGlobal()->g_pszGUIDList = NULL;
     }
-
-    // If an an error occurred in this function return it
-    if (theErr != HXR_OK)
-    {
-        return theErr;
-    }
     // If an error occurred during playback, return that
-    else if (GetGlobal()->g_Error != HXR_OK)
+
+    if (GetGlobal()->g_Error != HXR_OK)
     {
         return GetGlobal()->g_Error;
     }
-    // If all went well, return the number of seconds played (if there
-    // was only one player)...
-    else if (nNumPlayers == 1)
-    {
-        return GetGlobal()->g_ulNumSecondsPlayed;
-    }
     // or HXR_OK (if there was more than one player)
     else
     {
         return HXR_OK;
     }
 }
-char* GetAppName(char* pszArgv0)
-{
-    char* pszAppName;
-
-    pszAppName = strrchr(pszArgv0, '\\');
-
-    if (NULL == pszAppName)
-    {
-        return pszArgv0;
-    }
-    else
-    {
-        return pszAppName + 1;
-    }
-}
-
-void PrintUsage(const char* pszAppName)
-{
-    STDOUT("\n");
-
-#if defined _DEBUG || defined DEBUG
-    STDOUT("USAGE:\n%s [-legacy] [-as0] [-abd server_ip:port,probpkt_size,probpkt_num] [-d D] [-n N] [-t T] [-st ST] [-g file] [-u username] [-p password] [-pref prefname prefvalue] [-vX,Y,Z] <URL0> [<URL1> [<URL2>]]\n", pszAppName);
-#else
-    STDOUT("USAGE:\n%s [-legacy] [-as0] [-abd server_ip:port] [-n N] [-t T] [-g file] [-u username] [-p password] <URL>\n", pszAppName);
-#endif
-    STDOUT("       -legacy : optional flag to load media engine via legacy APIs(i.e. CreateEngine/CloseEngine)\n");
-    STDOUT("       -a : optional flag to show advise sink output\n");
-    STDOUT("       -s : optional flag to output useful status messages\n");
-    STDOUT("       -iss: optional flag to ignore slow-start and begin\n"
-           "            playback immediately\n");
-    STDOUT("       -0 : optional flag to disable all output windows\n");
-#ifndef _STATICALLY_LINKED
-    STDOUT("       -l : optional flag to tell the player where to find its DLLs\n");
-#endif
-
-    STDOUT("      -abd: Auto Bandwidth Detection\n");
-    STDOUT("            server_ip:port\n");
-#if defined _DEBUG || defined DEBUG
-    STDOUT("       -d : HEX flag to print out DEBUG info\n");
-    STDOUT("            0x8000 -- for audio methods calling sequence\n"
-           "            0x0002 -- for variable values\n");
-#endif
-    STDOUT("       -n : optional flag to spawn N players\n");
-    STDOUT("       -rn: optional flag to repeat playback N times\n");
-    STDOUT("       -t : wait T milliseconds between starting players (default: %d)\n", DEFAULT_TIME_DELTA);
-    STDOUT("       -st: wait ST milliseconds until stopping players (default: %d)\n", DEFAULT_STOP_TIME);
-    STDOUT("       -g : use the list of GUIDS in the specified newline-delimited file\n");
-    STDOUT("            to give each of the N players a different GUID\n");
-    STDOUT("       -u : username to use in authentication response\n");
-    STDOUT("       -p : password to use in authentication response\n");
-    STDOUT("       -pref : preference name and value to set. You can specify more than 1 -pref option on a command-line\n");
-#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
-    STDOUT("       -vX,Y,Z : Set playback velocity to X percent (normal speed = 100), Y=keyframe, Z=autoswitch\n");
-#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
-    STDOUT("   <URL0> : URLs for multiple players\n");
-    STDOUT("            (If multiple URLs are specified, then the number of players (-n)\n"
-           "             must match the number of URLs. If multiple players are specified\n"
-           "             but only 1 URL, then the same URL will be played on all players.)\n");
-    STDOUT("\n\n");
-    STDOUT("Run-time commands (enter the command below followed by <Enter>:\n\n");
-    STDOUT("  p or P  : Pause player 0\n");
-    STDOUT("  r or R  : Resume player 0\n");
-    STDOUT("  t or T  : Show current playback time for player 0\n");
-    STDOUT("  f or F  : Set player 0 to next group\n");
-    STDOUT("  b or B  : Set player 0 to previous group\n");
-    STDOUT("  m       : Toggle mute/un-mute for player 0\n");
-    STDOUT("  q or Q  : Stop all players and end splay\n");
-    STDOUT("  sXXXXX  : Seek player 0 to XXXXX ms\n");
-    STDOUT("  lV      : Set volume of player 0 to V (where V is >= 0 and <= 100)\n");
-    STDOUT("  vX,Y,Z  : Set playback velocity of player 0 to X percent (normal speed = 100),");
-    STDOUT("            Y=keyframe, Z=autoswitch\n");
-#if defined(HELIX_FEATURE_VIDEO) && defined(HELIX_FEATURE_PNG)
-    STDOUT("  c       : Capture a video frame and save it to './image.png'.\n");
-    STDOUT("  c F     : Capture a video frame and save it to file F.\n");
-    STDOUT("  c F,X,Y : Capture a video frame and save it to file F, with the X,Y dimensions.\n");
-#endif //  HELIX_FEATURE_VIDEO && HELIX_FEATURE_PNG
-#if defined(HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION)
-    STDOUT("  pf or PF: Show all presentation features, their current settings,\n");
-    STDOUT("            and each PF's list of options\n");
-    STDOUT("  pf X    : Show presentation feature X's current & optional settings\n");
-    STDOUT("  pf X Y  : Set presentation feature X's current setting to Y\n");
-#endif //  HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION.
-    STDOUT("\n Editing of commands:\n");
-    STDOUT("  tab key : load the prior command in the command buffer\n");
-    STDOUT("  bksp key: undo the last-typed character\n");
-    STDOUT("\n\n");
-}
-
-HXBOOL AllPlayersDone(int nNumPlayers, IHXPlayer** ppPlayers)
-{
-    HXBOOL bAllDone = TRUE;
-
-    // Start checking at the end of the array since those players
-    // were started last and are therefore more likely to not be
-    // finished yet.
-    for (int i = nNumPlayers - 1; i >= 0 && bAllDone; i--)
-    {
-        if (!ppPlayers[i]->IsDone())
-        {
-            bAllDone = FALSE;
-        }
-    }
-
-    return bAllDone;
-}
 
-void StopAllPlayers(int nNumPlayers, IHXPlayer** ppPlayers)
-{
-    for (int i = 0; i < nNumPlayers; i++)
-    {
-        ppPlayers[i]->Stop();
-    }
-}
 
 HXBOOL ReadGUIDFile()
 {
@@ -2598,45 +827,51 @@
     return bSuccess;
 }
 
-#ifdef __TCS__
-
-extern  "C"     void Helix_SeekAudio(unsigned long uTimeMS)
+static int are_all_src_seekable(IHXPlayer *pPlayer)
 {
-    int i;
-    for (i = 0; i < g_nPlayers; i++)
+    UINT16 nSrcCnt;
+    nSrcCnt = pPlayer->GetSourceCount();
+    HXSource *pSource = NULL;    /* This is brute-force */
+    for (UINT16 i = 0; i < nSrcCnt; i++) 
     {
-        g_Players[i]->Seek(uTimeMS);
-    }
-}
+        if (pPlayer->GetSource(i, (IUnknown *&)pSource) == HXR_OK)
+        {
+            if (!pSource->IsSeekable())
+                return FALSE;
 
 
-extern  "C"     void Helix_StopAudio(void)
-{
-    int i;
-    for (i = 0; i < g_nPlayers; i++)
-    {
-        g_Players[i]->Stop();
     }
 }
 
+    return 0;
+}
 
-extern  "C"     void Helix_PauseAudio(void)
-{
-    int i;
-    for (i = 0; i < g_nPlayers; i++)
+PLAYER_API int player_canseek(void *pPlayerHandle)
     {
-        g_Players[i]->Pause();
-    }
-}
+    if (!pPlayerHandle)
+        return FALSE;
 
+    IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
+    CHXClientContext*  pExContext=NULL;
+    if (pPlayer->GetClientContext((IUnknown*&)pExContext) != HXR_OK)
+        return FALSE;
 
-extern  "C"     void Helix_ResumeAudio(void)
-{
-    int i;
-    for (i = 0; i < g_nPlayers; i++)
-    {
-        g_Players[i]->Begin();
-    }
+    if (!pExContext)
+        return FALSE;
+
+    EHXClientState State = pExContext->GetState();
+
+    int all_src_seekable =  are_all_src_seekable(pPlayer);
+
+    HX_RELEASE(pExContext);
+
+    if (State < HX_CLIENT_STATE_CONNECTED)
+        return TRUE;
+
+    if (all_src_seekable && (!pPlayer->IsLive() || State == HX_CLIENT_STATE_PAUSED))
+        return TRUE;
+
+    return FALSE;
 }
 
-#endif
+
preflist.cpp.diff (application/octet-stream, 4 KB)
--- simpleplayer/preflist.cpp	2007-07-07 04:32:36.000000000 +0800
+++ mediasinklib/preflist.cpp	2009-05-04 15:57:30.000000000 +0800
@@ -1,51 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
- * Source last modified: $Id: preflist.cpp,v 1.2 2007/07/06 20:32:36 jfinnecy Exp $
+ * Version: RCSL 1.0/RPSL 1.0 
  * 
- * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
+ * 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
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (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
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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 (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.
+ * 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.
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  * 
  * ***** END LICENSE BLOCK ***** */
+
 #include "preflist.h"
 
 #include "hxstring.h"
preflist.h.diff (application/octet-stream, 4.2 KB)
--- simpleplayer/preflist.h	2007-07-07 04:32:36.000000000 +0800
+++ mediasinklib/preflist.h	2009-04-16 13:37:30.000000000 +0800
@@ -1,53 +1,45 @@
 /* ***** BEGIN LICENSE BLOCK *****
- * Source last modified: $Id: preflist.h,v 1.2 2007/07/06 20:32:36 jfinnecy Exp $
+ * Version: RCSL 1.0/RPSL 1.0 
  * 
- * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
+ * 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
+ * Media Sink Implementation:
+ * Copyright 2008-2009 Intel Corp.
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (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
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (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 (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.
+ * 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.
+ * 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):
+ * Long Bu <[email protected]>
+ * Rusty Lynch <[email protected]>
  * 
  * ***** END LICENSE BLOCK ***** */
-#ifndef PREFLIST_H
-#define PREFLIST_H
+
+#ifndef _PREFLIST_H_
+#define _PREFLIST_H_
 
 #include "hxslist.h"
 
@@ -66,4 +58,4 @@
     CHXSimpleList m_prefInfo;
 };
 
-#endif /* PREFLIST_H */
+#endif // _PREFLIST_H_
print.cpp.diff (application/octet-stream, 2.6 KB)
--- simpleplayer/print.cpp	2009-04-14 13:29:53.000000000 +0800
+++ /dev/null	2009-04-21 11:12:45.000000000 +0800
@@ -1,80 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK ***** 
- * Version: RCSL 1.0/RPSL 1.0 
- *  
- * 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 
- * Version 1.0 (the "RPSL") available at 
- * http://www.helixcommunity.org/content/rpsl unless you have licensed 
- * the file under the RealNetworks Community Source License Version 1.0 
- * (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.  
- *  
- * 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 <stdarg.h>
-#include <stdio.h>
-#include "print.h"
-#ifdef WIN32_PLATFORM_PSPC
-#include "hlxosstr.h"
-#include <winbase.h>
-#endif
-
-int print2stdout(const char* pFmt, ...)
-{
-    va_list args;
-    
-    va_start(args, pFmt);
-
-#ifdef WIN32_PLATFORM_PSPC
-    char szMessage[512];
-    int ret = vsprintf(szMessage, pFmt, args);
-    OutputDebugString(OS_STRING(szMessage));
-#else
-    int ret = vfprintf(stdout, pFmt, args);
-#endif
-
-    va_end(args);
-
-    return ret;
-}
-
-int print2stderr(const char* pFmt, ...)
-{
-    va_list args;
-    
-    va_start(args, pFmt);
-
-#ifdef WIN32_PLATFORM_PSPC
-    char szMessage[512];
-    int ret = vsprintf(szMessage, pFmt, args);
-    OutputDebugString(OS_STRING(szMessage));
-#else
-    int ret = vfprintf(stderr, pFmt, args);
-#endif
-
-    va_end(args);
-
-    return ret;
-}
print.h.diff (application/octet-stream, 2.2 KB)
--- simpleplayer/print.h	2009-04-14 13:29:53.000000000 +0800
+++ /dev/null	2009-04-21 11:12:45.000000000 +0800
@@ -1,60 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK ***** 
- * Version: RCSL 1.0/RPSL 1.0 
- *  
- * 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 
- * Version 1.0 (the "RPSL") available at 
- * http://www.helixcommunity.org/content/rpsl unless you have licensed 
- * the file under the RealNetworks Community Source License Version 1.0 
- * (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.  
- *  
- * 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 PRINT_H
-#define PRINT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef _SYMBIAN
-#include "platform/symbian/symbian_print.h"
-
-#define STDOUT symbianPrint
-#define STDERR symbianPrint
-#else
-int print2stdout(const char* pFmt, ...);
-int print2stderr(const char* pFmt, ...);
-#define STDOUT print2stdout
-#define STDERR print2stderr
-#endif
-
-#ifdef __cplusplus
-};
-#endif
-
-
-#endif /* PRINT_H */
Umakefil.diff (application/octet-stream, 5.5 KB)
--- simpleplayer/Umakefil	2006-09-09 04:59:16.000000000 +0800
+++ mediasinklib/Umakefil	2009-05-04 15:13:58.000000000 +0800
@@ -1,9 +1,11 @@
-# 
-# ***** BEGIN LICENSE BLOCK ***** 
+# **** BEGIN LICENSE BLOCK ***** 
 # Version: RCSL 1.0/RPSL 1.0 
 #  
 # Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
 #      
+# Media Sink Implementation:
+# Copyright 2008-2009 Intel Corp.
+#      
 # The contents of this file, and the files included with this file, are 
 # subject to the current version of the RealNetworks Public Source License 
 # Version 1.0 (the "RPSL") available at 
@@ -31,25 +33,38 @@
 #    http://www.helixcommunity.org/content/tck 
 # 
 # Contributor(s): 
+# Long Bu <[email protected]>
+# Rusty Lynch <[email protected]>
 #  
 # ***** END LICENSE BLOCK ***** 
-# 
 
-UmakefileVersion(2,0)
+UmakefileVersion(2,2)
 
 project.AddModuleIncludes("common/include",
                           "common/runtime/pub",
                           "client/include",
                           "client/common/system/pub",
+                          "client/common/container/pub",
+                          "client/audiosvc/pub",
                           "common/container/pub",
-                          "datatype/rm/include")
-
-project.AddSources("main.cpp",
-                   "excontxt.cpp",
-                   "exadvsnk.cpp",
-                   "exerror.cpp",
+			  "video/sitelib/pub",
+			  "video/colconverter/pub",
+			  "video/sitelib/pub/platform/unix",
+			  "video/sitelib",
+                          "datatype/rm/include",
+                          "clientapps/mediasinklib/pub",
+                          "client/core")
+
+project.AddSources("player.cpp",
+                   "CHXClientContext.cpp",
+                   "CHXSite.cpp",
+                   "CHXRootSurf.cpp",
+                   "CHXSurf.cpp",
+                   "CHXClientAdviceSink.cpp",
+                   "CHXClientStateAdviceSink.cpp",
+                   "CHXErrorSink.cpp",
                    "iids.cpp",
-		   "print.cpp")
+                )
 
 project.AddModuleLibraries(
                            "common/runtime[runtlib]",
@@ -58,27 +73,25 @@
                            "common/runtime[runtlib]",
                            "client/common/system[sysclntlib]",
                            "common/dbgtool[debuglib]",
-                           "common/util[utillib]"
+                           "common/util[utillib]",
+                           "video/sitelib[sitelib]",
+                           "video/sitelib[sitecreatelib]",
+                           "common/log/logutil[logutillib]",
+                           "video/vidutil[vidutillib]"
                            )
 
 if project.IsDefined("HELIX_FEATURE_PREFERENCES"):
     project.AddSources("preflist.cpp")
 
 if project.IsDefined("HELIX_FEATURE_AUTHENTICATION"):
-    project.AddSources("exaumgr.cpp")
+    project.AddSources("CHXAuthenticationManager.cpp")
 
 if project.IsDefined("HELIX_FEATURE_VIDEO"):
-	project.AddSources("exsitsup.cpp",
-                           "fivemmap.cpp")
+	project.AddSources("CHXSiteSupplier.cpp")
 	project.AddModuleIncludes('video/include')
-	if project.IsDefined("HELIX_FEATURE_PNG"):
-		project.AddModuleIncludes('datatype/image/png/common/pub')
-		project.AddModuleLibraries("common/import/zlib[zlib]",
-					   "datatype/image/png/import/libpng[libpng]",
-					   "datatype/image/png/common[pngcomlib]")
 
 if project.IsDefined("HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS"):
-	project.AddSources("exprdnld.cpp")
+	project.AddSources("CHXPDStatusObserver.cpp")
 
 if project.BuildOption("nodll"):
         ## Client core
@@ -197,11 +210,11 @@
         ##
 	if project.IsDefined("HELIX_FEATURE_VIDEO"):
 		static_plugin_list[-1:-1] = ["vidsite"]
-		static_plugin_list[-1:-1] = ["hxltcolor"]
+		static_plugin_list[-1:-1] = ["colorcvt"]
                 project.AddModuleLibraries("datatype/common/vidrend[vidrend]",
                                            "video/sitelib[sitelib]",
                                            "video/site[vidsite]",
-                                           "video/colconverter[hxltcolor]",
+                                           "video/colconverter[colorcvt]",
                                            "datatype/rm/common[rmcomlib]",
                                            "video/vidutil[vidutillib]")
 
@@ -283,7 +296,25 @@
 
 	CreateStaticPluginTable(static_plugin_list)
 
-ProgramTarget("splay")
+project.ExportFunction("init_main", "void")
+project.ExportFunction("deinit_main", "void")
+project.ExportFunction("get_player", "void **ppPlayer",
+                    "on_buffering_cb_t on_buffering_cb",
+                    "on_pos_length_cb_t on_pos_length_cb")
+project.ExportFunction("player_openurl", "void *pPlayerHandle",
+                    "char *pszRawURL")
+project.ExportFunction("put_player", "void *pPlayerHandle")
+project.ExportFunction("player_geturl", "void *pPlayerHandle", "char **pszURL")
+project.ExportFunction("player_begin", "void *pPlayerHandle")
+project.ExportFunction("player_stop", "void *pPlayerHandle")
+project.ExportFunction("player_pause", "void *pPlayerHandle")
+project.ExportFunction("player_seek", "void *pPlayerHandle", "int pos")
+project.ExportFunction("get_curr_playtime", "void *pPlayerHandle")
+project.ExportFunction("player_getvolume", "void *pPlayerHandle")
+project.ExportFunction("player_canseek", "void *pPlayerHandle")
+project.ExportFunction("player_setvolume", "void *pPlayerHandle", "unsigned short volumn")
+
+DLLTarget('libhxmediasink')
 
 DependTarget()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.