summaryrefslogtreecommitdiffstats
path: root/media/omx-plugin/include/ics/drm
diff options
context:
space:
mode:
Diffstat (limited to 'media/omx-plugin/include/ics/drm')
-rw-r--r--media/omx-plugin/include/ics/drm/DrmManagerClient.h377
-rw-r--r--media/omx-plugin/include/ics/drm/drm_framework_common.h336
2 files changed, 0 insertions, 713 deletions
diff --git a/media/omx-plugin/include/ics/drm/DrmManagerClient.h b/media/omx-plugin/include/ics/drm/DrmManagerClient.h
deleted file mode 100644
index b8fe46d08..000000000
--- a/media/omx-plugin/include/ics/drm/DrmManagerClient.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DRM_MANAGER_CLIENT_H__
-#define __DRM_MANAGER_CLIENT_H__
-
-#include <utils/threads.h>
-#include <binder/IInterface.h>
-#include "drm_framework_common.h"
-
-namespace android {
-
-class DrmInfo;
-class DrmRights;
-class DrmMetadata;
-class DrmInfoEvent;
-class DrmInfoStatus;
-class DrmInfoRequest;
-class DrmSupportInfo;
-class DrmConstraints;
-class DrmConvertedStatus;
-class DrmManagerClientImpl;
-
-/**
- * The Native application will instantiate this class and access DRM Framework
- * services through this class.
- *
- */
-class DrmManagerClient {
-public:
- DrmManagerClient();
-
- virtual ~DrmManagerClient();
-
-public:
- class OnInfoListener: virtual public RefBase {
-
- public:
- virtual ~OnInfoListener() {}
-
- public:
- virtual void onInfo(const DrmInfoEvent& event) = 0;
- };
-
-/**
- * APIs which will be used by native modules (e.g. StageFright)
- *
- */
-public:
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] fd File descriptor of the protected content to be decrypted
- * @param[in] offset Start position of the content
- * @param[in] length The length of the protected content
- * @return
- * Handle for the decryption session
- */
- sp<DecryptHandle> openDecryptSession(int fd, off64_t offset, off64_t length);
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uri Path of the protected content to be decrypted
- * @return
- * Handle for the decryption session
- */
- sp<DecryptHandle> openDecryptSession(const char* uri);
-
- /**
- * Close the decrypt session for the given handle
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t closeDecryptSession(sp<DecryptHandle> &decryptHandle);
-
- /**
- * Consumes the rights for a content.
- * If the reserve parameter is true the rights is reserved until the same
- * application calls this api again with the reserve parameter set to false.
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] action Action to perform. (Action::DEFAULT, Action::PLAY, etc)
- * @param[in] reserve True if the rights should be reserved.
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure.
- * In case license has been expired, DRM_ERROR_LICENSE_EXPIRED will be returned.
- */
- status_t consumeRights(sp<DecryptHandle> &decryptHandle, int action, bool reserve);
-
- /**
- * Informs the DRM engine about the playback actions performed on the DRM files.
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE)
- * @param[in] position Position in the file (in milliseconds) where the start occurs.
- * Only valid together with Playback::START.
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t setPlaybackStatus(
- sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position);
-
- /**
- * Initialize decryption for the given unit of the protected content
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID
- * @param[in] headerInfo Information for initializing decryption of this decrypUnit
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t initializeDecryptUnit(
- sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo);
-
- /**
- * Decrypt the protected content buffers for the given unit
- * This method will be called any number of times, based on number of
- * encrypted streams received from application.
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID
- * @param[in] encBuffer Encrypted data block
- * @param[out] decBuffer Decrypted data block
- * @param[in] IV Optional buffer
- * @return status_t
- * Returns the error code for this API
- * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED
- * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED,
- * DRM_ERROR_DECRYPT for failure.
- */
- status_t decrypt(
- sp<DecryptHandle> &decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV = NULL);
-
- /**
- * Finalize decryption for the given unit of the protected content
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t finalizeDecryptUnit(
- sp<DecryptHandle> &decryptHandle, int decryptUnitId);
-
- /**
- * Reads the specified number of bytes from an open DRM file.
- *
- * @param[in] decryptHandle Handle for the decryption session
- * @param[out] buffer Reference to the buffer that should receive the read data.
- * @param[in] numBytes Number of bytes to read.
- * @param[in] offset Offset with which to update the file position.
- *
- * @return Number of bytes read. Returns -1 for Failure.
- */
- ssize_t pread(sp<DecryptHandle> &decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset);
-
- /**
- * Validates whether an action on the DRM content is allowed or not.
- *
- * @param[in] path Path of the protected content
- * @param[in] action Action to validate. (Action::DEFAULT, Action::PLAY, etc)
- * @param[in] description Detailed description of the action
- * @return true if the action is allowed.
- */
- bool validateAction(const String8& path, int action, const ActionDescription& description);
-
-/**
- * APIs which are just the underlying implementation for the Java API
- *
- */
-public:
- /**
- * Register a callback to be invoked when the caller required to
- * receive necessary information
- *
- * @param[in] infoListener Listener
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t setOnInfoListener(const sp<DrmManagerClient::OnInfoListener>& infoListener);
-
- /**
- * Get constraint information associated with input content
- *
- * @param[in] path Path of the protected content
- * @param[in] action Actions defined such as,
- * Action::DEFAULT, Action::PLAY, etc
- * @return DrmConstraints
- * key-value pairs of constraint are embedded in it
- * @note
- * In case of error, return NULL
- */
- DrmConstraints* getConstraints(const String8* path, const int action);
-
- /**
- * Get metadata information associated with input content
- *
- * @param[in] path Path of the protected content
- * @return DrmMetadata
- * key-value pairs of metadata
- * @note
- * In case of error, return NULL
- */
- DrmMetadata* getMetadata(const String8* path);
-
- /**
- * Check whether the given mimetype or path can be handled
- *
- * @param[in] path Path of the content needs to be handled
- * @param[in] mimetype Mimetype of the content needs to be handled
- * @return
- * True if DrmManager can handle given path or mime type.
- */
- bool canHandle(const String8& path, const String8& mimeType);
-
- /**
- * Executes given drm information based on its type
- *
- * @param[in] drmInfo Information needs to be processed
- * @return DrmInfoStatus
- * instance as a result of processing given input
- */
- DrmInfoStatus* processDrmInfo(const DrmInfo* drmInfo);
-
- /**
- * Retrieves necessary information for registration, unregistration or rights
- * acquisition information.
- *
- * @param[in] drmInfoRequest Request information to retrieve drmInfo
- * @return DrmInfo
- * instance as a result of processing given input
- */
- DrmInfo* acquireDrmInfo(const DrmInfoRequest* drmInfoRequest);
-
- /**
- * Save DRM rights to specified rights path
- * and make association with content path
- *
- * @param[in] drmRights DrmRights to be saved
- * @param[in] rightsPath File path where rights to be saved
- * @param[in] contentPath File path where content was saved
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t saveRights(
- const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath);
-
- /**
- * Retrieves the mime type embedded inside the original content
- *
- * @param[in] path the path of the protected content
- * @return String8
- * Returns mime-type of the original content, such as "video/mpeg"
- */
- String8 getOriginalMimeType(const String8& path);
-
- /**
- * Retrieves the type of the protected object (content, rights, etc..)
- * by using specified path or mimetype. At least one parameter should be non null
- * to retrieve DRM object type
- *
- * @param[in] path Path of the content or null.
- * @param[in] mimeType Mime type of the content or null.
- * @return type of the DRM content,
- * such as DrmObjectType::CONTENT, DrmObjectType::RIGHTS_OBJECT
- */
- int getDrmObjectType(const String8& path, const String8& mimeType);
-
- /**
- * Check whether the given content has valid rights or not
- *
- * @param[in] path Path of the protected content
- * @param[in] action Action to perform
- * @return the status of the rights for the protected content,
- * such as RightsStatus::RIGHTS_VALID, RightsStatus::RIGHTS_EXPIRED, etc.
- */
- int checkRightsStatus(const String8& path, int action);
-
- /**
- * Removes the rights associated with the given protected content
- *
- * @param[in] path Path of the protected content
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t removeRights(const String8& path);
-
- /**
- * Removes all the rights information of each plug-in associated with
- * DRM framework. Will be used in master reset
- *
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t removeAllRights();
-
- /**
- * This API is for Forward Lock DRM.
- * Each time the application tries to download a new DRM file
- * which needs to be converted, then the application has to
- * begin with calling this API.
- *
- * @param[in] convertId Handle for the convert session
- * @param[in] mimeType Description/MIME type of the input data packet
- * @return Return handle for the convert session
- */
- int openConvertSession(const String8& mimeType);
-
- /**
- * Passes the input data which need to be converted. The resultant
- * converted data and the status is returned in the DrmConvertedInfo
- * object. This method will be called each time there are new block
- * of data received by the application.
- *
- * @param[in] convertId Handle for the convert session
- * @param[in] inputData Input Data which need to be converted
- * @return Return object contains the status of the data conversion,
- * the output converted data and offset. In this case the
- * application will ignore the offset information.
- */
- DrmConvertedStatus* convertData(int convertId, const DrmBuffer* inputData);
-
- /**
- * When there is no more data which need to be converted or when an
- * error occurs that time the application has to inform the Drm agent
- * via this API. Upon successful conversion of the complete data,
- * the agent will inform that where the header and body signature
- * should be added. This signature appending is needed to integrity
- * protect the converted file.
- *
- * @param[in] convertId Handle for the convert session
- * @return Return object contains the status of the data conversion,
- * the header and body signature data. It also informs
- * the application on which offset these signature data
- * should be appended.
- */
- DrmConvertedStatus* closeConvertSession(int convertId);
-
- /**
- * Retrieves all DrmSupportInfo instance that native DRM framework can handle.
- * This interface is meant to be used by JNI layer
- *
- * @param[out] length Number of elements in drmSupportInfoArray
- * @param[out] drmSupportInfoArray Array contains all DrmSupportInfo
- * that native DRM framework can handle
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- status_t getAllSupportInfo(int* length, DrmSupportInfo** drmSupportInfoArray);
-
-private:
- int mUniqueId;
- sp<DrmManagerClientImpl> mDrmManagerClientImpl;
-};
-
-};
-
-#endif /* __DRM_MANAGER_CLIENT_H__ */
-
diff --git a/media/omx-plugin/include/ics/drm/drm_framework_common.h b/media/omx-plugin/include/ics/drm/drm_framework_common.h
deleted file mode 100644
index 2632cbd29..000000000
--- a/media/omx-plugin/include/ics/drm/drm_framework_common.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DRM_FRAMEWORK_COMMON_H__
-#define __DRM_FRAMEWORK_COMMON_H__
-
-#include <utils/Vector.h>
-#include <utils/KeyedVector.h>
-#include <utils/RefBase.h>
-#include <utils/String8.h>
-#include <utils/Errors.h>
-
-#define INVALID_VALUE -1
-
-namespace android {
-
-/**
- * Error code for DRM Frameowrk
- */
-enum {
- // The following constant values should be in sync with
- // media/stagefright/MediaErrors.h
- ERROR_BASE = -2000,
-
- DRM_ERROR_UNKNOWN = ERROR_BASE,
- DRM_ERROR_NO_LICENSE = ERROR_BASE - 1,
- DRM_ERROR_LICENSE_EXPIRED = ERROR_BASE - 2,
- DRM_ERROR_SESSION_NOT_OPENED = ERROR_BASE - 3,
- DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED = ERROR_BASE - 4,
- DRM_ERROR_DECRYPT = ERROR_BASE - 5,
- DRM_ERROR_CANNOT_HANDLE = ERROR_BASE - 6,
- DRM_ERROR_TAMPER_DETECTED = ERROR_BASE - 7,
-
- DRM_NO_ERROR = NO_ERROR
-};
-
-/**
- * copy control settings used in DecryptHandle::copyControlVector
- */
-enum DrmCopyControl {
- DRM_COPY_CONTROL_BASE = 1000,
- // the key used to set the value for HDCP
- // if the associated value is 1, then HDCP is required
- // otherwise, HDCP is not required
- DRM_COPY_CONTROL_HDCP = DRM_COPY_CONTROL_BASE
-};
-
-/**
- * Defines DRM Buffer
- */
-class DrmBuffer {
-public:
- char* data;
- int length;
-
- DrmBuffer() :
- data(NULL),
- length(0) {
- }
-
- DrmBuffer(char* dataBytes, int dataLength) :
- data(dataBytes),
- length(dataLength) {
- }
-
-};
-
-/**
- * Defines detailed description of the action
- */
-class ActionDescription {
-public:
- ActionDescription(int _outputType, int _configuration) :
- outputType(_outputType),
- configuration(_configuration) {
- }
-
-public:
- int outputType; /* BLUETOOTH , HDMI*/
- int configuration; /* RESOLUTION_720_480 , RECORDABLE etc.*/
-};
-
-/**
- * Defines constants related to DRM types
- */
-class DrmObjectType {
-private:
- DrmObjectType();
-
-public:
- /**
- * Field specifies the unknown type
- */
- static const int UNKNOWN = 0x00;
- /**
- * Field specifies the protected content type
- */
- static const int CONTENT = 0x01;
- /**
- * Field specifies the rights information
- */
- static const int RIGHTS_OBJECT = 0x02;
- /**
- * Field specifies the trigger information
- */
- static const int TRIGGER_OBJECT = 0x03;
-};
-
-/**
- * Defines constants related to play back
- */
-class Playback {
-private:
- Playback();
-
-public:
- /**
- * Constant field signifies playback start
- */
- static const int START = 0x00;
- /**
- * Constant field signifies playback stop
- */
- static const int STOP = 0x01;
- /**
- * Constant field signifies playback paused
- */
- static const int PAUSE = 0x02;
- /**
- * Constant field signifies playback resumed
- */
- static const int RESUME = 0x03;
-};
-
-/**
- * Defines actions that can be performed on protected content
- */
-class Action {
-private:
- Action();
-
-public:
- /**
- * Constant field signifies that the default action
- */
- static const int DEFAULT = 0x00;
- /**
- * Constant field signifies that the content can be played
- */
- static const int PLAY = 0x01;
- /**
- * Constant field signifies that the content can be set as ring tone
- */
- static const int RINGTONE = 0x02;
- /**
- * Constant field signifies that the content can be transfered
- */
- static const int TRANSFER = 0x03;
- /**
- * Constant field signifies that the content can be set as output
- */
- static const int OUTPUT = 0x04;
- /**
- * Constant field signifies that preview is allowed
- */
- static const int PREVIEW = 0x05;
- /**
- * Constant field signifies that the content can be executed
- */
- static const int EXECUTE = 0x06;
- /**
- * Constant field signifies that the content can displayed
- */
- static const int DISPLAY = 0x07;
-};
-
-/**
- * Defines constants related to status of the rights
- */
-class RightsStatus {
-private:
- RightsStatus();
-
-public:
- /**
- * Constant field signifies that the rights are valid
- */
- static const int RIGHTS_VALID = 0x00;
- /**
- * Constant field signifies that the rights are invalid
- */
- static const int RIGHTS_INVALID = 0x01;
- /**
- * Constant field signifies that the rights are expired for the content
- */
- static const int RIGHTS_EXPIRED = 0x02;
- /**
- * Constant field signifies that the rights are not acquired for the content
- */
- static const int RIGHTS_NOT_ACQUIRED = 0x03;
-};
-
-/**
- * Defines API set for decryption
- */
-class DecryptApiType {
-private:
- DecryptApiType();
-
-public:
- /**
- * Decrypt API set for non encrypted content
- */
- static const int NON_ENCRYPTED = 0x00;
- /**
- * Decrypt API set for ES based DRM
- */
- static const int ELEMENTARY_STREAM_BASED = 0x01;
- /**
- * POSIX based Decrypt API set for container based DRM
- */
- static const int CONTAINER_BASED = 0x02;
- /**
- * Decrypt API for Widevine streams
- */
- static const int WV_BASED = 0x3;
-};
-
-/**
- * Defines decryption information
- */
-class DecryptInfo {
-public:
- /**
- * size of memory to be allocated to get the decrypted content.
- */
- int decryptBufferLength;
- /**
- * reserved for future purpose
- */
-};
-
-/**
- * Defines decryption handle
- */
-class DecryptHandle : public RefBase {
-public:
- /**
- * Decryption session Handle
- */
- int decryptId;
- /**
- * Mimetype of the content to be used to select the media extractor
- * For e.g., "video/mpeg" or "audio/mp3"
- */
- String8 mimeType;
- /**
- * Defines which decryption pattern should be used to decrypt the given content
- * DrmFramework provides two different set of decryption APIs.
- * 1. Decrypt APIs for elementary stream based DRM
- * (file format is not encrypted but ES is encrypted)
- * e.g., Marlin DRM (MP4 file format), WM-DRM (asf file format)
- *
- * DecryptApiType::ELEMENTARY_STREAM_BASED
- * Decryption API set for ES based DRM
- * initializeDecryptUnit(), decrypt(), and finalizeDecryptUnit()
- * 2. Decrypt APIs for container based DRM (file format itself is encrypted)
- * e.g., OMA DRM (dcf file format)
- *
- * DecryptApiType::CONTAINER_BASED
- * POSIX based Decryption API set for container based DRM
- * pread()
- */
- int decryptApiType;
- /**
- * Defines the status of the rights like
- * RIGHTS_VALID, RIGHTS_INVALID, RIGHTS_EXPIRED or RIGHTS_NOT_ACQUIRED
- */
- int status;
- /**
- * Information required to decrypt content
- * e.g. size of memory to be allocated to get the decrypted content.
- */
- DecryptInfo* decryptInfo;
- /**
- * Defines a vector for the copy control settings sent from the DRM plugin
- * to the player
- */
- KeyedVector<DrmCopyControl, int> copyControlVector;
-
- /**
- * Defines a vector for any extra data the DRM plugin wants to send
- * to the native code
- */
- KeyedVector<String8, String8> extendedData;
-
-public:
- DecryptHandle():
- decryptId(INVALID_VALUE),
- mimeType(""),
- decryptApiType(INVALID_VALUE),
- status(INVALID_VALUE),
- decryptInfo(NULL) {
-
- }
-
- ~DecryptHandle() {
- delete decryptInfo; decryptInfo = NULL;
- }
-
- bool operator<(const DecryptHandle& handle) const {
- return (decryptId < handle.decryptId);
- }
-
- bool operator==(const DecryptHandle& handle) const {
- return (decryptId == handle.decryptId);
- }
-};
-
-};
-
-#endif /* __DRM_FRAMEWORK_COMMON_H__ */
-