Beispiel #1
0
	WebkitClientAdviseSink::WebkitClientAdviseSink(IUnknown* pUnknown, WebkitClientContext* pContext)
		: m_lRefCount(0)
		  , m_pUnknown(NULL)
		  , m_pRegistry(NULL)
		  , m_pPlayer(NULL)
		  , m_bOpened(FALSE)
		  , m_bPrepared(FALSE)
		  , m_bSendPlayBackComplete(FALSE)
		  , m_lDuration(-1)
		  , m_ulFileDurationFromHeader(0)
		  , m_ulPos(0)
		  , m_pWebkitContext(NULL)
		  , m_ulStartTime(0)
		  , m_ulWidth(0)
		  , m_ulHeight(0)
		  , m_bIsLiveOrAdaptiveHTTP(FALSE)
	{
		m_pWebkitContext = pContext;
		m_pUnknown = pUnknown;

		HX_ADDREF(m_pWebkitContext);
		HX_ADDREF(m_pUnknown);

		if (m_pUnknown)
		{
			m_pUnknown->QueryInterface(IID_IHXRegistry, (void**)&m_pRegistry);
			m_pUnknown->QueryInterface(IID_IHXPlayer, (void**)&m_pPlayer);
		}

		if (m_pPlayer)
		{
			IHXGroupManager* pGroupMgr = NULL;
			if(HXR_OK == m_pPlayer->QueryInterface(IID_IHXGroupManager, (void**)&pGroupMgr))
			{
				pGroupMgr->AddSink((IHXGroupSink*)this);
				HX_RELEASE(pGroupMgr);
			}

			IHXClientStateAdviseSinkControl* pControl=NULL;
			if(HXR_OK == m_pPlayer->QueryInterface(IID_IHXClientStateAdviseSinkControl, (void**)&pControl))
			{
				pControl->AddClientStateAdviseSink(this);
				HX_RELEASE(pControl);
			}

			HX_RESULT retVal = HXR_FAIL;
			retVal = m_pPlayer->AddAdviseSink((IHXClientAdviseSink*)this);
			m_ulStartTime = HX_GET_BETTERTICKCOUNT();
			printf("HelixOverWebkit [%s] [%s] [%d] WebkitClientAdviseSink::AddAdviseSink() returned %d\n", __FILE__, __FUNCTION__, __LINE__, retVal);

		}	
	}
Beispiel #2
0
RTSPMediaDesc::RTSPMediaDesc(IUnknown* pContext)
	      :m_pFileHeader(0)
	      ,m_pContext(pContext)
{
    HX_ADDREF(m_pContext);
    m_streams = new CHXSimpleList;
}
STDMETHODIMP
CHXMediaPlatformKicker::RegisterContext(IUnknown* pContext)
{
    HX_RESULT retVal = HXR_FAILED;

    if (!m_pContext && pContext)
    {
	retVal = HXR_OK;
    }

    if (SUCCEEDED(retVal))
    {
	m_pContext = pContext;
	HX_ADDREF(m_pContext);
    
	// Platform kicker should not use platform mutex as
	// this unnecesarily makes Kick() on all threads mutually
	// exclusive with execution of scheduler callbacks.
	// Additionally, using a platform mutex here would be
	// problematic as it would prevent proper kicker 
	// initialization for schedulers created prior to the
	// context initialization.  The mutex used would not
	// necessarily be the intended platform mutex since
	// platform initialization may override it via custom
	// platform scheduler.  This in turn can create unexpected 
	// behavior such as deadlocks.
	retVal = CreateInstanceCCF(CLSID_IHXMutex, 
				   (void**) &m_pMutex, 
				   m_pContext);
    }

    return retVal;
}
Beispiel #4
0
CAsyncNetThread::CAsyncNetThread(IUnknown* pContext, HINSTANCE hInst)
    : m_hWnd(NULL)
    , m_bValid(FALSE)
    , m_hInst(hInst)
    , m_nNumSocketsClients(0)
    , m_bInCancelMode(FALSE)
    , m_pNextNotifier(0)
    , m_pThreadEngineMutex(0)
    , m_pContext(pContext)
{
    HX_ADDREF(m_pContext);

#ifdef _WIN32
    if (!zm_uDestroyMessage)
    {
	zm_uDestroyMessage = RegisterWindowMessage(OS_STRING("HX_DestroyInternalNetThreadAsync"));
    }
#endif

    m_ClientSocketsMap = new CHXMapPtrToPtr;

    m_ulSession = CAsyncNetThread::GetSession();

    m_bValid = Create();
    ThreadEngine* pEngine   = ThreadEngine::GetThreadEngine(m_pContext);
    m_pThreadEngineMutex    = pEngine->GetMutex();
}
Beispiel #5
0
HX_RESULT CBaseArchiver2::MakeNuggetFileObject(IHXFileObject* pFileObject,
					       const char* pFileMimeType,
					       IHXFileObject* &pNuggetFileObject)
{
    HX_RESULT retVal = HXR_OUTOFMEMORY;
    CNGTFileObject* pNewNuggetFileObject = new CNGTFileObject();

    if (pNewNuggetFileObject)
    {
	pNewNuggetFileObject->AddRef();
	retVal = pNewNuggetFileObject->InitNugget(m_pContext,
					          pFileObject,
						  HX_FILE_READ | HX_FILE_WRITE | HX_FILE_BINARY,
						  NULL,	    // IHXMetaFileFormatResponse
						  TRUE);    // bForceNew

	if (SUCCEEDED(retVal))
	{
	    UINT32 ulExpiration = 0;
	    UINT32 ulConnectTime = 0;
	    IHXBuffer* pRemoteSourceURLBuffer = NULL;

	    m_pAdviser->GetPropertyULONG32("NuggetExpiration", 
					   ulExpiration);

	    m_pAdviser->GetPropertyCString("NuggetRemoteSourceURL", 
					   pRemoteSourceURLBuffer);

	    m_pAdviser->GetPropertyULONG32("NuggetConnectTime", 
					   ulConnectTime);

	    retVal = pNewNuggetFileObject->ConfigureNugget(
			   ulExpiration,
			   ulConnectTime,
			   m_ulNuggetMinLocalDuration,
			   m_ulMaxDuration,
			   pFileMimeType,
			   pRemoteSourceURLBuffer ? ((const char*) pRemoteSourceURLBuffer->GetBuffer()) : NULL);

	    HX_RELEASE(pRemoteSourceURLBuffer);
	}

	if (SUCCEEDED(retVal))
	{
	    retVal = pNewNuggetFileObject->QueryInterface(IID_IHXFileObject, 
							  (void**) &pNuggetFileObject);
	}

	if (SUCCEEDED(retVal))
	{
	    m_pNuggetFileObject = pNewNuggetFileObject;
	    HX_ADDREF(m_pNuggetFileObject);
	}
    }

    HX_RELEASE(pNewNuggetFileObject);

    return retVal;
}
Beispiel #6
0
/************************************************************************
 *  Constructor/Destructor
 */
