Thursday, January 31, 2008

How to create memory for IMediaSample Queue ?

we can create the Object for the IMediaSample as follows :
typedef IMediaSample* PIMediaSample;
//For Memory allocation PIMediaSample *pSamples = new PIMediaSample[100];
//For Memory Release delete[] pSamples;

For Queue for the Output Pin, we can use COutputQueue class or we can use Queue

Queue <> samplesQ;
BYTE* pbData,*pbFrameBytes;
unsigned long FrameSize;
PIMediaSample* pSample = new PIMediaSample();
pSample->GetPointer(&pbData); memcpy(pbData,pbFrameBytes,FrameSize);
samplesQ.Push(pSample);

PIMediaSample* pSample; samplesQ.Pop(pSample); //Sample is Removed from Queue Deliver(pSample); pSample->Release(); // Here the sample is released.

otherwise we may use COutputQueue. It supports queueing of Media Samples.
COutputQueue * pOutputQueue;

No comments: