Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Multimedia API Help

IltmmMediaSampleDisp::Clone

Show in webframe

#include "ltmm.h"

C Syntax

HRESULT IltmmMediaSampleDisp_Clone(pMediaSampleDisp, ppCopy)

C++ Syntax

HRESULT Clone(ppCopy)

 

IltmmMediaSampleDisp *pMediaSampleDisp;

/* pointer to the interface */

IltmmMediaSampleDisp **ppCopy;

/* pointer to new interface */

Allocates a new IltmmMediaSampleDisp object containing a copy of the sample data and all the attributes.

Parameter

Description

pMediaSampleDisp

Pointer to the source IltmmMediaSampleDisp interface.

ppCopy

Pointer to the IltmmMediaSampleDisp interface that will contain a complete copy of the data and all the attributes.

Returns

S_OK

The function was successful.

<> S_OK

An error occurred. Refer to the Error Codes or the HRESULT error codes in the DirectShow documentation.

Required DLLs and Libraries

This function allows you to make a complete copy of the data and all the attributes contained in a IltmmMediaSampleDisp object. This is useful for keeping a IltmmMediaSampleDisp object for a while longer because getting multiple sample buffers will invalidate the previous buffers. For example, in this code, the second call invalidates the first sample:

void GetSamples(IltmmSampleSource *pSampleSource)

{

   IltmmMediaSampleDisp *pSample1, *pSample2;

   pSampleSource->GetSampleBuffer(1000, &pSample1); // pSample1 becomes valid

   pSampleSource->GetSampleBuffer(1000, &pSample2); // pSample2 is valid but pSample1 is invalid

   /* Do something with both samples */

}

Can be changed to something like this:

void GetSamples(IltmmSampleSource *pSampleSource)

{

   IltmmMediaSampleDisp *pSample1, *pSample2;

   pSampleSource->GetSampleBuffer(1000, &pSample2); // pSample2 becomes valid

   pSample2->Clone(&pSample1);                      // pSample1 is valid and a full copy of pSample2

   pSample2->Release();                             // Release pSample2. pSample1 is still valid

   pSampleSource->GetSampleBuffer(1000, &pSample2); // pSample1 and pSample2 are both valid

   /* Do something with both samples */

}

This function is similar to IltmmMediaSampleDisp::CopyTo, except that this function creates a new IltmmMediaSampleDisp interface, copies everything into it and then returns the newly created object.

Required DLLs and Libraries

LTMM

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64

See Also

Functions:

IltmmMediaSampleDisp::CopyTo, IltmmMediaSampleDisp::get_ActualDataLength, IltmmMediaSampleDisp::get_Buffer, IltmmMediaSampleDisp::get_BufferSize, IltmmMediaSampleDisp::get_Discontinuity, IltmmMediaSampleDisp::get_Preroll, IltmmMediaSampleDisp::get_SyncPoint, IltmmMediaSampleDisp::GetData, IltmmMediaSampleDisp::GetMediaTime, IltmmMediaSampleDisp::GetMediaType, IltmmMediaSampleDisp::GetTime, IltmmMediaSampleDisp::put_ActualDataLength, IltmmMediaSampleDisp::put_Discontinuity, IltmmMediaSampleDisp::put_Preroll, IltmmMediaSampleDisp::put_SyncPoint, IltmmMediaSampleDisp::ResetMediaTime, IltmmMediaSampleDisp::ResetTime, IltmmMediaSampleDisp::SetMediaTime, IltmmMediaSampleDisp::SetMediaType, IltmmMediaSampleDisp::SetTime

Topics:

Multimedia Function Group

 

IltmmMediaSampleDisp interface

 

ltmmMediaSample object

 

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.