CHXDirectory::CHXDirectory(IUnknown* pContext, IUnknown** ppCommonObj)
: m_pFileFinder(NULL)
, m_pContext(pContext)
, m_pSessionManager(NULL)
{
    HX_ADDREF(m_pContext);
    CSymbSessionMgr::Create(m_pSessionManager, ppCommonObj);
}
Beispiel #7
0
STDMETHODIMP
CloakConn::SetResponse(IHXSocketResponse* pResponse)
{
    HX_RELEASE(m_pRTSPSvrProt);
    m_pRTSPSvrProt = pResponse;
    HX_ADDREF(m_pRTSPSvrProt);
    return HXR_OK;
}
Beispiel #8
0
//
// CHXAudioDevice::Init()
// QI for ErrorMessage
//
void CHXAudioDevice::Init(IUnknown* pContext)
{
   HX_RELEASE(m_pContext);
   m_pContext = pContext;
   HX_ADDREF(m_pContext);

   HX_RELEASE(m_pErrorMessages);
   m_pContext->QueryInterface(IID_IHXErrorMessages, (void **)&m_pErrorMessages);
   HX_ASSERT(m_pErrorMessages != NULL);
}
Beispiel #9
0
CMacAsyncFile::CMacAsyncFile(IUnknown* pContext) :
     mReadQueue(NULL)
    ,mSeekFromWhere(0)
    ,mSeekPos(0)
    ,mFilePos(0)
    ,m_ulReadPositionInFile(0)
    ,m_pResponse(NULL)
    ,m_bFileDone(FALSE)
    ,m_bReadPending(FALSE)
    ,m_bSeekPending(FALSE)
    ,m_ulPendingReadCount(FALSE)
    ,mAsyncQueue(NULL)
    ,mOutStandingCallbacks(0)
    ,m_bSettingSeekState(FALSE)    
    ,m_bCheckFromPQ(FALSE)
    ,m_bInternalSeekNeeded(FALSE)
    ,m_pPendingCallbackList(NULL)
    ,m_pTimedPQList(NULL)
    ,m_pLocationPQList(NULL)
    ,m_ulTotalPQSize(0)
    ,m_bDeferredTaskPending(FALSE)
    ,m_bIsQuitting(FALSE)
    ,m_bInEnqueueAsyncBuffers(FALSE)
    ,m_bPendingAsyncSeekCompleted(FALSE)
    ,m_bAllCallbacksCompleted(FALSE)
    ,m_bInProcessPendingCallbacks(FALSE)
    ,m_pMutex(NULL)
    ,m_lRefCount(0)
    ,m_pContext(pContext)
{
    HX_ADDREF(m_pContext);

    mAsyncQueue = new CHXSimpleList();
    m_pPendingCallbackList = new CHXSimpleList;
    m_pTimedPQList	      = new CHXSimpleList;
    m_pLocationPQList	      = new CHXSimpleList;
    mReadQueue	= new CBigByteQueue(kMacAsyncBuffer, 1);
    
    m_DeferredTaskStruct.dtReserved = 0;
    m_DeferredTaskStruct.dtFlags = 0;
#ifdef _CARBON
    m_DeferredTaskStruct.dtAddr = NewDeferredTaskUPP(CMacAsyncFile::DeferredTaskProc);
#else
    m_DeferredTaskStruct.dtAddr = NewDeferredTaskProc(CMacAsyncFile::DeferredTaskProc);
#endif
    m_DeferredTaskStruct.dtParam = (long) this; 	
    m_DeferredTaskStruct.qType = dtQType;
    
    m_uNumDeferredTask = 0;

    CreateInstanceCCF(CLSID_IHXMutex, (void**)&m_pMutex, m_pContext);
    HX_ASSERT(m_pMutex);
#endif // defined(THREADS_SUPPORTED) 
}
Beispiel #10
0
HX_RESULT
CloakConn::GetGETHandler(CBaseCloakGETHandler*& pGETHandler)
{
    HXMutexLock(m_pMutex);

    pGETHandler = m_pGETHandler;
    HX_ADDREF(pGETHandler);

    HXMutexUnlock(m_pMutex);
    return HXR_OK;
}
Beispiel #11
0
BufferedDataFile::BufferedDataFile(IUnknown* pContext)
		  : m_lRefCount(0)
		  , m_ulLastError(HXR_OK)
		  , m_pFilename(NULL)
		  , m_pFile(0)
{
    m_pContext = pContext;
    HX_ADDREF(m_pContext);

    CreateBufferCCF(m_pFilename, m_pContext);
    DPRINTF(0x5d000000, ("BufferedDataFile::BufferedDataFile()\n"));
}
Beispiel #12
0
/****************************************************************************
 *  Constructor/Destructor
 */
