共用方式為


MediaSampleAttributeKeys Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Enumeration MediaSampleAttributeKeys
public enum MediaSampleAttributeKeys

Members

Member name Description
Supported by Silverlight for Windows Phone KeyFrameFlag For video samples, the presence of this attribute indicates the sample is a key frame. For audio samples, the presence of this attribute indicates a discontinuity (Silverlight for Windows Phone only).
Supported by Silverlight for Windows Phone DRMInitializationVector Provides data about the media sample that is needed to decrypt it.
Supported by Silverlight for Windows Phone FrameWidth The width of the video frame. For more information, see the Remarks section.
Supported by Silverlight for Windows Phone FrameHeight The height of the video frame. For more information, see the Remarks section.
Supported by Silverlight for Windows Phone 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<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 and Silverlight 4 or later.

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.

Silverlight for Windows Phone Silverlight for Windows Phone

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

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.