hvviddec.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 527 行 · 第 1/2 页

CPP
527
字号
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::DecideBufferSize(void)
{
	return( HXR_OK );
}


/**********************************************************************
 *
 *	StartStreaming
 *
 *	PARAMETERS:		None
 *
 *	RETURNS:		
 *
 *		HRESULT:	Returns NOERROR if this function is successful,
 *					otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function gets called by the base filter classes whenever
 *		this filter is in the process of switching to active mode,
 *		paused or running.
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::StartStreaming(
	const HXVA_Image_Format &src_fmt,
    const HXVA_Image_Format &dst_fmt
	) 
{
// this call is made to lock the critical section guarding this filter 
// critical sections need to be locked in order to protect data during 
// multithreading operations
//CAutoLock	cFilterLock( &m_csFilter );

	HX_RESULT	lResult	= HXR_OK;	// checks the return of called functions

	// try to load the video codec into global memory
	lResult	= TheCodec().Load();
	if ( lResult != HXR_OK )				// if it could not be loaded
		return( HXR_FAIL );			// return an error

	TheCodec().Enable();			// enable the video codec for use	

	// GNEEL: SEND DOWN FID
	m_pcVideoCodec = TheCodec().OpenInstance( );

	if ( NULL == m_pcVideoCodec )	// if the video codec instance could not be created
		return( HXR_OUTOFMEMORY );	// return an out of memory error

	m_input_format = src_fmt;
	m_output_format = dst_fmt;
	return( HXR_OK );
}


/**********************************************************************
 *
 *	StopStreaming
 *
 *	PARAMETERS:		None
 *
 *	RETURNS:		
 *
 *		HRESULT:	Returns NOERROR if this function is successful,
 *					otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function gets called by the base filter classes whenever
 *		this transform filter is in the process of leaving active mode
 *		and entering stopped mode.
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::StopStreaming( void )
{
// this call is made to lock the critical sections guarding this filter 
// and receiving thread; critical sections need to be locked in order to
// protect data during multithreading operations
//CAutoLock	cFilterLock( &m_csFilter ),
//			cReceiveLock( &m_csReceive );

	if ( NULL == m_pcVideoCodec )
		return( HXR_FAIL );

	//end compression before deleting the pointer, otherwise codec stays open
	HX_RESULT	lResult	= HXR_OK;	// checks the return of called functions
	if ( m_bStartDecompress == TRUE )	{
		lResult = m_pcVideoCodec->DecompressEnd();
		if ( lResult == HXR_OK )	{
			m_bStartDecompress = FALSE;
		}
	}

	// terminate the video codec instance to remove it from memory
	TheCodec().CloseInstance( (HXH263CodecInstance*) m_pcVideoCodec );
	m_pcVideoCodec	= NULL;

	TheCodec().Disable();

	TheCodec().Free();

	return( HXR_OK );
}


/**********************************************************************
 *
 *	EndOfStream
 *
 *	PARAMETERS:		None
 *
 *	RETURNS:		
 *
 *		HRESULT:	Returns NOERROR if this function is successful,
 *					otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function gets called from the output pin whenever
 *		the output data has reached the end of the stream.  If this
 *		function is overridden, the end-of-stream notification must
 *		be passed to the next filter.
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::EndOfStream( void )
{
// this call is made to lock the critical section guarding the receiving 
// thread; critical sections need to be locked in order to protect data 
// during multithreading operations
//CAutoLock cReceiveLock(&m_csReceive);

    if ( NULL == m_pcVideoCodec ) 
	{
        return HXR_FAIL;
    }

	// return the end-of-stream notification to the next filter that
	// is connected to this filter
    return HXR_OK;
}


/**********************************************************************
 *
 *	EndFlush
 *
 *	PARAMETERS:		None
 *
 *	RETURNS:		
 *
 *		HRESULT:	Returns NOERROR if this function is successful,
 *					otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function gets called from the input pin whenever the
 *		pin is leaving the flushing state.  If this function is 
 *		overridden, the notification must be passed to the next filter.
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::EndFlush( void )
{
// this call is made to lock the critical section guarding the receiving 
// thread; critical sections need to be locked in order to protect data 
// during multithreading operations
//CAutoLock cReceiveLock(&m_csReceive);

	// return the flushing notification to the next filter that is
	// connected to this filter
    return HXR_OK;
}

/**********************************************************************
 *
 *	GetMediaType
 *
 *	PARAMETERS:		
 *
 *		nPosition:	the position of the media type in the media type list
 *		pcMediaType:the returned output pin media type
 *
 *	RETURNS:		
 *
 *		HRESULT:	Returns NOERROR if this function is successful,
 *					otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function is called by the base filter classes to supply
 *		one of the media types that the output pin supports based on
 *		the position of the media type, nPosition, in the media type list.
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::GetMediaType( void )
{
    return( HXR_OK );
}


/**********************************************************************
 *
 *	CheckInputType
 *
 *	PARAMETERS:		
 *
 *		pcInMediaType:	the media type associated with the input pin
 *
 *	RETURNS:		
 *
 *		HRESULT:		Returns NOERROR if this function is successful,
 *						otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function gets called by the base filter classes to 
 *		verify that the input pin supports the input media type
 *		and to propose an output pin media type based on the 
 *		input pin media type.
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::CheckInputType( void )
{
	return HXR_OK;
}


/**********************************************************************
 *
 *	CheckTransform
 *
 *	PARAMETERS:		
 *
 *		pcInMediaType:	the media type associated with the input pin
 *		pcOutMediaType:	the media type associated with the output pin
 *
 *	RETURNS:		
 *
 *		HRESULT:		Returns NOERROR if this function is successful,
 *						otherwise returns the error that occurred.
 *
 *	DESCRIPTION:	
 *
 *		This function gets called by the base filter classes to verify
 *		that th input and output pins support their media types
 *
 *********************************************************************/
HX_RESULT
VvVideoDecoderFilter::CheckTransform( void )
{
    return HXR_OK;
}
//*** end VvVideoDecoderFilter class ***

⌨️ 快捷键说明

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