CSymbIHXDataFile::CSymbIHXDataFile(IUnknown* pContext, IUnknown** ppCommonObj)
    : m_pFileName(NULL)
    , m_pSessionManager(NULL)
    , m_bHaveSession(FALSE)
    , m_bOpen(FALSE)
    , m_symbLastError(KErrNone)
    , m_lRefCount(0)
{
    m_pContext = pContext;
    HX_ADDREF(m_pContext);
    CSymbSessionMgr::Create(m_pSessionManager, ppCommonObj);
}
Beispiel #13
0
CAsyncTimer::CAsyncTimer(IUnknown* pContext, HXScheduler* pScheduler)
{
    m_pContext = pContext;
    HX_ADDREF(m_pContext);

    m_pScheduler    = pScheduler;
    m_ulStartTime   = 0;
    m_ulGranularity = 100;
    m_pThread       = NULL;
    m_pQuitEvent    = NULL;
    m_uPlayingStateCount = 0;
}
Beispiel #14
0
void
CloakConn::SetRefSocket(IHXSocket* pSock)
{
    // Set reference socket for retrieving addresses, family info, etc..
    HXMutexLock(m_pMutex);

    HX_RELEASE(m_pRefSock);
    m_pRefSock = pSock;
    HX_ADDREF(m_pRefSock);

    HXMutexUnlock(m_pMutex);
}
Beispiel #15
0
HelixPlayer::HelixPlayer(IHXClientEngine* engine):
    m_stopTimerId(0),
    m_progressTimerId(0),
    m_progressWatch(-1),
    m_engine(engine)
{
    if (HXR_OK == m_engine->CreatePlayer(m_player)) {

        // Install advise sinks
        m_progressadvise = new PlayerProgressAdvise;
        HX_ADDREF( m_progressadvise );

        m_progressadvise->attach( this );
        m_player->AddAdviseSink( m_progressadvise );

        m_stateadvise = new PlayerStateAdvise(this);
        HX_ADDREF( m_stateadvise );

        m_stateadvise->attach( this );
        m_player->AddAdviseSink( m_stateadvise );

        IHXAudioPlayer *audioplayer;
        if( m_player->QueryInterface( IID_IHXAudioPlayer, (void**)&audioplayer ) == HXR_OK ) {
            m_volume = audioplayer->GetAudioVolume();
            HX_RELEASE( audioplayer );
        } else {
            REPORT_ERROR( ERR_HELIX );
        }

        m_volumeadvise = new PlayerVolumeAdvise;
        HX_ADDREF( m_volumeadvise );

        m_volumeadvise->attach( this );
        m_volume->AddAdviseSink( m_volumeadvise );

        // Install player context
        m_sitesupplier = new HelixSiteSupplier( m_player );
        HX_ADDREF( m_sitesupplier );
        m_sitesupplier->attach( this );

        m_errorsink = new PlayerErrorSink;
        HX_ADDREF( m_errorsink );
        m_errorsink->attach( this );

        if( m_player->QueryInterface( IID_IHXErrorSinkControl, (void**)&m_errorcontrol ) == HXR_OK ) {
            m_errorcontrol->AddErrorSink( m_errorsink, HXLOG_EMERG, HXLOG_INFO );
        } else {
            REPORT_ERROR( ERR_HELIX );
        }

        m_context = new GenericContext( QList<IUnknown*>()
            << m_sitesupplier
            << m_errorsink );
        HX_ADDREF( m_context );
        m_player->SetClientContext( m_sitesupplier );
    }
}
Beispiel #16
0
HX_RESULT 
CloakConn::OnPOSTData(IHXBuffer* pBuf)
{
    if (!m_pRTSPSvrProt)
    {
        return HXR_FAIL;
    }

    HX_ADDREF(pBuf);
    m_ReadQueue.AddTail((void*)pBuf);

    //XXXDPL - We're passing events straight through to RTSP stack! 
    //Should we do event filtering here?
    return m_pRTSPSvrProt->EventPending(HX_SOCK_EVENT_READ, HXR_OK);
}
Beispiel #17
0
STDMETHODIMP
HXScheduler::SetMutex(IHXMutex* pMutex)
{
    HX_RESULT retVal = HXR_UNEXPECTED;

    if (!m_pCoreMutex)
    {
	m_pCoreMutex = pMutex;
	HX_ADDREF(m_pCoreMutex);

	retVal = HXR_OK;
    }

    return retVal;
}
Beispiel #18
0
/************************************************************************
 *  Method:
 *    Destructor
 */
