Allocates a new IltmmMediaSampleDisp object containing a copy of the sample data and all the attributes.
#include "ltmm.h"
Language | Syntax |
---|---|
C | HRESULT IltmmMediaSampleDisp_Clone(pMediaSampleDisp, ppCopy) |
C++ | HRESULT Clone(ppCopy) |
Pointer to the source IltmmMediaSampleDisp interface.
Pointer to the IltmmMediaSampleDisp interface that will contain a complete copy of the data and all the attributes.
Value | Meaning |
---|---|
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. |
This function allows you to make a complete copy of the data and all the attributes contained in an IltmmMediaSampleDisp object. This is useful for keeping an 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.
Win32, x64.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document