mirror of
https://github.com/androidx/media.git
synced 2025-05-07 15:40:37 +08:00
Add ExoMediaDrm.Provider
Allows shared ownership of ExoMediaDrms. Shared ownership will allow users to pre-create ExoMediaDrms in their apps, as opposed to having the DrmSessionManager create the ExoMediaDrm. Issue:#4721 PiperOrigin-RevId: 269305850
This commit is contained in:
parent
c5ceefd609
commit
9face09361
@ -33,9 +33,20 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public interface ExoMediaDrm<T extends ExoMediaCrypto> {
|
public interface ExoMediaDrm<T extends ExoMediaCrypto> {
|
||||||
|
|
||||||
/**
|
/** {@link ExoMediaDrm} instances provider. */
|
||||||
* @see MediaDrm#EVENT_KEY_REQUIRED
|
interface Provider<T extends ExoMediaCrypto> {
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Returns an {@link ExoMediaDrm} instance with acquired ownership for the DRM scheme identified
|
||||||
|
* by the given UUID.
|
||||||
|
*
|
||||||
|
* <p>Each call to this method must have a corresponding call to {@link ExoMediaDrm#release()}
|
||||||
|
* to ensure correct resource management.
|
||||||
|
*/
|
||||||
|
ExoMediaDrm<T> acquireExoMediaDrm(UUID uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see MediaDrm#EVENT_KEY_REQUIRED */
|
||||||
@SuppressWarnings("InlinedApi")
|
@SuppressWarnings("InlinedApi")
|
||||||
int EVENT_KEY_REQUIRED = MediaDrm.EVENT_KEY_REQUIRED;
|
int EVENT_KEY_REQUIRED = MediaDrm.EVENT_KEY_REQUIRED;
|
||||||
/**
|
/**
|
||||||
@ -235,6 +246,16 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
|
|||||||
Map<String, String> queryKeyStatus(byte[] sessionId);
|
Map<String, String> queryKeyStatus(byte[] sessionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Acquires ownership over this instance, which must be released by calling {@link #release()}.
|
||||||
|
*/
|
||||||
|
void acquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Releases ownership of this instance. If a call to this method causes this instance to have no
|
||||||
|
* acquired ownerships, releases the underlying resources.
|
||||||
|
*
|
||||||
|
* <p>Callers of this method must not make any further use of this instance.
|
||||||
|
*
|
||||||
* @see MediaDrm#release()
|
* @see MediaDrm#release()
|
||||||
*/
|
*/
|
||||||
void release();
|
void release();
|
||||||
|
@ -185,6 +185,11 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
|
|||||||
return mediaDrm.queryKeyStatus(sessionId);
|
return mediaDrm.queryKeyStatus(sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void acquire() {
|
||||||
|
// TODO: Implement reference counting.
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void release() {
|
public void release() {
|
||||||
mediaDrm.release();
|
mediaDrm.release();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user