CHXSiteManager::CHXSiteManager(IUnknown* pContext)
    : m_lRefCount(0)
    , m_bInUnHookAll(FALSE)
    , m_bNeedFocus(FALSE)
    , m_pContext(pContext)
{
#if defined(HELIX_CONFIG_NOSTATICS)
    //INT32& zm_nSiteManagerCount = HXGlobalInt32::Get(&CHXSiteManager::zm_nSiteManagerCount);
#endif

    HX_ADDREF(m_pContext);
    
#if defined(HX_ENABLE_SITE_EVENTHANDLER)
    zm_SiteManagerList.AddTail(this);
    zm_nSiteManagerCount++;
#endif /* HX_ENABLE_SITE_EVENTHANDLER */
};
Beispiel #19
0
HX_RESULT
CloakConn::SetGETHandler(CBaseCloakGETHandler* pGETHandler)
{
    HXMutexLock(m_pMutex);

    if (m_pGETHandler)
    {
        m_pGETHandler->Release();
    }

    m_pGETHandler = pGETHandler;
    HX_ADDREF(pGETHandler);

    HXMutexUnlock(m_pMutex);

    return HXR_OK;
}
Beispiel #20
0
CHXMediaPlatform::CHXMediaPlatform(CHXMediaPlatform* pParent, CHXMediaPlatform* pRoot)
    :m_bInitialized(FALSE)
    ,m_lastError(HXR_OK)
    ,m_pExtContext(NULL)
    ,m_pExtCCF(NULL)
    ,m_pPreferences(NULL)
    ,m_pScheduler(NULL)
    ,m_pScheduler2(NULL)
    ,m_pOptimizedScheduler(NULL)
    ,m_pOptimizedScheduler2(NULL)
    ,m_pMutex(NULL)
    ,m_pNetServices(NULL)
    ,m_pNetInterfaces(NULL)
    ,m_pKicker(NULL)
    ,m_pRegistry(NULL)
    ,m_pExtScheduler(NULL)
    ,m_pExtKicker(NULL)
    ,m_pPluginHandlerUnkown(NULL)
    ,m_pPluginPaths(NULL)
    ,m_pParent(pParent)
    ,m_pRoot(pRoot)
    ,m_pChildren(NULL)
    ,m_pSingleLoadPlugins(NULL)
    ,m_pLoadAtStartupPlugins(NULL)
#if defined(HELIX_FEATURE_HYPER_NAVIGATE)
    ,m_pHyperNavigate(NULL)
    ,m_pDefaultHyperNavigate(NULL)
#endif /* HELIX_FEATURE_HYPER_NAVIGATE */
#if defined(HELIX_FEATURE_REGISTRY)
    ,m_pClientRegistry(NULL)
#endif /* HELIX_FEATURE_REGISTRY */
#if defined(HELIX_FEATURE_VIDEO)    
    ,m_pSiteEventHandler(NULL)
#endif /* HELIX_FEATURE_VIDEO */
{
    HX_ADDREF(m_pParent);
    if (!m_pRoot)
    {
        m_pRoot = this;
    }
}
Beispiel #21
0
HXClientPropWatch::HXClientPropWatch(CommonRegistry* pRegistry, IUnknown* pContext)
	   : m_lRefCount(0)
	   , m_pResponse(NULL)
	   , m_pRegistry(NULL)
	   , m_pInterruptSafeResponse(NULL)
	   , m_pInterruptState(NULL)
	   , m_pScheduler(NULL)
	   , m_pInternalResponse(NULL)
	   , m_pCallback(NULL)
	   , m_pContext(pContext)
{
    HX_ADDREF(m_pContext);

    m_pRegistry = pRegistry;

    /* 
     * Users of HXClientRegistry should call Init and the context should
     * expose IHXInterruptState and IHXScheduler if they want to
     * ensure that watches are fired ONLY at non-interrupt time.
     *
     * Currently, this functionality is ONLY used by the client core
     * since it is multi-threaded and needs to deal with
     * top level clients which are not thread-safe.
     */
    if (pContext)
    {
    	pContext->QueryInterface(IID_IHXScheduler, 
					(void**) &m_pScheduler);

	pContext->QueryInterface(IID_IHXInterruptState, 
					(void**) &m_pInterruptState);

    }

    m_pInternalResponse = new PropWatchResponse(this);
    m_pInternalResponse->AddRef();
}
Beispiel #22
0
HXNetInterface::HXNetInterface(IUnknown* pContext)
		: m_lRefCount(0)
		, m_bInitialized(FALSE)
		, m_hIPLib(NULL)
		, m_hWinSockLib(NULL)
		, m_hAddrChangeEvent(NULL)
		, m_pScheduler(NULL)
                , m_pEM(NULL)
		, m_pAddrChangeCallback(NULL)
		, m_pNetInterfaceList(NULL)
		, m_pSinkList(NULL)
		, _pNotifyAddrChange(NULL)
		, _hxWSAStartup(NULL)
		, _hxWSACleanup(NULL)
