MediaSampleAttributeKeys Enumeration

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

This enumeration is used in a dictionary of attributes for media samples.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

Syntax

Public Enumeration MediaSampleAttributeKeys
public enum MediaSampleAttributeKeys

Members

Member name Description
KeyFrameFlag For video samples, the presence of this attribute indicates the sample is a key frame. Windows Phone
For audio samples, the presence of this attribute indicates a discontinuity (Windows Phone only).
DRMInitializationVector Provides data about the media sample that is needed to decrypt it.
FrameWidth The width of the video frame. For more information, see the Remarks section.
FrameHeight The height of the video frame. For more information, see the Remarks section.
DRMSubSampleMapping Provides data about which portions of a media sample are encrypted. For more information, see the Remarks section.
DRMKeyIdentifier Provides data about the key identifier to decrypt the media sample. For more information, see the Remarks section.
DRMAlgorithmID Provides data about the algorithm to decrypt the media sample. For more information, see the Remarks section.

Remarks

Values of this enumeration are used when calling a MediaStreamSample constructor, in order to populate IDictionary<(Of <(TKey, TValue>)>) with keyed values describing the media sample.

The following table contains additional information about the values of this enumeration.

Enumeration Value

Additional Information

DRMAlgorithmID

Provides data about the algorithm to decrypt the media sample. This attribute should be used in the following situations:

  • A media stream sample has been initialized for protected playback and the sample being created is unprotected.

  • A media stream sample has been initialized for protected playback using in-stream licenses (deferring decryptor setup until after MediaOpened).

  • A media stream sample has been initialized for protected playback using traditional decryptor setup and the sample is not protected with the same key that was specified in the DRMHeader attribute supplied during MediaStreamSource..::.ReportOpenMediaCompleted.

Valid values for the DRMAlgorithmID are:

  • ContentKeyType.Aes128Ctr.ToString()

  • ContentKeyType.Unprotected.ToString()

"Aes128Ctr" should be set for traditional PlayReady content.

"Unprotected" means the sample is not protected with any DRM system.

DRMInitializationVector

Provides data about the media sample that is needed to decrypt it.

DRMKeyIdentifier

Provides data about the key identifier to decrypt the media sample. This attribute should be used in the following situations:

  • A media stream sample has been initialized for protected playback with in-stream licenses, also known as deferred decryptor setup, and the sample being created is protected. It is expected that the KeyId is known to the application ahead of time. For example, in PIFF 1.1 and 1.3, the KeyId is obtained from parsing the .moof object's new extensions for key rotation.

  • A media stream sample has been initialized for protected playback using traditional decryptor setup and the sample is not protected with the same key that was specified in the DRMHeader attribute supplied during ReportOpenMediaCompleted.

The value of the DRMKeyIdentifier attribute should be set to the GUID.ToString for the KID GUID object whose license should correctly decrypt the sample. The format of the string is: "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx".

DRMSubSampleMapping

Provides data about which portions of a media sample are encrypted. This value is a B64 encoded array of one or more 32bit pairs. The first value in a pair is the length of encrypted data, the second is the length of clear (non-encrypted) data. If supplied, the array values must total to the length of the entire sample. If not supplied, any encryption is assumed to cover the entire sample, the length of encrypted data and clear data (not encrypted data) in an H264 media sample.

This attribute is supported for H.264 on both Windows Phone.

FrameHeight

The height of the video frame. If this attribute is not specified, the width of the sample is assumed to be the height value defined on the MediaStreamAttributeKeys passed into to the ReportOpenMediaCompleted method.

FrameWidth

The width of the video frame. If this attribute is not specified, the width of the sample is assumed to be the width value defined on the MediaStreamAttributeKeys passed into to the ReportOpenMediaCompleted method.

KeyFrameFlag

For video samples, the presence of this attribute indicates the sample is a key frame.

Windows Phone For audio samples, the presence of this attribute indicates a discontinuity (Windows Phone only).

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

System.Windows.Media Namespace

Other Resources

Capturing video for Windows Phone 8

How to play or stream a video file for Windows Phone 8

Native audio APIs for Windows Phone 8

Media for Windows Phone