MediaCas Class

Definition

MediaCas can be used to obtain keys for descrambling protected media streams, in conjunction with android.media.MediaDescrambler.

[Android.Runtime.Register("android/media/MediaCas", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class MediaCas : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IAutoCloseable
[<Android.Runtime.Register("android/media/MediaCas", ApiSince=26, DoNotGenerateAcw=true)>]
type MediaCas = class
    inherit Object
    interface IAutoCloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
MediaCas
Attributes
Implements

Remarks

MediaCas can be used to obtain keys for descrambling protected media streams, in conjunction with android.media.MediaDescrambler. The MediaCas APIs are designed to support conditional access such as those in the ISO/IEC13818-1. The CA system is identified by a 16-bit integer CA_system_id. The scrambling algorithms are usually proprietary and implemented by vendor-specific CA plugins installed on the device.

The app is responsible for constructing a MediaCas object for the CA system it intends to use. The app can query if a certain CA system is supported using static method #isSystemIdSupported. It can also obtain the entire list of supported CA systems using static method #enumeratePlugins.

Once the MediaCas object is constructed, the app should properly provision it by using method #provision and/or #processEmm. The EMMs (Entitlement management messages) can be distributed out-of-band, or in-band with the stream.

To descramble elementary streams, the app first calls #openSession to generate a Session object that will uniquely identify a session. A session provides a context for subsequent key updates and descrambling activities. The ECMs (Entitlement control messages) are sent to the session via method Session#processEcm.

The app next constructs a MediaDescrambler object, and initializes it with the session using MediaDescrambler#setMediaCasSession. This ties the descrambler to the session, and the descrambler can then be used to descramble content secured with the session's key, either during extraction, or during decoding with android.media.MediaCodec.

If the app handles sample extraction using its own extractor, it can use MediaDescrambler to descramble samples into clear buffers (if the session's license doesn't require secure decoders), or descramble a small amount of data to retrieve information necessary for the downstream pipeline to process the sample (if the session's license requires secure decoders).

If the session requires a secure decoder, a MediaDescrambler needs to be provided to MediaCodec to descramble samples queued by MediaCodec#queueSecureInputBuffer into protected buffers. The app should use MediaCodec#configure(MediaFormat, android.view.Surface, int, MediaDescrambler) instead of the normal MediaCodec#configure(MediaFormat, android.view.Surface, MediaCrypto, int) method to configure MediaCodec.

<h3>Using Android's MediaExtractor</h3>

If the app uses MediaExtractor, it can delegate the CAS session management to MediaExtractor by calling MediaExtractor#setMediaCas. MediaExtractor will take over and call #openSession, #processEmm and/or Session#processEcm, etc.. if necessary.

When using MediaExtractor, the app would still need a MediaDescrambler to use with MediaCodec if the licensing requires a secure decoder. The session associated with the descrambler of a track can be retrieved by calling MediaExtractor#getCasInfo, and used to initialize a MediaDescrambler object for MediaCodec.

<h3>Listeners</h3>

The app may register a listener to receive events from the CA system using method #setEventListener. The exact format of the event is scheme-specific and is not specified by this API.

Java documentation for android.media.MediaCas.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

MediaCas(Context, Int32, String, Int32)

Instantiate a CA system of the specified system id.

MediaCas(Context, Int32, String, Int32, Handler, MediaCas+IEventListener)

Instantiate a CA system of the specified system id.

MediaCas(Int32)

Instantiate a CA system of the specified system id.

Fields

PluginStatusPhysicalModuleChanged
Obsolete.

The event to indicate that the status of CAS system is changed by the removal or insertion of physical CAS modules.

PluginStatusSessionNumberChanged
Obsolete.

The event to indicate that the number of CAS system's session is changed.

ScramblingModeAes128
Obsolete.

Advanced Encryption System (AES) 128-bit Encryption mode.

ScramblingModeAesCbc
Obsolete.

Advanced Encryption System (AES) Cipher Block Chaining (CBC) mode.

ScramblingModeAesEcb
Obsolete.

Advanced Encryption System (AES) Electronic Code Book (ECB) mode.

ScramblingModeAesScte52
Obsolete.

Advanced Encryption System (AES) Society of Cable Telecommunications Engineers (SCTE) 52 mode.

ScramblingModeDvbCissaV1
Obsolete.

DVB Common IPTV Software-oriented Scrambling Algorithm (CISSA) Version 1.

ScramblingModeDvbCsa1
Obsolete.

DVB (Digital Video Broadcasting) Common Scrambling Algorithm (CSA) 1.

ScramblingModeDvbCsa2
Obsolete.

DVB CSA 2.

ScramblingModeDvbCsa3Enhance
Obsolete.

DVB CSA 3 in fully enhanced mode.

ScramblingModeDvbCsa3Minimal
Obsolete.

DVB CSA 3 in minimally enhanced mode.

ScramblingModeDvbCsa3Standard
Obsolete.

DVB CSA 3 in standard mode.

ScramblingModeDvbIdsa
Obsolete.

ATIS-0800006 IIF Default Scrambling Algorithm (IDSA).

ScramblingModeMulti2
Obsolete.

A symmetric key algorithm.

ScramblingModeReserved
Obsolete.

DVB (Digital Video Broadcasting) reserved mode.

ScramblingModeTdesEcb
Obsolete.

Triple Data Encryption Algorithm (TDES) Electronic Code Book (ECB) mode.

ScramblingModeTdesScte52
Obsolete.

Triple Data Encryption Algorithm (TDES) Society of Cable Telecommunications Engineers (SCTE) 52 mode.

SessionUsageLive
Obsolete.

Cas session is used to descramble live streams.

SessionUsagePlayback
Obsolete.

Cas session is used to descramble recoreded streams.

SessionUsageRecord
Obsolete.

Cas session is used to descramble live streams and encrypt local recorded content

SessionUsageTimeshift
Obsolete.

Cas session is used to descramble live streams , encrypt local recorded content and playback local encrypted content.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnumeratePlugins()

List all available CA plugins on the device.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsSystemIdSupported(Int32)

Query if a certain CA system is supported on this device.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OpenSession()

Open a session to descramble one or more streams scrambled by the conditional access system.

OpenSession(Int32, Int32)

Open a session to descramble one or more streams scrambled by the conditional access system.

ProcessEmm(Byte[])

Send a received EMM packet to the CA system.

ProcessEmm(Byte[], Int32, Int32)

Send a received EMM packet to the CA system.

Provision(String)

Initiate a provisioning operation for a CA system.

RefreshEntitlements(Int32, Byte[])

Notify the CA system to refresh entitlement keys.

SendEvent(Int32, Int32, Byte[])

Send an event to a CA system.

SetEventListener(MediaCas+IEventListener, Handler)

Set an event listener to receive notifications from the MediaCas instance.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPrivateData(Byte[])

Send the private data for the CA system.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to