#if defined HELIX_FEATURE_NETINTERFACES
		, _pGetAdaptersInfo(NULL)
                , _pGetAdaptersAddresses(NULL)
#endif /* HELIX_FEATURE_NETINTERFACES */
#ifndef _WINCE
		, _hxsocket(NULL)
		, _hxclosesocket(NULL)
		, _raWSAIoctl(NULL)
#endif /* _WINCE */
		, m_handle(NULL)
                , m_pThread(NULL)
                , m_pQuitEvent(NULL)
                , m_bIsDone(FALSE)
{
    m_pContext = pContext;
    HX_ADDREF(m_pContext);

    if (m_pContext)
    {
        m_pContext->QueryInterface(IID_IHXErrorMessages, (void**)&m_pEM);
    }
}
Beispiel #23
0
STDMETHODIMP
CHXMediaPlatform::AddPluginPath(const char* pszName,
                                const char* pszPath)
{
    HX_RESULT       rc = HXR_OK;
    UINT32          ulBufSize = 0;
    IHXBuffer*      pPathBuffer = NULL;
    PluginPathInfo* pPluginPathInfo = NULL;

    // TODO: m_pPluginPaths needs to be protected by Mutex

    if (m_pParent)
    {
        return m_pParent->AddPluginPath(pszName, pszPath);
    }

    if (!pszPath || !pszName || !pszName[0] || !pszPath[0])
    {
        return HXR_INVALID_PARAMETER;
    }

    // check whether the same name or path has been added
    if (m_pPluginPaths)
    {
        CHXSimpleList::Iterator i;
        for (i = m_pPluginPaths->Begin(); i != m_pPluginPaths->End(); ++i)
        {
            PluginPathInfo* pTempPluginPathInfo = (PluginPathInfo*)*i;
            if (0 == stricmp(pTempPluginPathInfo->pszName, pszName) ||
                0 == stricmp((const char*)pTempPluginPathInfo->pPath->GetBuffer(), pszPath))
            {
                rc = HXR_OK;
                goto exit;
            }
        }
    }

    pPluginPathInfo = new PluginPathInfo();
    if (!pPluginPathInfo)
    {
        rc = HXR_OUTOFMEMORY;
        goto exit;
    }

    pPluginPathInfo->pszName = new char[strlen(pszName) + 1];
    strcpy(pPluginPathInfo->pszName, pszName);

    rc = CreateStringBufferCCF(pPathBuffer, pszPath, (IUnknown*)(IHXMediaPlatform*)this);
    if (HXR_OK != rc)
    {
        goto exit;
    }

    pPluginPathInfo->pPath = pPathBuffer;
    HX_ADDREF(pPluginPathInfo->pPath);

    if (!m_pPluginPaths)
    {
        m_pPluginPaths = new CHXSimpleList();
        if (!m_pPluginPaths)
        {
            rc = HXR_OUTOFMEMORY;
            goto exit;
        }
    }

    m_pPluginPaths->AddTail(pPluginPathInfo);

    // load the plugins directly if the platform has been initialized
    // otherwise, the plugins will be loaded at Init()
    if (m_bInitialized)
    {
        IHXPluginHandler3* pPluginHandler3 = NULL;

        rc = m_pPluginHandlerUnkown->QueryInterface(IID_IHXPluginHandler3, (void**)&pPluginHandler3);
        if (HXR_OK == rc)
        {
            rc = pPluginHandler3->AddPluginMountPoint(pszName, TARVER_MAJOR_VERSION, 
                                                      TARVER_MINOR_VERSION, pPathBuffer);
        }
        HX_RELEASE(pPluginHandler3);
    }

  exit:

    if (HXR_OK != rc)
    {
        HX_DELETE(pPluginPathInfo);
    }
    HX_RELEASE(pPathBuffer);

    return rc;
}
Beispiel #24
0
HX_RESULT PlayerDriver::SetupPlaybackEngine()
{
	printf("HelixOverWebkit [%s] [%s] [%d]\n", __FILE__, __FUNCTION__, __LINE__);
    HX_RESULT retVal = HXR_OK;

    // get IHXMediaPlatform
    if (!m_pMediaPlatform)
    {
        retVal = HXMediaPlatformObj::CreateMediaPlatform(m_pMediaPlatform);
        if (FAILED(retVal))
        {
            //cout << "Can not load helix media platform." << endl;
			printf("HelixOverWebkit [%s] [%s] [%d] Can not load helix media platform\n", __FILE__, __FUNCTION__, __LINE__);
        }
    }

    // Get IUnknown* context from the media platform
    if (SUCCEEDED(retVal) && !m_pContext)
    {
        retVal = m_pMediaPlatform->QueryInterface(IID_IUnknown, (void**) &m_pContext);
        if (FAILED(retVal))
        {
            //cout << "QueryInterface for IUnknown failed.";
			printf("HelixOverWebkit [%s] [%s] [%d] QueryInterface for IUnknown failed\n", __FILE__, __FUNCTION__, __LINE__);
        }
    }

    // Get CCF for creating engine
    IHXCommonClassFactory* pCCF = NULL;
    if (SUCCEEDED(retVal))
    {
        retVal = m_pMediaPlatform->QueryInterface(IID_IHXCommonClassFactory, (void**)&pCCF);
        if (FAILED(retVal))
        {
            //cout << "QueryInterface for IHXCommonClassFactory failed.";
			printf("HelixOverWebkit [%s] [%s] [%d] QueryInterface for IHXCommonClassFactory failed\n", __FILE__, __FUNCTION__, __LINE__);
        }
    }

    // Create client engine
    if (SUCCEEDED(retVal))
    {
        {
            retVal = pCCF->CreateInstance(CLSID_IHXClientEngine, (void**)&m_pClientEngine);
        }
	if (FAILED(retVal))
        {
            //cout << "Can not create IHXClientEngine via m_pMediaPlatform." << endl;
			printf("HelixOverWebkit [%s] [%s] [%d] Can not create IHXClientEngine via m_pMediaPlatform.\n", __FILE__, __FUNCTION__, __LINE__);
            HXMediaPlatformObj::ResetMediaPlatformNoDelay();
        }
        HX_RELEASE(pCCF);
    }

    if (SUCCEEDED(retVal))
    {
        m_pClientEngine->QueryInterface(IID_IHXPreferences, (void**)&m_pPreferences);
    }

     // Create player
    if (SUCCEEDED(retVal))
    {
        retVal = m_pClientEngine->CreatePlayer(m_pHXPlayer);
        if (FAILED(retVal))
        {
            //cout << "Cannot create player";
			printf("HelixOverWebkit [%s] [%s] [%d] Cannot create player\n", __FILE__, __FUNCTION__, __LINE__);
        }
    }

    // Create client context
    // TODO: context and errorsink
    if (SUCCEEDED(retVal))
    {
        m_pWebkitContext = new WebkitClientContext();
        if (m_pWebkitContext)
        {
            HX_ADDREF(m_pWebkitContext);
            m_pWebkitContext->Init(m_pHXPlayer, m_pMediaPlayer);
        }
        else
        {
			printf("HelixOverWebkit [%s] [%s] [%d] Cannot create client context\n", __FILE__, __FUNCTION__, __LINE__);
            retVal = HXR_FAIL;
        }
    }

    // Make client context available to the player
    if (SUCCEEDED(retVal))
    {
        IUnknown* pUnk = NULL;
        m_pWebkitContext->QueryInterface(IID_IUnknown, (void**)&pUnk);
        if (pUnk)
        			{
            m_pHXPlayer->SetClientContext(pUnk);
            HX_RELEASE(pUnk);
        			}
        else
        			{
        			printf("HelixOverWebkit [%s] [%s] [%d] Cannot create client context\n", __FILE__, __FUNCTION__, __LINE__);
            retVal = HXR_FAIL;
        			}
    }

    // Set error sink
	/*
    if (SUCCEEDED(retVal))
    {
        IHXErrorSinkControl* pErrorSinkControl = NULL;
        IHXErrorSink* pErrorSink = NULL;
        m_pHXPlayer->QueryInterface(IID_IHXErrorSinkControl, (void**) &pErrorSinkControl);
        m_pWebkitContext->QueryInterface(IID_IHXErrorSink, (void**) &pErrorSink);
        if (pErrorSinkControl && pErrorSink)
        {
            pErrorSinkControl->AddErrorSink(pErrorSink, HXLOG_EMERG, HXLOG_INFO);
        }
        else
        {
            //cout << "Cannot set error sink";
            retVal = HXR_FAIL;
        }

        HX_RELEASE(pErrorSinkControl);
        HX_RELEASE(pErrorSink);
    }
	*/

    // Obtain player client state interface
    if (SUCCEEDED(retVal))
    {
        retVal = m_pHXPlayer->QueryInterface(IID_IHXClientState, (void**)&m_pClientState);
        if (FAILED(retVal))
        {
            //cout << "can not get IHXClientState";
			printf("HelixOverWebkit [%s] [%s] [%d] can not get IHXClientState\n", __FILE__, __FUNCTION__, __LINE__);
        }
    }
	printf("HelixOverWebkit [%s] [%s] [%d]\n", __FILE__, __FUNCTION__, __LINE__);

    // Get scheduler
    if (SUCCEEDED(retVal) && !m_pScheduler)
    {
        retVal = m_pMediaPlatform->QueryInterface(IID_IHXScheduler, (void**)&m_pScheduler);
        if (FAILED(retVal))
        {
            //cout << "QueryInterface for IID_IHXScheduler failed.";
			printf("HelixOverWebkit [%s] [%s] [%d] QueryInterface for IID_IHXScheduler failed.\n", __FILE__, __FUNCTION__, __LINE__);
        }
    }

    if (SUCCEEDED(retVal) && !m_pCommandsProcessCallback)
    {
        m_pCommandsProcessCallback = new CHXGenericCallback((void*) this, CommandsProcessCallbackFunc);
        if (m_pCommandsProcessCallback)
        {
            m_pCommandsProcessCallback->AddRef();
        }
        else
        {
            //cout << "Create CHXGenericCallback failed.";
			printf("HelixOverWebkit [%s] [%s] [%d] Create CHXGenericCallback failed.\n", __FILE__, __FUNCTION__, __LINE__);
            retVal = HXR_FAIL;
        }
    }

	printf("HelixOverWebkit [%s] [%s] [%d]\n", __FILE__, __FUNCTION__, __LINE__);
    if (FAILED(retVal))
    {
        CleanupPlaybackEngine();
        m_LastError = retVal;
    }
    else
    {
        m_Init = 0;
    }
	printf("HelixOverWebkit [%s] [%s] [%d]\n setupplaybackengine ends retVal %x\n", __FILE__, __FUNCTION__, __LINE__, retVal);
    if (retVal != HXR_OK)
    	return false;
}
Beispiel #25
0
status_t PlayerDriver::enqueueCommand(PlayerCommand* ec)
{
	printf("HelixOverWebkit [%s] [%s] [%d]\n", __FILE__, __FUNCTION__, __LINE__);
    if (FAILED(m_LastError))
    {
        return m_LastError;
    }

    if (getErrorPending())
    {
        setErrorPending(false);
    }

    bool syncMode = false;

    // If the user didn't specify a completion callback, we
    // are running in synchronous mode.
    if (ec->hasCompletionHook())
    {
        ec->set(PlayerDriver::syncCompletion, this);
        syncMode = true;
    }

    // save command, since ec will be deleted by the standard completion function
    int command = ec->command();

    // Add the command to the queue.
    m_QueueLock.lock();
    //m_CommandQueue.push_front(ec);
    m_CommandQueue.push(ec);

    // Schedule for process
    CHXGenericCallback* pCallback = new CHXGenericCallback((void*) this, CommandsProcessCallbackFunc);
    HX_ADDREF(pCallback);
    if (pCallback && ! pCallback->IsCallbackPending())
	{
    	pCallback->ScheduleRelative(m_pScheduler, 0);
    }
    HX_RELEASE(pCallback);
    m_QueueLock.unlock();

    // If we are in synchronous mode, wait for completion.
    if (syncMode)
    {
        static const char * player_command_type_string[] = {
            "PLAYER_QUIT"                     ,
            "PLAYER_SET_DATA_SOURCE"          ,
            "PLAYER_INIT"                     ,
            "PLAYER_PREPARE"                  ,
            "PLAYER_START"                    ,
            "PLAYER_STOP"                     ,
            "PLAYER_PAUSE"                    ,
            "PLAYER_RESET"                    ,
            "PLAYER_SET_LOOP"                 ,
            "PLAYER_SEEK"                     ,
            "PLAYER_GET_POSITION"             ,
            "PLAYER_GET_DURATION"             ,
            "PLAYER_GET_STATUS"               ,
            "PLAYER_GET_TRACK_INFO_SIZE"      ,
            "PLAYER_GET_ALLTRACK_INFO"        ,
            "PLAYER_GET_CURTRACK_ID"          ,
            "PLAYER_SET_CURTRACK_ID"          ,
            "PLAYER_SET_VELOCITY"             ,
            "PLAYER_GET_VELOCITY"
        };

        //cout << "waiting for handle command %s ..." << player_command_type_string[command - 1]) << endl;
		printf("HelixOverWebkit [%s] [%s] [%d] waiting for handle command\n", __FILE__, __FUNCTION__, __LINE__, player_command_type_string[command - 1]);
        m_pEvent->Wait();
        //cout << "handle command %s OK." << player_command_type_string[command - 1]) << endl;
		printf("HelixOverWebkit [%s] [%s] [%d] handle command %s OK.\n", __FILE__, __FUNCTION__, __LINE__, player_command_type_string[command - 1]);
        if (command == PlayerCommand::PLAYER_QUIT)
        {
            return 0;
        }

        return m_SyncStatus;
    }

    return OK;
}
Beispiel #26
0
STDMETHODIMP
CHXMediaPlatform::Init(IUnknown* pContext)
{
    HX_RESULT           rc = HXR_OK;
    IHXPluginDatabase*  pPluginDatabase = NULL;
    IHXPlugin2Handler*  pPlugin2Handler = NULL;
    IHXPluginHandler3*  pPluginHandler3 = NULL;

    if (m_bInitialized)
    {
        return HXR_FAILED;
    }

    m_pExtContext = pContext;
    HX_ADDREF(m_pExtContext);

    rc = InitExtendableServices();

    if (SUCCEEDED(rc) && !m_pParent)
    {
        // prepare preferences, scheduler etc
        rc = InitBasicServices();
        if (HXR_OK != rc)
        {
            goto exit;
        }

        // create, aggregate and initialize the plugin handler
        if (!m_pPluginHandlerUnkown)
        {
#if defined(_STATICALLY_LINKED) || !defined(HELIX_FEATURE_PLUGINHANDLER2)
#if defined(HELIX_CONFIG_CONSOLIDATED_CORE)
            m_pPluginHandlerUnkown = (IUnknown*)(IHXPlugin2Handler*)new BaseHandler();
#else /* HELIX_CONFIG_CONSOLIDATED_CORE */
            m_pPluginHandlerUnkown = (IUnknown*)(IHXPlugin2Handler*)new HXPluginManager();
#endif /* HELIX_CONFIG_CONSOLIDATED_CORE */
#else
            m_pPluginHandlerUnkown = (IUnknown*)(IHXPlugin2Handler*)new Plugin2Handler();
#endif /* _STATICALLY_LINKED */

            m_pPluginHandlerUnkown->AddRef();

            /*  XXX HP there is some issue with aggregation, need to investigate
            rc = Plugin2Handler::CreateInstance((IUnknown*)(IHXMediaPlatform*)this, (IUnknown**)&m_pPluginHandlerUnkown);
            if (HXR_OK != rc)
            {
            goto exit;
            }
            */
        }

#if !defined(_STATICALLY_LINKED) 
        // PluginDatabase manages the component plugins
        if (HXR_OK == m_pPluginHandlerUnkown->QueryInterface(IID_IHXPluginDatabase, 
                                                             (void**)&pPluginDatabase))
        {
            pPluginDatabase->AddPluginIndex(PLUGIN_COMPONENT_CLSID, kIndex_GUIDType, FALSE);
            pPluginDatabase->AddPluginIndex(PLUGIN_COMPONENT_NAME, kIndex_StringType, FALSE);
        }
        HX_RELEASE(pPluginDatabase);

        if (HXR_OK == m_pPluginHandlerUnkown->QueryInterface(IID_IHXPluginHandler3, (void**)&pPluginHandler3))
        {
            pPluginHandler3->RegisterContext((IUnknown*)(IHXMediaPlatform*)this);

            // tell the plugin handler where to look for additional plugins
            if (m_pPluginPaths)
            {
                CHXSimpleList::Iterator i;
                for (i = m_pPluginPaths->Begin(); i != m_pPluginPaths->End(); ++i)
                {
                    PluginPathInfo* pTempPluginPathInfo = (PluginPathInfo*)*i;
                    pPluginHandler3->AddPluginMountPoint(pTempPluginPathInfo->pszName, TARVER_MAJOR_VERSION,
                                                         TARVER_MINOR_VERSION, pTempPluginPathInfo->pPath);
                }
            }
        
            HX_RELEASE(pPluginHandler3);
        }

        // Load the plugins which have a property that
        // says to load them at media platform startup
        LoadStartupPlugins();
#else
	IHXPlugin2Handler* pPlugin2Handler = NULL;
	if (HXR_OK == m_pPluginHandlerUnkown->QueryInterface(IID_IHXPlugin2Handler, (void**)&pPlugin2Handler))
	{
            pPlugin2Handler->Init((IUnknown*)(IHXMediaPlatform*)this);
        }
        HX_RELEASE(pPlugin2Handler);
#endif /* _STATICALLY_LINKED */	
    }

  exit:
    
    if (HXR_OK == rc)
    {
        m_bInitialized = TRUE;
    }

    return rc;
}
Beispiel #27
0
CHTTPDemux::GetSock(void)
{
    HX_ADDREF(m_pSock);
    return (CHXServSocket*)m_pSock;
}
Beispiel #28
0
HXOpwaveTCPResolvResp::HXOpwaveTCPResolvResp(HXOpwaveTCPSocket* pParent) 
					  : m_lRefCount(0)
					  , m_pParent(pParent)
{
    HX_ADDREF(m_pParent);
}
Beispiel #29
0
void CAVIIndex::Init(CAVIFileFormat* pOuter, IHXFileObject* pFile,
                IUnknown* pContext, UINT32 ulFirstMOVIOffset,
                UINT16 usStreamCount)
{
    //HX_TRACE("CAVIFileFormat::CAVIIndex::Init()\n");

    HX_ASSERT_VALID_PTR(pOuter);
    m_pOuter = pOuter;

	//AddRef m_pOuter

	m_pOuter->AddRef();

	m_pFile = pFile;
    HX_ASSERT_VALID_PTR(m_pFile);
	HX_ADDREF(m_pFile);

    HX_ASSERT_VALID_PTR(pContext);

    m_ulFirstMOVIOffset = m_ulFirstRelativeMOVIOffset = ulFirstMOVIOffset;
    m_ulFirstUnknownChunk = ulFirstMOVIOffset;
    HX_ASSERT(m_ulFirstMOVIOffset);

    HX_ASSERT(usStreamCount);
    m_usStreamCount = usStreamCount;

    m_sliceArray.SetSize(m_usStreamCount);
    for (UINT16 i = 0; i < m_usStreamCount; ++i)
    {
        m_sliceArray[i] = new StreamSlice;
    }

    // See if we're playing from a filesystem that wants to be linear
    // (eg, http). If so, abort the index read, as the index is at
    // the end of an avi file.

    HXBOOL bPreferLinear = FALSE;

    if(m_pFile)
    {
        HX_RESULT res;
        res = m_pFile->Advise(HX_FILEADVISE_RANDOMACCESS);
        if(res == HXR_ADVISE_PREFER_LINEAR)
        {
            // As seen in CAVIIndex::RIFFFindChunkDone when
            // we fail to find an index chunk -- this is
            // basically short circuiting the search
            // for the index.
            m_state = eReady;
            m_pOuter->IOEvent();
            bPreferLinear = TRUE;
        }
    }

    if (!bPreferLinear && m_pFile && pContext)
    {
        m_pReader = new CRIFFReader(pContext, this, m_pFile);
        HX_ADDREF(m_pReader);
        m_pReader->Open("");
    }
}