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

📄 cmediasample.c

📁 君正早期ucos系统(只有早期的才不没有打包成库),MPLAYER,文件系统,图片解码,浏览,电子书,录音,想学ucos,识货的人就下吧 russblock fmradio explore set
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Modified for use with MPlayer, detailed changelog at * http://svn.mplayerhq.hu/mplayer/trunk/ * $Id: cmediasample.c,v 1.2 2008/03/03 08:11:38 dsqiu Exp $ */#include "cmediasample.h"#include "mediatype.h"#include "wine/winerror.h"#include <mplaylib.h>#include <mplaylib.h>#include <mplaylib.h>/* * currently hack to make some extra room for DS Acel codec which * seems to overwrite allocated memory - FIXME better later * check the buffer allocation */static const int SAFETY_ACEL = 1024;/** * \brief IPin::QueryInternalConnections (retries pin's internal connections) * * \param[in]     This  pointer to IPin interface * \param[out]    apPin Array that receives pins, internally connected to this * \param[in,out] nPint Size of an array * * \return S_OK - success * \return S_FALSE - pin rejects media type * \return E_NOTIMPL - not implemented * */static long STDCALL CMediaSample_QueryInterface(IUnknown* This,						/* [in] */ const GUID* iid,						/* [iid_is][out] */ void **ppv){    Debug printf("CMediaSample_QueryInterface(%p) called\n", This);    if (!ppv)	return E_INVALIDARG;    if (memcmp(iid, &IID_IUnknown, sizeof(*iid)) == 0)    {	*ppv = (void*)This;	((IMediaSample*) This)->vt->AddRef(This);	return 0;    }    if (memcmp(iid, &IID_IMediaSample, sizeof(*iid)) == 0)    {	*ppv = (void*)This;	((IMediaSample*) This)->vt->AddRef(This);	return 0;    }    return E_NOINTERFACE;}/** * \brief IUnknown::AddRef (increases reference counter for interface) * * \param[in]  This pointer to IUnknown class * * \return new value of reference counter * * \remarks * Return value should be used only for debug purposes * */static long STDCALL CMediaSample_AddRef(IUnknown* This){    Debug printf("CMediaSample_AddRef(%p) called\n", This);    ((CMediaSample*)This)->refcount++;    return 0;}/** * \brief CMediaSample destructor * * \param[in] This pointer to CMediaSample object * */void CMediaSample_Destroy(CMediaSample* This){    Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount);    free(This->vt);    free(This->own_block);    if(((CMediaSample*)This)->type_valid)	FreeMediaType(&(This->media_type));    free(This);}/** * \brief IUnknown::Release (desreases reference counter for interface) * * \param[in]  This pointer to IUnknown class * * \return new value of reference counter * * \remarks * When reference counter reaches zero calls destructor * Return value should be used only for debug purposes * */static long STDCALL CMediaSample_Release(IUnknown* This){    CMediaSample* parent = (CMediaSample*)This;    Debug printf("CMediaSample_Release(%p) called  (new ref:%d)\n",		 This, ((CMediaSample*)This)->refcount-1);    if (--((CMediaSample*) This)->refcount == 0)    {	parent->all->vt->ReleaseBuffer((IMemAllocator*)(parent->all),				       (IMediaSample*)This);    }    return 0;}/** * \brief IMediaSample::GetPointer (retrieves a read/write pointer to the media sample's buffer) * * \param[in] This pointer to CMediaSample object * \param[out] address of variable that receives pointer to sample's buffer * * \return S_OK success * \return apropriate error otherwise  * * \note The calles should not free or reallocate buffer * */static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This,					       /* [out] */ BYTE** ppBuffer){    Debug printf("CMediaSample_GetPointer(%p) called -> %p, size: %d  %d\n", This, ((CMediaSample*) This)->block, ((CMediaSample*)This)->actual_size, ((CMediaSample*)This)->size);    if (!ppBuffer)	return E_INVALIDARG;    *ppBuffer = (BYTE*) ((CMediaSample*) This)->block;    return 0;}/** * \brief IMediaSample::GetSize (retrieves a size of buffer in bytes) * * \param[in] This pointer to CMediaSample object * * \return size of buffer in bytes * */static long STDCALL CMediaSample_GetSize(IMediaSample * This){    Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size);    return ((CMediaSample*) This)->size;}/** * \brief IMediaSample::GetTime (retrieves a stream time at wich sample sould start and finish) * * \param[in] This pointer to CMediaSample object * \param[out] pTimeStart pointer to variable that receives start time * \param[out] pTimeEnd pointer to variable that receives end time * * \return S_OK success * \return VFW_E_NO_STOP_TIME The sample has valid start time, but no stop time * \return VFW_E_SAMPLE_TIME_NOT_SET The sample is not time-stamped  * * \remarks * Both values are relative to stream time * */static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This,					    /* [out] */ REFERENCE_TIME *pTimeStart,					    /* [out] */ REFERENCE_TIME *pTimeEnd){    Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This);    return E_NOTIMPL;}/** * \brief IMediaSample::SetTime (sets a stream time at wich sample sould start and finish) * * \param[in] This pointer to CMediaSample object * \param[out] pTimeStart pointer to variable that contains start time * \param[out] pTimeEnd pointer to variable that contains end time * * \return S_OK success * \return apropriate error otherwise * * \remarks * Both values are relative to stream time * To invalidate the stream times set pTimeStart and pTimeEnd to NULL. this will cause * IMEdiaSample::GetTime to return VFW_E_SAMPLE_TIME_NOT_SET * */static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This,					    /* [in] */ REFERENCE_TIME *pTimeStart,					    /* [in] */ REFERENCE_TIME *pTimeEnd){    Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This);    return E_NOTIMPL;}/** * \brief IMediaSample::IsSyncPoint (determines if start of this sample is sync point) * * \param[in] This pointer to CMediaSample object * * \return S_OK start of this sample is sync point * \return S_FALSE start of this sample is not sync point * * \remarks * If bTemporalCompression of AM_MEDIA_TYPE is FALSE, all samples are sync points. * */static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This){    Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This);    if (((CMediaSample*)This)->isSyncPoint)	return 0;    return 1;}/** * \brief IMediaSample::SetSyncPoint (specifies if start of this sample is sync point) * * \param[in] This pointer to CMediaSample object * \param[in] bIsSyncPoint specifies whether this is sync point or not * * \return S_OK success * \return apropriate error code otherwise * */static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This,						 long bIsSyncPoint){    Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This);    ((CMediaSample*)This)->isSyncPoint = bIsSyncPoint;    return 0;}/** * \brief IMediaSample::IsPreroll (determines if this sample is preroll sample) * * \param[in] This pointer to CMediaSample object * * \return S_OK if this sample is preroll sample * \return S_FALSE if this sample is not preroll sample * * \remarks * Preroll samples are processed but  not displayed. They are lokated in media stream * before displayable samples. * */static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This){    Debug printf("CMediaSample_IsPreroll(%p) called\n", This);    if (((CMediaSample*)This)->isPreroll)	return 0;//S_OK    return 1;//S_FALSE}/** * \brief IMediaSample::SetPreroll (specifies if this sample is preroll sample) * * \param[in] This pointer to CMediaSample object * \param[in] bIsPreroll specifies whether this sample is preroll sample or not * * \return S_OK success * \return apropriate error code otherwise * * \remarks * Preroll samples are processed but  not displayed. They are lokated in media stream * before displayable samples. * */static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This,					       long bIsPreroll){    Debug printf("CMediaSample_SetPreroll(%p) called\n", This);    ((CMediaSample*)This)->isPreroll=bIsPreroll;    return 0;}/** * \brief IMediaSample::GetActualDataLength (retrieves the length of valid data in the buffer) * * \param[in] This pointer to CMediaSample object * * \return length of valid data in buffer in bytes * */

⌨️ 快捷键说明

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