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

📄 vidrend.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    QInterfaceList  qiList[] =    {	{ GET_IIDHANDLE(IID_IHXCallback), (IHXCallback*)this},	{ GET_IIDHANDLE(IID_IHXInterruptSafe), (IHXInterruptSafe*)this},	{ GET_IIDHANDLE(IID_IHXUpdateProperties), (IHXUpdateProperties*)this},	{ GET_IIDHANDLE(IID_IHXRenderTimeLine), (IHXRenderTimeLine*)this},#ifdef HELIX_FEATURE_VIDREND_UNTIMED_DECODE	{ GET_IIDHANDLE(IID_IHXUntimedRenderer), (IHXUntimedRenderer*)this},#endif	{ GET_IIDHANDLE(IID_IHXPaceMakerResponse), (IHXPaceMakerResponse*)this},	{ GET_IIDHANDLE(IID_IUnknown), (IUnknown*)(IHXPlugin*) this},	{ GET_IIDHANDLE(IID_IHXPlugin), (IHXPlugin*)this},	{ GET_IIDHANDLE(IID_IHXRenderer), (IHXRenderer*)this},	{ GET_IIDHANDLE(IID_IHXSiteUser), (IHXSiteUser*)this},	{ GET_IIDHANDLE(IID_IHXStatistics), (IHXStatistics*)this},    };    if (QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj) == HXR_OK)    {	return HXR_OK ;    }    else if (m_pMISUS && IsEqualIID(riid, IID_IHXSiteUserSupplier))    {	return m_pMISUS->QueryInterface(IID_IHXSiteUserSupplier,ppvObj);    }    else    {	*ppvObj = NULL;	return HXR_NOINTERFACE;    }}/**************************************************************************** *  Renderer's customizable fuctions - can be called any time *//**************************************************************************** *  GetStreamVersion */void CVideoRenderer::GetStreamVersion(ULONG32 &ulThisMajorVersion,					      ULONG32 &ulThisMinorVersion){    ulThisMajorVersion = STREAM_MAJOR_VERSION;    ulThisMinorVersion = STREAM_MINOR_VERSION;}/**************************************************************************** *  GetContentVersion */void CVideoRenderer::GetContentVersion(ULONG32 &ulThisMajorVersion,					       ULONG32 &ulThisMinorVersion){    ulThisMajorVersion = CONTENT_MAJOR_VERSION;    ulThisMinorVersion = CONTENT_MINOR_VERSION;}/**************************************************************************** *  GetUpgradeMimeType */const char* CVideoRenderer::GetUpgradeMimeType(void){    const char** pStreamMimeTypes = NULL;    UINT32 ulInitialGranularity;    GetRendererInfo(pStreamMimeTypes, ulInitialGranularity);    if (pStreamMimeTypes)    {	return pStreamMimeTypes[0];    }    return NULL;}/**************************************************************************** *  GetRendererName */const char* CVideoRenderer::GetRendererName(void){    return BASE_VIDEO_RENDERER_NAME;}/**************************************************************************** *  GetCodecName */const char* CVideoRenderer::GetCodecName(void){    return NULL;}/**************************************************************************** *  GetCodecFourCC */const char* CVideoRenderer::GetCodecFourCC(void){    return NULL;}/**************************************************************************** *  GetLateFrameTolerance */ULONG32 CVideoRenderer::GetLateFrameTolerance(void){    return LATE_FRAME_TOL;}/**************************************************************************** *  GetEarlyFrameTolerance */ULONG32 CVideoRenderer::GetEarlyFrameTolerance(void){    return EARLY_FRAME_TOL;}/**************************************************************************** *  GetMaxOptimizedVideoLead */ULONG32 CVideoRenderer::GetMaxOptimizedVideoLead(void){    return MAX_OPTIMIZED_VIDEO_LEAD;}/**************************************************************************** *  GetBltPacketQueueSize */ULONG32 CVideoRenderer::GetBltPacketQueueSize(void){    ULONG32 ulSize = BLT_PACKET_QUEUE_SIZE;    if (m_pVideoFormat)    {	m_pVideoFormat->GetMaxDecodedFrames();    }    return ulSize;}/**************************************************************************** *  GetSyncGoalSmoothingDepth */ULONG32 CVideoRenderer::GetSyncGoalSmoothingDepth(void){    return SYNC_GOAL_SMOOTHING_DEPTH;}/**************************************************************************** *  GetSpeedupGoalSmoothingDepth */ULONG32 CVideoRenderer::GetSpeedupGoalSmoothingDepth(void){    return SPEEDUP_GOAL_SMOOTHING_DEPTH;}/**************************************************************************** *  GetNoFramesPollingInterval */ULONG32 CVideoRenderer::GetNoFramesPollingInterval(void){    return NO_FRAMES_POLLING_INTERVAL;}/**************************************************************************** *  GetMaxSleepTime */ULONG32 CVideoRenderer::GetMaxSleepTime(void){    return m_ulMaxSleepTime;}/**************************************************************************** *  GetMaxSleepTime */ULONG32 CVideoRenderer::GetMaxBadSeqSamples(void){    return MAX_BAD_SAMPLE_INTERVAL / m_ulSyncInterval;}/**************************************************************************** *  GetDecodePriority */LONG32 CVideoRenderer::GetDecodePriority(void){    return m_lDecodePriority;}HX_RESULT CVideoRenderer::SetDecodePriority(LONG32 lPriority){    HX_RESULT retVal = HXR_OK;    if (m_pDecoderPump)    {	retVal = m_pDecoderPump->SetPriority(lPriority);    }    if (SUCCEEDED(retVal))    {	m_lDecodePriority = lPriority;    }    return retVal;}/**************************************************************************** *  CreateFormatObject */CVideoFormat* CVideoRenderer::CreateFormatObject(IHXValues* pHeader){    return new CVideoFormat(m_pCommonClassFactory,			    this);}/**************************************************************************** *  SetupBitmapDefaults */void CVideoRenderer::SetupBitmapDefaults(IHXValues* pHeader,					   HXBitmapInfoHeader &bitmapInfoHeader){    // size calculation is taken from crvvideo    bitmapInfoHeader.biSize = sizeof (HXBitmapInfoHeader);    bitmapInfoHeader.biWidth = 0; // 352;	// unknown    bitmapInfoHeader.biHeight = 0; // 288;	// unknown    bitmapInfoHeader.biPlanes = 1;    bitmapInfoHeader.biBitCount = 24;    bitmapInfoHeader.biCompression = HX_I420;    bitmapInfoHeader.biSizeImage = bitmapInfoHeader.biWidth *				     bitmapInfoHeader.biHeight *				     bitmapInfoHeader.biBitCount /				     8;    bitmapInfoHeader.biXPelsPerMeter = 0;    bitmapInfoHeader.biYPelsPerMeter = 0;    bitmapInfoHeader.biClrUsed = 0;    bitmapInfoHeader.biClrImportant = 0;    bitmapInfoHeader.rcolor	= 0;    bitmapInfoHeader.gcolor	= 0;    bitmapInfoHeader.bcolor	= 0;}/**************************************************************************** *  FormatAndSetViewFrame */void CVideoRenderer::FormatAndSetViewFrame(HXxRect* pClipRect,					   HXBitmapInfoHeader &bitmapInfoHeader,					   HXxRect &rViewRect,					   BOOL bMutex){    BOOL bAsDefault = TRUE;    HXxSize szViewFrame;    if (bMutex)    {	DisplayMutex_Lock();    }    if (pClipRect)    {	rViewRect = *pClipRect;	// Insure the ViewRect is inside the bitmap Rect	// Clip x	rViewRect.left = (rViewRect.left > 0) ?	    rViewRect.left : 0;	rViewRect.right = (rViewRect.right > 0) ?	    rViewRect.right : 0;	rViewRect.left = (rViewRect.left < bitmapInfoHeader.biWidth) ?	    rViewRect.left : bitmapInfoHeader.biWidth;	rViewRect.right = (rViewRect.right < bitmapInfoHeader.biWidth) ?	    rViewRect.right : bitmapInfoHeader.biWidth;	// Clip y	rViewRect.top = (rViewRect.top > 0) ?	    rViewRect.top : 0;	rViewRect.bottom = (rViewRect.bottom > 0) ?	    rViewRect.bottom : 0;	rViewRect.top = (rViewRect.top < bitmapInfoHeader.biHeight) ?	    rViewRect.top : bitmapInfoHeader.biHeight;	rViewRect.bottom = (rViewRect.bottom < bitmapInfoHeader.biHeight) ?	    rViewRect.bottom : bitmapInfoHeader.biHeight;    }    else    {	rViewRect.left = 0;	rViewRect.top = 0;	rViewRect.right = bitmapInfoHeader.biWidth;	rViewRect.bottom = bitmapInfoHeader.biHeight;    }    // Compute Size    szViewFrame.cx = rViewRect.right - rViewRect.left;    szViewFrame.cy = rViewRect.bottom - rViewRect.top;    if ((szViewFrame.cx <= 0) || (szViewFrame.cy <= 0))    {	if (m_pClipRect)	{	    szViewFrame.cx = m_pClipRect->right - m_pClipRect->left;	    szViewFrame.cy = m_pClipRect->bottom - m_pClipRect->top;	}	if ((szViewFrame.cx <= 0) || (szViewFrame.cy <= 0))	{	    szViewFrame.cx = DEFAULT_WIN_SIZE_X;	    szViewFrame.cy = DEFAULT_WIN_SIZE_Y;	}    }    if (m_pClipRect)    {	bAsDefault = FALSE;    }    _ResizeViewFrame(szViewFrame, FALSE, TRUE, bAsDefault);    if (bMutex)    {	DisplayMutex_Unlock();    }}/**************************************************************************** *  ResizeViewFrame */BOOL CVideoRenderer::ResizeViewFrame(HXxSize szViewFrame,				     BOOL bMutex){    HX_RESULT retVal;    retVal = _ResizeViewFrame(szViewFrame,			      bMutex,			      FALSE,			      FALSE);    return retVal;}BOOL CVideoRenderer::_ResizeViewFrame(HXxSize szViewFrame,				      BOOL bMutex,				      BOOL bForceSyncResize,				      BOOL bAsDefault){    BOOL bRetVal = FALSE;    if (m_bFrameSizeInitialized)    {	return bRetVal;    }    if (bMutex)    {	DisplayMutex_Lock();    }    if (!m_bFrameSizeInitialized)    {	// If window size is already set, ignore further attempts to	// resize	if (m_bWinSizeFixed)	{	    szViewFrame.cx = m_SetWinSize.cx;	    szViewFrame.cy = m_SetWinSize.cy;	}	// If resulting size invalid, default to cliprect or bitmap size	if ((szViewFrame.cx <= 0) || (szViewFrame.cy <= 0))	{	    if (((szViewFrame.cx <= 0) || (szViewFrame.cy <= 0)) &&		m_pClipRect)	    {		szViewFrame.cx = m_pClipRect->right - m_pClipRect->left;		szViewFrame.cy = m_pClipRect->bottom - m_pClipRect->top;	    }	    if ((szViewFrame.cx <= 0) || (szViewFrame.cy <= 0))	    {		szViewFrame.cx = m_BitmapInfoHeader.biWidth;		szViewFrame.cy = m_BitmapInfoHeader.biHeight;	    }	}	m_SetWinSize.cx = szViewFrame.cx;	m_SetWinSize.cy = szViewFrame.cy;#if !defined(HELIX_FEATURE_VIDREND_DYNAMIC_RESIZE)	m_bWinSizeFixed = (m_bWinSizeFixed || (!bAsDefault));#else        HX_ASSERT(!m_bWinSizeFixed);#endif#ifdef RESIZE_AFTER_SITE_ATTACHED	if (m_bSiteAttached)#endif	// RESIZE_AFTER_SITE_ATTACHED	{#ifdef SET_NONZERO_VIEWFRAME_ONLY	    if ((szViewFrame.cx > 0) && (szViewFrame.cy > 0))#endif	// SET_NONZERO_VIEWFRAME_ONLY	    {#ifdef SYNC_RESIZE_OK		bForceSyncResize = TRUE;#endif	// SYNC_RESIZE_OK		if ((m_LastSetSize.cx != szViewFrame.cx) ||		    (m_LastSetSize.cy != szViewFrame.cy))		{		    m_LastSetSize = szViewFrame;		    if (bForceSyncResize)		    {			m_pMISUSSite->SetSize(szViewFrame);		    }		    else		    {			if (m_pResizeCB == NULL)			{			    m_pResizeCB = new CSetSizeCB(m_pMISUSSite);			    HX_ASSERT(m_pResizeCB);			    if (m_pResizeCB)			    {				m_pResizeCB->AddRef();			    }			}			if (m_pResizeCB)			{			    m_pResizeCB->SetSize(szViewFrame);			    HX_ASSERT(m_pScheduler);			    if (m_pScheduler)			    {				m_pScheduler->RelativeEnter(m_pResizeCB, 0);			    }			}		    }		}	    }	    // Once the the frame size is initialized, it is no longer	    // changable by the renderer.	    // The frame size can become initialzied only of the window	    // size is fixed. It can become fixed only if explicitly set	    // by non-default mode call to ResizeViewFrame.  ResizeViewFrame	    // can be called in non-default mode by either the video format	    // or the call can be made internally based on meta-header	    // specified information (e.g. clip rect.)	    if (m_bWinSizeFixed)	    {		m_bFrameSizeInitialized = TRUE;		bRetVal = TRUE;	    }	}    }    if (bMutex)    {	DisplayMutex_Unlock();    }    return bRetVal;}/**************************************************************************** *  SetSyncInterval */void CVideoRenderer::SetSyncInterval(ULONG32 ulSyncInterval){    if (ulSyncInterval != 0)    {	m_ulSyncInterval = ulSyncInterval;    }}/**************************************************************************** *  InitExtraStats */HX_RESULT CVideoRenderer::InitExtraStats(void){    return HXR_OK;}/**************************************************************************** *  Method: *    CVideoFormat::AdjustVideoMapping * */void CVideoRenderer::AdjustVideoMapping(HXxRect &destRect,					HXxRect &sorcRect,					CMediaPacket*pActiveVideoPacket){    return;}/**************************************************************************** *  Renderer's private fuctions */BOOL CVideoRenderer::ForceRefresh(void){    BOOL bIsVisible;    // Ask what the size was really set to!    HXxSize finalSize;    m_pMISUSSite->GetSize(finalSize);    /* We now damage the entire rect all the time             */    HXxRect damageRect = {0, 0, finalSize.cx, finalSize.cy};    // Mark associated screen area as damaged as well...    m_pMISUSSite->DamageRect(damageRect);    HX_ASSERT(!m_bPendingRedraw);    HX_ASSERT(!m_

⌨️ 快捷键说明

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