Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Windows::Media::MFSample Class Reference

#include <HWMFObjects.h>

Inheritance diagram for Harlinn::Windows::Media::MFSample:
[legend]
Collaboration diagram for Harlinn::Windows::Media::MFSample:
[legend]

Public Member Functions

void GetSampleFlags (DWORD *sampleFlags) const
 
DWORD GetSampleFlags () const
 
void SetSampleFlags (DWORD sampleFlags) const
 
void GetSampleTime (LONGLONG *sampleTime) const
 
TimeSpan GetSampleTime () const
 
void SetSampleTime (LONGLONG sampleTime) const
 
void SetSampleTime (const TimeSpan &sampleTime) const
 
void GetSampleDuration (LONGLONG *sampleDuration) const
 
TimeSpan GetSampleDuration () const
 
void SetSampleDuration (LONGLONG sampleDuration) const
 
void SetSampleDuration (const TimeSpan &sampleDuration) const
 
void GetBufferCount (DWORD *bufferCount) const
 
DWORD GetBufferCount () const
 
void GetBufferByIndex (DWORD index, IMFMediaBuffer **buffer) const
 
MFMediaBuffer GetBufferByIndex (DWORD index) const
 
void ConvertToContiguousBuffer (IMFMediaBuffer **buffer) const
 
MFMediaBuffer ConvertToContiguousBuffer () const
 
void AddBuffer (IMFMediaBuffer *buffer) const
 
void AddBuffer (const MFMediaBuffer &buffer) const
 
void RemoveBufferByIndex (DWORD index) const
 
void RemoveAllBuffers () const
 
void GetTotalLength (DWORD *totalLength) const
 Retrieves the total length of the valid data in all of the buffers in the sample. The length is calculated as the sum of the values retrieved by the IMFMediaBuffer::GetCurrentLength method.
 
DWORD GetTotalLength () const
 Retrieves the total length of the valid data in all of the buffers in the sample. The length is calculated as the sum of the values retrieved by the IMFMediaBuffer::GetCurrentLength method.
 
void CopyToBuffer (IMFMediaBuffer *buffer) const
 
void CopyToBuffer (const MFMediaBuffer &buffer) const
 
bool Get3DVideo () const
 Specifies whether a media sample contains a 3D video frame.
 
void Set3DVideo (bool value) const
 Specifies whether a media sample contains a 3D video frame.
 
MFVideo3DSampleFormat Get3DVideoSampleFormat () const
 Specifies how a 3D video frame is stored in a media sample.
 
void Set3DVideoSampleFormat (MFVideo3DSampleFormat video3DSampleFormat) const
 
bool GetBottomFieldFirst () const
 Specifies the field dominance for an interlaced video frame. This attribute applies to media samples.
 
void SetBottomFieldFirst (bool value) const
 
Media::CameraExtrinsics GetCameraExtrinsics () const
 Retrieves the camera extrinsics for the sample.
 
void SetCameraExtrinsics (const Media::CameraExtrinsics &cameraExtrinsics)
 
MFAttributes CaptureMetadata () const
 Retrives the MFAttributes store for all the metadata related to the capture pipeline.
 
bool GetCleanPoint () const
 Indicates whether a sample is a random access point.
 
void SetCleanPoint (bool value) const
 
bool IsKeyFrame () const
 Indicates whether a video sample is a key frame.
 
Guid GetContentKeyId () const
 Retrieves the Key ID for the sample.
 
void SetContentKeyId (const Guid &keyId) const
 Sets the Key ID for the sample.
 
bool GetDerivedFromTopField () const
 Specifies whether a deinterlaced video frame was derived from the upper field or the lower field.
 
void SetDerivedFromTopField (bool value) const
 Specifies whether a deinterlaced video frame was derived from the upper field or the lower field.
 
TimeSpan GetDeviceTimestamp () const
 Retrieves the time stamp provided by the device driver.
 
void SetDeviceTimestamp (UInt64 value)
 
void SetDeviceTimestamp (const TimeSpan &value)
 
bool GetDiscontinuity () const
 Specifies whether a media sample is the first sample after a gap in the stream.
 
void SetDiscontinuity (bool value) const
 
UInt32 GetEncryptionCryptByteBlock () const
 Specifies the encrypted byte block size for sample-based pattern encryption.
 
void SetEncryptionCryptByteBlock (UInt32 value) const
 Specifies the encrypted byte block size for sample-based pattern encryption.
 
MFSampleEncryptionProtectionScheme GetEncryptionProtectionScheme () const
 Specifies the protection scheme for encrypted samples.
 
void SetEncryptionProtectionScheme (MFSampleEncryptionProtectionScheme value) const
 Specifies the protection scheme for encrypted samples.
 
Media::BlobValue< ByteGetEncryptionSampleID () const
 Specifies the ID of an encrypted sample.
 
void SetEncryptionSampleID (const Media::BlobValue< Byte > &value) const
 Specifies the ID of an encrypted sample.
 
UInt32 GetEncryptionSkipByteBlock () const
 Specifies the clear (non-encrypted) byte block size for sample-based pattern encryption.
 
void SetEncryptionSkipByteBlock (UInt32 value) const
 Specifies the clear (non-encrypted) byte block size for sample-based pattern encryption.
 
Media::EncryptionSubSampleMappingSplit GetEncryptionSubSampleMappingSplit () const
 Retrieves the sub-sample mapping for the sample indicating the clear and encrypted bytes in the sample data.
 
void SetEncryptionSubSampleMappingSplit (const Media::EncryptionSubSampleMappingSplit &value)
 Retrieves the sub-sample mapping for the sample indicating the clear and encrypted bytes in the sample data.
 
void SetEncryptionSubSampleMappingSplit (const DWORD *values, size_t numberOfValues)
 
bool GetFrameCorruption () const
 Specifies whether a video frame is corrupted.
 
void SetFrameCorruption (bool value) const
 Specifies whether a video frame is corrupted.
 
MFCollectionT< MFSampleGetForwardedDecodeUnits () const
 Gets an object of type MFCollectionT<MFSample> containing MFSample objects which contain network abstraction layer units (NALUs) and Supplemental Enhancement Information (SEI) units forwarded by a decoder.
 
MF_CUSTOM_DECODE_UNIT_TYPE GetForwardedDecodeUnitType () const
 Retrieves the type, NALU or SEI, of a unit attached to an MFSample in a MFSampleExtension_ForwardedDecodeUnits collection.
 
std::optional< bool > GetInterlaced () const
 Indicates whether a video frame is interlaced or progressive. If true, the frame is interlaced. If false, the frame is progressive. If not set, the media type describes the interlacing. This attribute applies to media samples.
 
UInt32 GetLongTermReferenceFrameInfo () const
 Specifies Long Term Reference (LTR) frame info and is returned on the output sample.
 
UInt32 GetMeanAbsoluteDifference () const
 This attribute returns the mean absolute difference (MAD) across all macro-blocks in the Y plane.
 
Media::PacketCrossOffsets GetPacketCrossOffsets () const
 Retrieves the offsets to the payload boundaries in a frame for protected samples.
 
void SetPacketCrossOffsets (const Media::PacketCrossOffsets &value)
 Sets the offsets to the payload boundaries in a frame for protected samples.
 
void SetPacketCrossOffsets (const DWORD *values, size_t numberOfValues)
 
- Public Member Functions inherited from Harlinn::Windows::Media::MFAttributes
template<typename ReaderT >
void Read (ReaderT &reader) const
 
template<typename WriterT >
void Write (WriterT &writer)
 
bool GetItem (const Guid &key, PROPVARIANT *value) const
 
bool GetItemType (const Guid &key, MF_ATTRIBUTE_TYPE *type) const
 
bool HasAttribute (const Guid &key) const
 
MF_ATTRIBUTE_TYPE GetItemType (const Guid &key) const
 
void CompareItem (const Guid &key, REFPROPVARIANT value, BOOL *result) const
 
bool CompareItem (const Guid &key, REFPROPVARIANT value) const
 
void Compare (IMFAttributes *other, MF_ATTRIBUTES_MATCH_TYPE matchType, BOOL *result) const
 
void Compare (const MFAttributes &other, MF_ATTRIBUTES_MATCH_TYPE matchType, BOOL *result) const
 
bool Compare (IMFAttributes *other, MF_ATTRIBUTES_MATCH_TYPE matchType) const
 
bool Compare (const MFAttributes &other, MF_ATTRIBUTES_MATCH_TYPE matchType) const
 
bool GetUINT32 (const Guid &key, UINT32 *value) const
 
UINT32 GetUINT32 (const Guid &key) const
 
UINT32 GetUINT32OrDefault (const Guid &key, UINT32 defaultValue=0) const
 
bool GetUINT64 (const Guid &key, UINT64 *value) const
 
UINT64 GetUINT64 (const Guid &key) const
 
UINT64 GetUINT64OrDefault (const Guid &key, UINT64 defaultValue=0) const
 
bool GetDouble (const Guid &key, double *value) const
 
double GetDouble (const Guid &key) const
 
double GetDoubleOrDefault (const Guid &key, double defaultValue=0.0) const
 
bool GetGUID (const Guid &key, Guid *value) const
 
Guid GetGUID (const Guid &key) const
 
Guid GetGUIDOrDefault (const Guid &key, const Guid &defaultValue=Guid()) const
 
bool GetStringLength (const Guid &key, UINT32 *length) const
 
UINT32 GetStringLength (const Guid &key) const
 
