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

📄 vidrend.h

📁 linux下的一款播放器
💻 H
📖 第 1 页 / 共 2 页
字号:
    //	    render it's stream data accordingly.
    //
    STDMETHOD (OnTimeSync)	(THIS_
				ULONG32		    ulTime);

    /////////////////////////////////////////////////////////////////////////
    //  Method:
    //	    IHXRenderer::OnPreSeek
    //  Purpose:
    //	    Called by client engine to inform the renderer that a seek is
    //	    about to occur. The render is informed the last time for the 
    //	    stream's time line before the seek, as well as the first new
    //	    time for the stream's time line after the seek will be completed.
    //
    STDMETHOD (OnPreSeek)	(THIS_
				ULONG32		    ulOldTime,
				ULONG32		    ulNewTime);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //	    IHXRenderer::OnPostSeek
    //	Purpose:
    //	    Called by client engine to inform the renderer that a seek has
    //	    just occured. The render is informed the last time for the 
    //	    stream's time line before the seek, as well as the first new
    //	    time for the stream's time line after the seek.
    //
    STDMETHOD (OnPostSeek)	(THIS_
				ULONG32		    ulOldTime,
				ULONG32		    ulNewTime);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //	    IHXRenderer::OnPause
    //	Purpose:
    //	    Called by client engine to inform the renderer that a pause has
    //	    just occured. The render is informed the last time for the 
    //	    stream's time line before the pause.
    //
    STDMETHOD (OnPause)		(THIS_
				ULONG32		    ulTime);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //		IHXRenderer::OnBegin
    //	Purpose:
    //		Called by client engine to inform the renderer that a begin or
    //		resume has just occured. The render is informed the first time 
    //		for the stream's time line after the resume.
    //
    STDMETHOD (OnBegin)		(THIS_
				ULONG32		    ulTime);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //		IHXRenderer::OnBuffering
    //	Purpose:
    //		Called by client engine to inform the renderer that buffering
    //		of data is occuring. The render is informed of the reason for
    //		the buffering (start-up of stream, seek has occured, network
    //		congestion, etc.), as well as percentage complete of the 
    //		buffering process.
    //
    STDMETHOD (OnBuffering)	(THIS_
				ULONG32		    ulFlags,
				UINT16		    unPercentComplete);

    /////////////////////////////////////////////////////////////////////////
    //	Method:
    //		IHXRenderer::GetDisplayType
    //	Purpose:
    //		Called by client engine to ask the renderer for it's preferred
    //		display type. When layout information is not present, the 
    //		renderer will be asked for it's prefered display type. Depending
    //		on the display type a buffer of additional information may be 
    //		needed. This buffer could contain information about preferred
    //		window size.
    //
    STDMETHOD (GetDisplayType)	(THIS_
				REF(HX_DISPLAY_TYPE)	ulFlags,
				REF(IHXBuffer*)	pBuffer);

    /************************************************************************
     *	Method:
     *	    IHXRenderer::OnEndofPackets
     *	Purpose:
     *	    Called by client engine to inform the renderer that all the
     *	    packets have been delivered. However, if the user seeks before
     *	    EndStream() is called, renderer may start getting packets again
     *	    and the client engine will eventually call this function again.
     */
    STDMETHOD(OnEndofPackets)	(THIS);

    /*
     * IHXSiteUser methods called by the "context" to 
     * associate users with the site.
     */
    STDMETHOD(AttachSite)	(THIS_
				IHXSite*	/*IN*/ pSite);

    STDMETHOD(DetachSite)	(THIS);

    STDMETHOD_(BOOL,NeedsWindowedSites)	(THIS);

    STDMETHOD_(BOOL, IsInterruptSafe)	(THIS) { return TRUE; }

    /*
     * IHXSiteUser methods called to inform user of an event.
     */
    STDMETHOD(HandleEvent)	(THIS_
				HXxEvent*	/*IN*/ pEvent);

    /*
     * IHXCallback method - backbone of renderer scheduling
     */
    /************************************************************************
     *	Method:
     *	    IHXCallback::Func
     *	Purpose:
     *	    This is the function that will be called when a callback is
     *	    to be executed.
     */
    STDMETHOD(Func)		(THIS);


    /*
     * IHXStatistics methods
     */
    STDMETHOD(InitializeStatistics) (THIS_ UINT32 ulRegistryID);
    STDMETHOD(UpdateStatistics)     (THIS);

    /*
     * IHXUntimedRenderer methods
     */
#ifdef HELIX_FEATURE_VIDREND_UNTIMED_DECODE
    STDMETHOD_(BOOL,IsUntimedRendering)(THIS);
    STDMETHOD_(HX_RESULT,SetUntimedRendering)(THIS_ BOOL);
#endif /* HELIX_FEATURE_VIDREND_UNTIMED_DECODE */
    /************************************************************************
     *	Method:
     *	    IHXUpdateProperties::UpdatePacketTimeOffset
     *	Purpose:
     *	    Call this method to update the timestamp offset of cached packets
     */
    STDMETHOD(UpdatePacketTimeOffset) (THIS_ INT32 lTimeOffset);

    /************************************************************************
     *	Method:
     *	    IHXUpdateProperties::UpdatePlayTimes
     *	Purpose:
     *	    Call this method to update the playtime attributes
     */
    STDMETHOD(UpdatePlayTimes)	      (THIS_
				       IHXValues* pProps);

    /************************************************************************
     *  Method:
     *      IHXRenderTimeLine::GetTimeLineValue
     *  Purpose:
     *      Get the current presentation time
     *
     *  Notes:
     *      returns HXR_TIMELINE_SUSPENDED when the time line is suspended
     */
    STDMETHOD (GetTimeLineValue) (THIS_ /*OUT*/ REF(UINT32) ulTime);


    /*
     *	IHXPaceMakerResponse
     */
    STDMETHOD(OnPaceStart)	(THIS_
				ULONG32 ulId);

    STDMETHOD(OnPaceEnd)	(THIS_
				ULONG32 ulId);

    STDMETHOD(OnPace)		(THIS_
				ULONG32 ulId);


    /************************************************************************
     *	Public CVideoRenderer functions
     */
    virtual BOOL ResizeViewFrame(HXxSize szViewFrame, BOOL bMutex = TRUE);
    
    void BltIfNeeded(void) 
    {
	if (m_bUseVideoSurface2)
	{
	    if (m_PlayState == Playing)
	    {
		if (m_bOSGranuleBoostVS2)
		{
		    ForceDisplayUpdate(TRUE);
		}
	    }
	    else
	    {
		SchedulerCallback(FALSE,    // not scheduled 
				  FALSE,    // do not resched    
				  TRUE,	    // is VS2 call
				  TRUE);    // process non-displayable frames only
		if (m_pBltrPump)
		{
		    m_pBltrPump->Signal();
		}
	    }
	}
	else if (m_hPendingHandle != ((CallbackHandle) NULL))
	{
            if ((!m_bVS1UpdateInProgress) &&
                (m_bOSGranuleBoost || (m_PlayState != Playing)))
	    {
		SchedulerCallback(m_bIsScheduledCB, FALSE);
	    }
	}
    }

    LONG32 ComputeTimeAhead(ULONG32 ulTime, 
			    ULONG32 ulTolerance, 
			    ULONG32* p_ulBaseTime = NULL)
    {
	LONG32 lTimeAhead = ulTime;
	ULONG32 ulTimeNow = 0;

	if (m_PlayState == Playing)
	{
	    ulTimeNow = HX_GET_BETTERTICKCOUNT();

	    /***
	    lTimeAhead = ((LONG32) (ulTime - m_ulBaseTime + ulTolerance)) -
			  ((LONG32) (ulTimeNow - m_ulStreamBaseTime));
	    ***/

	    lTimeAhead = (LONG32) (ulTime + ulTolerance - 
				   ulTimeNow + m_ulTimeNormalizationOffset);
	}
	else
	{
	    lTimeAhead = (LONG32) (ulTime - m_ulBaseTime - m_lTimeLineOffset);
	}
	
	if (p_ulBaseTime)
	{
	    *p_ulBaseTime = ulTimeNow;
	}

#ifdef HELIX_FEATURE_VIDREND_UNTIMED_DECODE
	// In untimed mode, we have to present a false timeline so anybody calling this thinks
	//  we are running just a bit ahead of real time. The way we do this is relating the
	//  reference packet time (ulTime) to the current packet time, rather than against real
	//  time.
	if( m_bUntimedRendering )
	{
	    return ulTime - (INT32)m_ulActiveVideoTime;
	}
#endif /* HELIX_FEATURE_VIDREND_UNTIMED_DECODE */
	return lTimeAhead;
    }

    LONG32 DiffTime(ULONG32 t1, ULONG32 t2)  { return ((LONG32) (t1 - t2)); }

    IUnknown* GetContext(void)
    {
	return m_pContext;
    }

    IHXPreferences* GetPreferences(void)
    {
	return m_pPreferences;
    }

    const HXBitmapInfoHeader* GetCurrentBitmapInfo(void)
    {
	return &m_BitmapInfoHeader;
    }

    IHXSite* GetAttachedSite(void)
    {
	return m_pMISUSSite;
    }

    void ReleaseFramePacket(CMediaPacket *pPacket);

    HX_RESULT LocalizeActiveVideoPacket(void);

    inline BOOL IsActive(void)    { return (m_PlayState == Playing); }
    inline BOOL IsSeeking(void)    { return (m_PlayState == Seeking); }

    HX_RESULT SetDecodePriority(LONG32 lPriority);

#if defined(HELIX_FEATURE_STATS)
    /************************************************************************
     *	Public Statistics Methods
     */
    void ReportLostFrame(ULONG32 ulCount = 1)
    {
	m_pVideoStats->ReportLostFrame(ulCount);
    }

    void ReportDroppedFrame(ULONG32 ulCount = 1)  
    {
	m_pVideoStats->ReportDroppedFrame(ulCount);
    }

    HX_RESULT ReportStat(VideoStatEntryID eEntryID, const char* pVal)
    {
	return m_pVideoStats->ReportStat(eEntryID, pVal);
    }
    
    HX_RESULT ReportStat(VideoStatEntryID eEntryID, INT32 lVal)
    {
	return m_pVideoStats->ReportStat(eEntryID, lVal);
    }
#else	// HELIX_FEATURE_STATS
    /************************************************************************
     *	Public Statistics Methods
     */
    void ReportLostFrame(ULONG32 ulCount = 1)
    {
	return;
    }

    void ReportDroppedFrame(ULONG32 ulCount = 1)  
    {
	return;
    }

    HX_RESULT ReportStat(VideoStatEntryID eEntryID, const char* pVal)
    {
	return HXR_OK;
    }
    
    HX_RESULT ReportStat(VideoStatEntryID eEntryID, INT32 lVal)
    {
	return HXR_OK;
    }
#endif	// HELIX_FEATURE_STATS

protected:

    /*
     *	Renderer's customizable fuctions - can be called any time
     */
    /*
     *	Fixed Renderer Configuration - must be callable at any time
     */
    virtual const char* GetUpgradeMimeType(void);

    virtual const char* GetRendererName(void);

    virtual const char* GetCodecName(void);

    virtual const char* GetCodecFourCC(void);


    /*
     *	Renderer Configuration - must be callable any time
     *                           after reception of the header
     */
    virtual void GetStreamVersion(ULONG32 &ulThisMajorVersion, 
				  ULONG32 &ulThisMinorVersion);

    virtual void GetContentVersion(ULONG32 &ulThisMajorVersion, 
				   ULONG32 &ulThisMinorVersion);

    virtual ULONG32 GetLateFrameTolerance(void);

    virtual ULONG32 GetEarlyFrameTolerance(void);

    virtual ULONG32 GetMaxOptimizedVideoLead(void);

    virtual ULONG32 GetBltPacketQueueSize(void);

    virtual ULONG32 GetSyncGoalSmoothingDepth(void);

    virtual ULONG32 GetSpeedupGoalSmoothingDepth(void);

    virtual ULONG32 GetNoFramesPollingInterval(void);

    virtual ULONG32 GetMaxSleepTime(void);

    virtual ULONG32 GetMaxBadSeqSamples(void);

    virtual LONG32 GetDecodePriority(void);

    virtual CVideoFormat* CreateFormatObject(IHXValues* pHeader);

    
    /*
     *	Renderer Setup - must be callable after the renderer attaches the site
     */
    virtual void SetupBitmapDefaults(IHXValues* pHeader,
				     HXBitmapInfoHeader &bitmapInfoHeader);

    virtual void FormatAndSetViewFrame(HXxRect* pClipRect,
				       HXBitmapInfoHeader &bitmapInfoHeader,
				       HXxRect &rViewRect,
				       BOOL bMutex = TRUE);

    /*
     *	Renderer Execution - must be callable anytime
     */
    virtual HX_RESULT OnOptimizedVideo(HX_RESULT status,
				       const HXBitmapInfoHeader& sourceBIH,
				       HXBitmapInfoHeader &targetBIH, 
				       ULONG32 &ulTargetBufCount);

    virtual void OffOptimizedVideo(void);

    virtual HX_RESULT TransferOptimizedVideo(IHXVideoSurface2* pVideoSurface2,
                                             VideoMemStruct* pVideoMemoryInfo,
                                             CMediaPacket* pVideoPacket,
                                             const HXBitmapInfoHeader& sorcBIH,
                                             HXxRect &destRect,
                                             HXxRect &sorcRect);

    virtual void AdjustVideoMapping(HXxRect &destRect, 
				    HXxRect &sorcRect,
				    CMediaPacket*pActiveVideoPacket);

    virtual HX_RESULT InitExtraStats(void);

    /*
     *	Base Renderer Setup - must be called if the base renderer overrides
     &			      the report of the related values to the core
     */
    void SetSyncInterval(ULONG32 ulSyncInterval);

    /*
     *	Renderer's member variables sharable with the derived renderer
     */
    IUnknown*				m_pContext;
    IHXStream*				m_pStream;
    IHXValues*				m_pHeader;
    
    IHXBackChannel*			m_pBackChannel;
    IHXMultiInstanceSiteUserSupplier*	m_pMISUS;
    IHXSite*				m_pMISUSSite;
    IHXCommonClassFactory*		m_pCommonClassFactory;
    IHXPreferences*			m_pPreferences;
    IHXRegistry*			m_pRegistry;
    ULONG32				m_ulRegistryID;

    CMediaPacket*			m_pActiveVideoPacket;
    ULONG32				m_ulActiveVideoTime;
#ifdef HELIX_FEATURE_VIDREND_UNTIMED_DECODE
    BOOL				m_bUntimedRendering;
#endif /* HELIX_FEATURE_VIDREND_UNTIMED_DECODE */
    BOOL				m_bActiveVideoPacketLocalized;
};

#endif // _VIDREND_H_

⌨️ 快捷键说明

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