bool GetString (const Guid &key, LPWSTR buffer, UINT32 bufferSize, UINT32 *length=nullptr) const
 
WideString GetString (const Guid &key) const
 
bool GetAllocatedString (const Guid &key, LPWSTR *buffer, UINT32 *length) const
 
bool GetBlobSize (const Guid &key, UINT32 *blobSize) const
 
UINT32 GetBlobSize (const Guid &key) const
 
bool GetBlob (const Guid &key, UINT8 *buffer, UINT32 bufferSize, UINT32 *blobSize=nullptr) const
 
template<typename T >
Media::BlobValue< TGetBlob (const Guid &key) const
 
bool GetAllocatedBlob (const Guid &key, UINT8 **buffer, UINT32 *blobSize) const
 
bool GetUnknown (const Guid &key, const Guid &riid, LPVOID *result) const
 
template<typename T >
requires std::is_base_of_v<Unknown,T>
T GetUnknown (const Guid &key) const
 
void SetItem (const Guid &key, REFPROPVARIANT Value) const
 
bool DeleteItem (const Guid &key) const
 
void DeleteAllItems () const
 
void SetUINT32 (const Guid &key, UINT32 value) const
 
void SetUINT64 (const Guid &key, UINT64 value) const
 
void SetDouble (const Guid &key, double value) const
 
void SetGUID (const Guid &key, const Guid &value) const
 
void SetString (const Guid &key, LPCWSTR value) const
 
void SetString (const Guid &key, const WideString &value) const
 
void SetBlob (const Guid &key, const UINT8 *buffer, UINT32 bufferSize) const
 
void SetBlob (const Guid &key, const std::span< byte > &buffer) const
 
void SetBlob (const Guid &key, const std::vector< byte > &buffer) const
 
template<typename T >
void SetBlob (const Guid &key, const Media::BlobValue< T > &blob) const
 
void SetUnknown (const Guid &key, IUnknown *unknown) const
 
void LockStore () const
 
void lock () const
 
void UnlockStore () const
 
void unlock () const
 
void GetCount (UINT32 *result) const
 
UInt32 GetCount () const
 
void GetItemByIndex (UINT32 index, Guid *key, PROPVARIANT *value=nullptr) const
 
Guid GetItemKeyByIndex (UINT32 index) const
 
void CopyAllItems (IMFAttributes *destination) const
 
void CopyAllItems (const MFAttributes &destination) const
 
- Public Member Functions inherited from Harlinn::Common::Core::Unknown
constexpr Unknown () noexcept
 
 Unknown (IUnknown *unknown, bool addref=false) noexcept
 
 Unknown (REFIID iid, const Unknown &unknown, bool throwIfNoInterface=true)
 
 Unknown (const Unknown &other) noexcept
 
 Unknown (Unknown &&other) noexcept
 
 ~Unknown () noexcept
 
constexpr operator bool () const noexcept
 
Unknownoperator= (const Unknown &other) noexcept
 
Unknownoperator= (Unknown &&other) noexcept
 
void swap (Unknown &other) noexcept
 
void ResetPtr (IUnknown *other=nullptr, bool addRef=false) noexcept
 
Unknownoperator= (nullptr_t)
 
IUnknown * Detach ()
 
template<typename T >
requires std::is_base_of_v<Unknown, T >
T As () const
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
bool Is () const noexcept
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
ComPtr< TAs () const
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
bool Is () const noexcept
 This function can be used to detect if an object supports a particular COM interface derived from IUnknown.
 
template<typename T = IUnknown>
TGetInterfacePointer () const noexcept
 
bool QueryInterface (REFIID riid, void **itf) const
 Queries a COM object for a pointer to one of its interface; identifying the interface by a reference to its interface identifier (IID). If the COM object implements the interface, then it returns a pointer to that interface after calling IUnknown::AddRef on it.
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
bool QueryInterface (T **itf) const
 
constexpr bool operator== (const Unknown &other) const noexcept
 
constexpr bool operator!= (const Unknown &other) const noexcept
 
constexpr bool operator== (const IUnknown *other) const noexcept
 
constexpr bool operator!= (const IUnknown *other) const noexcept
 

Static Public Member Functions

static MFSample Create ()
 Creates an empty media sample.
 
static MFSample Create (DWORD maxLength)
 Creates a media sample with a single buffer.
 
- Static Public Member Functions inherited from Harlinn::Windows::Media::MFAttributes
static MFAttributes Create (UInt32 initialSize)
 
static MFAttributes Create (const Media::Attributes &attributes)
 
- Static Public Member Functions inherited from Harlinn::Common::Core::Unknown
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const CLSID &clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const wchar_t *clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const WideString &clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromProgId (const wchar_t *progId, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromProgId (const WideString &progId, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromDll (const ModuleHandle &dll, const CLSID &clsid)
 

Additional Inherited Members

- Public Types inherited from Harlinn::Common::Core::Unknown
typedef IUnknown InterfaceType
 
- Protected Attributes inherited from Harlinn::Common::Core::Unknown
IUnknown * unknown_
 

Detailed Description

Represents a media sample, which is a container object for media data. For video, a sample typically contains one video frame. For audio data, a sample typically contains multiple audio samples, rather than a single sample of audio.

A media sample contains zero or more buffers. Each buffer manages a block of memory, and is represented by the MFMediaBuffer object. A sample can have multiple buffers. The buffers are kept in an ordered list and accessed by index value. It is also valid to have an empty sample with no buffers.

Member Function Documentation

◆ AddBuffer() [1/2]

void Harlinn::Windows::Media::MFSample::AddBuffer ( const MFMediaBuffer & buffer) const
inline

◆ AddBuffer() [2/2]

void Harlinn::Windows::Media::MFSample::AddBuffer ( IMFMediaBuffer * buffer) const
inline

◆ CaptureMetadata()

MFAttributes Harlinn::Windows::Media::MFSample::CaptureMetadata ( ) const
inline

Retrives the MFAttributes store for all the metadata related to the capture pipeline.

Returns

◆ ConvertToContiguousBuffer() [1/2]

MFMediaBuffer Harlinn::Windows::Media::MFSample::ConvertToContiguousBuffer ( ) const
inline

◆ ConvertToContiguousBuffer() [2/2]

void Harlinn::Windows::Media::MFSample::ConvertToContiguousBuffer ( IMFMediaBuffer ** buffer) const
inline

◆ CopyToBuffer() [1/2]

void Harlinn::Windows::Media::MFSample::CopyToBuffer ( const MFMediaBuffer & buffer) const
inline

◆ CopyToBuffer() [2/2]

void Harlinn::Windows::Media::MFSample::CopyToBuffer ( IMFMediaBuffer * buffer) const
inline

◆ Create() [1/2]

static MFSample Harlinn::Windows::Media::MFSample::Create ( )
inlinestatic

Creates an empty media sample.

◆ Create() [2/2]

static MFSample Harlinn::Windows::Media::MFSample::Create ( DWORD maxLength)
inlinestatic

Creates a media sample with a single buffer.

◆ Get3DVideo()

bool Harlinn::Windows::Media::MFSample::Get3DVideo ( ) const
inline

Specifies whether a media sample contains a 3D video frame.

Returns
true if this is a video frame that has two or more stereoscopic views.

◆ Get3DVideoSampleFormat()

MFVideo3DSampleFormat Harlinn::Windows::Media::MFSample::Get3DVideoSampleFormat ( ) const
inline

Specifies how a 3D video frame is stored in a media sample.

Returns
A value from the MFVideo3DSampleFormat enumeration.

◆ GetBottomFieldFirst()

bool Harlinn::Windows::Media::MFSample::GetBottomFieldFirst ( ) const
inline

Specifies the field dominance for an interlaced video frame. This attribute applies to media samples.

Returns
A bool value.

If the video frame is interlaced and the sample contains two interleaved fields, this attribute indicates which field is displayed first. If true, the bottom field is first in time. If false, the top field is first.

If the frame is interlaced and the sample contains a single field, this attribute indicates which field the sample contains. If true, the sample contains the bottom field. If false, the sample contains the top field.

If the frame is progressive, this attribute describes how the fields should be ordered when the output is interlaced. If true, the bottom field should be output first. If false, the top field should be output first.

If this attribute not set, the media type describes the field dominance.

◆ GetBufferByIndex() [1/2]

MFMediaBuffer Harlinn::Windows::Media::MFSample::GetBufferByIndex ( DWORD index) const
inline

◆ GetBufferByIndex() [2/2]

void Harlinn::Windows::Media::MFSample::GetBufferByIndex ( DWORD index,
IMFMediaBuffer ** buffer ) const
inline

◆ GetBufferCount() [1/2]

DWORD Harlinn::Windows::Media::MFSample::GetBufferCount ( ) const
inline

◆ GetBufferCount() [2/2]

void Harlinn::Windows::Media::MFSample::GetBufferCount ( DWORD * bufferCount) const
inline

◆ GetCameraExtrinsics()

Media::CameraExtrinsics Harlinn::Windows::Media::MFSample::GetCameraExtrinsics ( ) const
inline

Retrieves the camera extrinsics for the sample.

◆ GetCleanPoint()

bool Harlinn::Windows::Media::MFSample::GetCleanPoint ( ) const
inline

Indicates whether a sample is a random access point.

This attribute applies to samples. If the attribute is true, the sample is a random access point and decoding can begin from this sample. Otherwise, the sample is not a random access point.

If this attribute is not set, the default value is FALSE.

◆ GetContentKeyId()

Guid Harlinn::Windows::Media::MFSample::GetContentKeyId ( ) const
inline

Retrieves the Key ID for the sample.

Returns

◆ GetDerivedFromTopField()

bool Harlinn::Windows::Media::MFSample::GetDerivedFromTopField ( ) const
inline

Specifies whether a deinterlaced video frame was derived from the upper field or the lower field.

This attribute is valid for deinterlaced samples only. Set this attribute if the frame was deinterlaced by interpolating one of the fields.

If the value is TRUE, the lower field was interpolated from the upper field. If the value is FALSE, the upper field was interpolated from the lower field.

If the attribute is not set, the frame has not been deinterlaced. The frame is either a true progressive frame, or it is an interlaced frame.

This attribute is informational. A software deinterlacer could set this attribute. If this attribute is set, it provides a hint that you can recover the original field by dropping the interpolated scan lines. For example, if the attribute is TRUE, you can recover the original upper field by dropping the interpolated lower field.

◆ GetDeviceTimestamp()

TimeSpan Harlinn::Windows::Media::MFSample::GetDeviceTimestamp ( ) const
inline

Retrieves the time stamp provided by the device driver.

This attribute is set on media samples created by a media source for a capture device. This attribute's value is in the MFTIME domain, sharing an epoch with query performance counter (QPC) time and always expressed in 100ns units. This attribute is available for MFTs inserted into the capture pipeline.

◆ GetDiscontinuity()

bool Harlinn::Windows::Media::MFSample::GetDiscontinuity ( ) const
inline

Specifies whether a media sample is the first sample after a gap in the stream.

This attribute applies to media samples. If this attribute is true, it means there was a discontinuity in the stream and this sample is the first to appear after the gap.

◆ GetEncryptionCryptByteBlock()

UInt32 Harlinn::Windows::Media::MFSample::GetEncryptionCryptByteBlock ( ) const
inline

Specifies the encrypted byte block size for sample-based pattern encryption.

The number of clear (non-encrypted) bytes in the subsample mapping block are specified in the MFSampleExtension_Encryption_SkipByteBlock attribute. If either of these attributes are not present or have a value of 0, it means that the sample data is not encrypted. Either both of these values must be non-zero, positive values, or both must have a value of zero.

In cases where the Source is MP4-based, the value is set based off the values of default_crypt_byte_block within the track encryption box (‘tenc’) in the MP4 header.

◆ GetEncryptionProtectionScheme()

MFSampleEncryptionProtectionScheme Harlinn::Windows::Media::MFSample::GetEncryptionProtectionScheme ( ) const
inline

Specifies the protection scheme for encrypted samples.

The value of this attribute is a member of the MFSampleEncryptionProtectionScheme enumeration. In cases where the media source is MP4-based, the value is set based off the value of the scheme_type field within the scheme type box (‘schm’) in the MP4 header (‘moov’ or ‘moof’).

If the scheme_type field in an MP4-based file, or stream, is set to ‘cenc’ or ‘cbc1’, then the MFSampleExtension_Encryption_ProtectionScheme attribute should be set to PROTECTION_SCHEME_AES_CTR or PROTECTION_SCHEME_CBC, respectively, and no values should be set for MFSampleExtension_Encryption_CryptByteBlock and MFSampleExtension_Encryption_SkipByteBlock.

If the scheme_type field in an MP4-based file, or stream, is set to ‘cens’ or ‘cbcs’, then the MFSampleExtension_Encryption_ProtectionScheme attribute should be set to PROTECTION_SCHEME_AES_CTR or PROTECTION_SCHEME_CBC, respectively, and MFSampleExtension_Encryption_CryptByteBlock and MFSampleExtension_Encryption_SkipByteBlock must be set using the values in the ‘tenc’ box.

◆ GetEncryptionSampleID()

Media::BlobValue< Byte > Harlinn::Windows::Media::MFSample::GetEncryptionSampleID ( ) const
inline

Specifies the ID of an encrypted sample.

◆ GetEncryptionSkipByteBlock()

UInt32 Harlinn::Windows::Media::MFSample::GetEncryptionSkipByteBlock ( ) const
inline

Specifies the clear (non-encrypted) byte block size for sample-based pattern encryption.

The number of encrypted bytes in the subsample mapping block are specified in the MFSampleExtension_Encryption_CryptByteBlock attribute. If either of these attributes are not present or have a value of 0, it means that the sample data is not encrypted. Either both of these values must be non-zero, positive values, or both must have a value of zero.

In cases where the Source is MP4-based, the value is set based off the values of default_skip_byte_block within the track encryption box (‘tenc’) in the MP4 header.

◆ GetEncryptionSubSampleMappingSplit()

Media::EncryptionSubSampleMappingSplit Harlinn::Windows::Media::MFSample::GetEncryptionSubSampleMappingSplit ( ) const
inline

Retrieves the sub-sample mapping for the sample indicating the clear and encrypted bytes in the sample data.

The BLOB should contain an array of byte ranges as DWORDs where every two DWORDs makes a set. The first DWORD in each set is the number of clear bytes and the second DWORD of the set is the number of encrypted bytes. Note that a pair of 0s is not a valid set (either value can be 0, but not both). The array of byte ranges indicate which ranges to decrypt, including the possibility that the entire sample should not be decrypted. It is recommended that this should not be set on clear samples, though it is possible to achieve the same result by setting it with the appropriate values.

◆ GetForwardedDecodeUnits()

MFCollectionT< MFSample > Harlinn::Windows::Media::MFSample::GetForwardedDecodeUnits ( ) const
inline

Gets an object of type MFCollectionT<MFSample> containing MFSample objects which contain network abstraction layer units (NALUs) and Supplemental Enhancement Information (SEI) units forwarded by a decoder.

◆ GetForwardedDecodeUnitType()

MF_CUSTOM_DECODE_UNIT_TYPE Harlinn::Windows::Media::MFSample::GetForwardedDecodeUnitType ( ) const
inline

Retrieves the type, NALU or SEI, of a unit attached to an MFSample in a MFSampleExtension_ForwardedDecodeUnits collection.

◆ GetFrameCorruption()

bool Harlinn::Windows::Media::MFSample::GetFrameCorruption ( ) const
inline

Specifies whether a video frame is corrupted.

A video decoder can set this attribute on its output samples. If the value is 1, the decoder detected data corruption in the frame. If the value is 0, there is no data corruption, or none was detected.

◆ GetInterlaced()

std::optional< bool > Harlinn::Windows::Media::MFSample::GetInterlaced ( ) const
inline

Indicates whether a video frame is interlaced or progressive. If true, the frame is interlaced. If false, the frame is progressive. If not set, the media type describes the interlacing. This attribute applies to media samples.

◆ GetLongTermReferenceFrameInfo()

UInt32 Harlinn::Windows::Media::MFSample::GetLongTermReferenceFrameInfo ( ) const
inline

Specifies Long Term Reference (LTR) frame info and is returned on the output sample.

H.264/AVC encoders:

Encoders shall return this attribute on the output sample when the application controls LTR frames, which is specified by CODECAPI_AVEncVideoLTRBufferControl.

MFSampleExtension_LongTermReferenceFrameInfo returns up to two fields.

The first field, bits[0..15], is LongTermFrameIdx associated with the output frame if it is marked as a LTR frame. The first value is 0xffff, if this output frame is a short term reference frame or a non-reference frame.

The second field, bits[16..31], is a bitmap consisting of MaxNumLTRFrames many bits that indicate which LTR frame(s) were used for encoding this output frame, starting from bit 16. The rest of bits shall be set to 0. The second value is 0 if this output frame is not encoded using any LTR frames. MaxNumLTRFrames is the maximum number of LTR frames set through CODECAPI_AVEncVideoLTRBufferControl.

◆ GetMeanAbsoluteDifference()

UInt32 Harlinn::Windows::Media::MFSample::GetMeanAbsoluteDifference ( ) const
inline

This attribute returns the mean absolute difference (MAD) across all macro-blocks in the Y plane.

Application can request encoder to set this attribute on output samples by using CODECAPI_AVEncVideoMeanAbsoluteDifference.

◆ GetPacketCrossOffsets()

Media::PacketCrossOffsets Harlinn::Windows::Media::MFSample::GetPacketCrossOffsets ( ) const
inline

Retrieves the offsets to the payload boundaries in a frame for protected samples.

This attribute applies to media samples protected by Windows Media Digital Rights Management (DRM). The value of the attribute is an array of DWORDs. Each entry in the array is the offset of a payload boundary, relative to the start of the frame. An application can use these values when decrypting and reconstructing the frames.

◆ GetSampleDuration() [1/2]

TimeSpan Harlinn::Windows::Media::MFSample::GetSampleDuration ( ) const
inline

◆ GetSampleDuration() [2/2]

void Harlinn::Windows::Media::MFSample::GetSampleDuration ( LONGLONG * sampleDuration) const
inline

◆ GetSampleFlags() [1/2]

DWORD Harlinn::Windows::Media::MFSample::GetSampleFlags ( ) const
inline

◆ GetSampleFlags() [2/2]

void Harlinn::Windows::Media::MFSample::GetSampleFlags ( DWORD * sampleFlags) const
inline

◆ GetSampleTime() [1/2]

TimeSpan Harlinn::Windows::Media::MFSample::GetSampleTime ( ) const
inline

◆ GetSampleTime() [2/2]

void Harlinn::Windows::Media::MFSample::GetSampleTime ( LONGLONG * sampleTime) const
inline

◆ GetTotalLength() [1/2]

DWORD Harlinn::Windows::Media::MFSample::GetTotalLength ( ) const
inline

Retrieves the total length of the valid data in all of the buffers in the sample. The length is calculated as the sum of the values retrieved by the IMFMediaBuffer::GetCurrentLength method.

Returns
The total length of the valid data, in bytes.

◆ GetTotalLength() [2/2]

void Harlinn::Windows::Media::MFSample::GetTotalLength ( DWORD * totalLength) const
inline

Retrieves the total length of the valid data in all of the buffers in the sample. The length is calculated as the sum of the values retrieved by the IMFMediaBuffer::GetCurrentLength method.

Parameters
totalLengthReceives the total length of the valid data, in bytes.

◆ IsKeyFrame()

bool Harlinn::Windows::Media::MFSample::IsKeyFrame ( ) const
inline

Indicates whether a video sample is a key frame.

Returns
true if the sample is a key frame.

◆ RemoveAllBuffers()

void Harlinn::Windows::Media::MFSample::RemoveAllBuffers ( ) const
inline

◆ RemoveBufferByIndex()

void Harlinn::Windows::Media::MFSample::RemoveBufferByIndex ( DWORD index) const
inline

◆ Set3DVideo()

void Harlinn::Windows::Media::MFSample::Set3DVideo ( bool value) const
inline

Specifies whether a media sample contains a 3D video frame.

Parameters
valueSet to true to indicate that this is a video frame that has two or more stereoscopic views.

◆ Set3DVideoSampleFormat()

void Harlinn::Windows::Media::MFSample::Set3DVideoSampleFormat ( MFVideo3DSampleFormat video3DSampleFormat) const
inline

◆ SetBottomFieldFirst()

void Harlinn::Windows::Media::MFSample::SetBottomFieldFirst ( bool value) const
inline

◆ SetCameraExtrinsics()

void Harlinn::Windows::Media::MFSample::SetCameraExtrinsics ( const Media::CameraExtrinsics & cameraExtrinsics)
inline

◆ SetCleanPoint()

void Harlinn::Windows::Media::MFSample::SetCleanPoint ( bool value) const
inline

◆ SetContentKeyId()

void Harlinn::Windows::Media::MFSample::SetContentKeyId ( const Guid & keyId) const
inline

Sets the Key ID for the sample.

Parameters
keyIdthe Key ID for the sample

◆ SetDerivedFromTopField()

void Harlinn::Windows::Media::MFSample::SetDerivedFromTopField ( bool value) const
inline

Specifies whether a deinterlaced video frame was derived from the upper field or the lower field.

This attribute is valid for deinterlaced samples only. Set this attribute if the frame was deinterlaced by interpolating one of the fields.

If the value is TRUE, the lower field was interpolated from the upper field. If the value is FALSE, the upper field was interpolated from the lower field.

If the attribute is not set, the frame has not been deinterlaced. The frame is either a true progressive frame, or it is an interlaced frame.

This attribute is informational. A software deinterlacer could set this attribute. If this attribute is set, it provides a hint that you can recover the original field by dropping the interpolated scan lines. For example, if the attribute is TRUE, you can recover the original upper field by dropping the interpolated lower field.

◆ SetDeviceTimestamp() [1/2]

void Harlinn::Windows::Media::MFSample::SetDeviceTimestamp ( const TimeSpan & value)
inline

◆ SetDeviceTimestamp() [2/2]

void Harlinn::Windows::Media::MFSample::SetDeviceTimestamp ( UInt64 value)
inline

◆ SetDiscontinuity()

void Harlinn::Windows::Media::MFSample::SetDiscontinuity ( bool value) const
inline

◆ SetEncryptionCryptByteBlock()

void Harlinn::Windows::Media::MFSample::SetEncryptionCryptByteBlock ( UInt32 value) const
inline

Specifies the encrypted byte block size for sample-based pattern encryption.

The number of clear (non-encrypted) bytes in the subsample mapping block are specified in the MFSampleExtension_Encryption_SkipByteBlock attribute. If either of these attributes are not present or have a value of 0, it means that the sample data is not encrypted. Either both of these values must be non-zero, positive values, or both must have a value of zero.

In cases where the Source is MP4-based, the value is set based off the values of default_crypt_byte_block within the track encryption box (‘tenc’) in the MP4 header.

◆ SetEncryptionProtectionScheme()

void Harlinn::Windows::Media::MFSample::SetEncryptionProtectionScheme ( MFSampleEncryptionProtectionScheme value) const
inline

Specifies the protection scheme for encrypted samples.

The value of this attribute is a member of the MFSampleEncryptionProtectionScheme enumeration. In cases where the media source is MP4-based, the value is set based off the value of the scheme_type field within the scheme type box (‘schm’) in the MP4 header (‘moov’ or ‘moof’).

If the scheme_type field in an MP4-based file, or stream, is set to ‘cenc’ or ‘cbc1’, then the MFSampleExtension_Encryption_ProtectionScheme attribute should be set to PROTECTION_SCHEME_AES_CTR or PROTECTION_SCHEME_CBC, respectively, and no values should be set for MFSampleExtension_Encryption_CryptByteBlock and MFSampleExtension_Encryption_SkipByteBlock.

If the scheme_type field in an MP4-based file, or stream, is set to ‘cens’ or ‘cbcs’, then the MFSampleExtension_Encryption_ProtectionScheme attribute should be set to PROTECTION_SCHEME_AES_CTR or PROTECTION_SCHEME_CBC, respectively, and MFSampleExtension_Encryption_CryptByteBlock and MFSampleExtension_Encryption_SkipByteBlock must be set using the values in the ‘tenc’ box.

◆ SetEncryptionSampleID()

void Harlinn::Windows::Media::MFSample::SetEncryptionSampleID ( const Media::BlobValue< Byte > & value) const
inline

Specifies the ID of an encrypted sample.

◆ SetEncryptionSkipByteBlock()

void Harlinn::Windows::Media::MFSample::SetEncryptionSkipByteBlock ( UInt32 value) const
inline

Specifies the clear (non-encrypted) byte block size for sample-based pattern encryption.

The number of encrypted bytes in the subsample mapping block are specified in the MFSampleExtension_Encryption_CryptByteBlock attribute. If either of these attributes are not present or have a value of 0, it means that the sample data is not encrypted. Either both of these values must be non-zero, positive values, or both must have a value of zero.

In cases where the Source is MP4-based, the value is set based off the values of default_skip_byte_block within the track encryption box (‘tenc’) in the MP4 header.

◆ SetEncryptionSubSampleMappingSplit() [1/2]

void Harlinn::Windows::Media::MFSample::SetEncryptionSubSampleMappingSplit ( const DWORD * values,
size_t numberOfValues )
inline

◆ SetEncryptionSubSampleMappingSplit() [2/2]

void Harlinn::Windows::Media::MFSample::SetEncryptionSubSampleMappingSplit ( const Media::EncryptionSubSampleMappingSplit & value)
inline

Retrieves the sub-sample mapping for the sample indicating the clear and encrypted bytes in the sample data.

The BLOB should contain an array of byte ranges as DWORDs where every two DWORDs makes a set. The first DWORD in each set is the number of clear bytes and the second DWORD of the set is the number of encrypted bytes. Note that a pair of 0s is not a valid set (either value can be 0, but not both). The array of byte ranges indicate which ranges to decrypt, including the possibility that the entire sample should not be decrypted. It is recommended that this should not be set on clear samples, though it is possible to achieve the same result by setting it with the appropriate values.

◆ SetFrameCorruption()

void Harlinn::Windows::Media::MFSample::SetFrameCorruption ( bool value) const
inline

Specifies whether a video frame is corrupted.

A video decoder can set this attribute on its output samples. If the value is 1, the decoder detected data corruption in the frame. If the value is 0, there is no data corruption, or none was detected.

◆ SetPacketCrossOffsets() [1/2]

void Harlinn::Windows::Media::MFSample::SetPacketCrossOffsets ( const DWORD * values,
size_t numberOfValues )
inline

◆ SetPacketCrossOffsets() [2/2]

void Harlinn::Windows::Media::MFSample::SetPacketCrossOffsets ( const Media::PacketCrossOffsets & value)
inline

Sets the offsets to the payload boundaries in a frame for protected samples.

This attribute applies to media samples protected by Windows Media Digital Rights Management (DRM). The value of the attribute is an array of DWORDs. Each entry in the array is the offset of a payload boundary, relative to the start of the frame. An application can use these values when decrypting and reconstructing the frames.

◆ SetSampleDuration() [1/2]

void Harlinn::Windows::Media::MFSample::SetSampleDuration ( const TimeSpan & sampleDuration) const
inline

◆ SetSampleDuration() [2/2]

void Harlinn::Windows::Media::MFSample::SetSampleDuration ( LONGLONG sampleDuration) const
inline

◆ SetSampleFlags()

void Harlinn::Windows::Media::MFSample::SetSampleFlags ( DWORD sampleFlags) const
inline

◆ SetSampleTime() [1/2]

void Harlinn::Windows::Media::MFSample::SetSampleTime ( const TimeSpan & sampleTime) const
inline

◆ SetSampleTime() [2/2]

void Harlinn::Windows::Media::MFSample::SetSampleTime ( LONGLONG sampleTime) const
inline

The documentation for this class was generated from the following file: