summaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorTakeshi Aimi <takeshi.aimi@sonymobile.com>2012-07-11 17:09:21 +0900
committerJeff Tinker <jtinker@google.com>2013-08-23 18:01:07 -0700
commit5ff7836da0220b3097f36c8a5e82111816ebca62 (patch)
tree4612e1308d3dd9961db0fae6d3372203d5937f61 /include/drm
parent62c1a46eec047eb5fbc4b90432ec1ce65b76fb75 (diff)
downloadframeworks_av-5ff7836da0220b3097f36c8a5e82111816ebca62.zip
frameworks_av-5ff7836da0220b3097f36c8a5e82111816ebca62.tar.gz
frameworks_av-5ff7836da0220b3097f36c8a5e82111816ebca62.tar.bz2
Enhancement for OnInfo callback on DRM Framework
In DRM framework, plugins can transmit DrmInfoEvent to Java layer. Although DrmInfoEvent has several entries, current implementation can only convey integer and String. This change enables plugins uto propagate a hashmap to Java layer. The hashmap can have one or more Strings and one byte array as value. Changes are made by Sony Corporation. bug: 10459159 Change-Id: Ic19265d4ad3db4eda66a3c27e1e08873a8f2a4d7 (cherry picked from commit 4f782bf0cb69929ebf03de239e2c9bf8e82adf5e)
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/DrmInfoEvent.h117
1 files changed, 115 insertions, 2 deletions
diff --git a/include/drm/DrmInfoEvent.h b/include/drm/DrmInfoEvent.h
index dfca228..23b2950 100644
--- a/include/drm/DrmInfoEvent.h
+++ b/include/drm/DrmInfoEvent.h
@@ -17,6 +17,8 @@
#ifndef __DRM_INFO_EVENT_H__
#define __DRM_INFO_EVENT_H__
+#include "drm_framework_common.h"
+
namespace android {
class String8;
@@ -71,18 +73,70 @@ public:
public:
/**
- * Constructor for DrmInfoEvent
+ * Constructor for DrmInfoEvent.
+ * Data in drmBuffer are copied to newly allocated buffer.
*
* @param[in] uniqueId Unique session identifier
* @param[in] infoType Type of information
* @param[in] message Message description
+ * @param[in] drmBuffer Binary information
*/
DrmInfoEvent(int uniqueId, int infoType, const String8 message);
+ DrmInfoEvent(int uniqueId, int infoType, const String8 message, const DrmBuffer& drmBuffer);
/**
* Destructor for DrmInfoEvent
*/
- virtual ~DrmInfoEvent() {}
+ ~DrmInfoEvent();
+
+public:
+ /**
+ * Iterator for key
+ */
+ class KeyIterator {
+ friend class DrmInfoEvent;
+
+ private:
+ KeyIterator(const DrmInfoEvent* drmInfoEvent)
+ : mDrmInfoEvent(const_cast <DrmInfoEvent*> (drmInfoEvent)), mIndex(0) {}
+
+ public:
+ KeyIterator(const KeyIterator& keyIterator);
+ KeyIterator& operator=(const KeyIterator& keyIterator);
+ virtual ~KeyIterator() {}
+
+ public:
+ bool hasNext();
+ const String8& next();
+
+ private:
+ DrmInfoEvent* mDrmInfoEvent;
+ unsigned int mIndex;
+ };
+
+ /**
+ * Iterator
+ */
+ class Iterator {
+ friend class DrmInfoEvent;
+
+ private:
+ Iterator(const DrmInfoEvent* drmInfoEvent)
+ : mDrmInfoEvent(const_cast <DrmInfoEvent*> (drmInfoEvent)), mIndex(0) {}
+
+ public:
+ Iterator(const Iterator& iterator);
+ Iterator& operator=(const Iterator& iterator);
+ virtual ~Iterator() {}
+
+ public:
+ bool hasNext();
+ const String8& next();
+
+ private:
+ DrmInfoEvent* mDrmInfoEvent;
+ unsigned int mIndex;
+ };
public:
/**
@@ -106,10 +160,69 @@ public:
*/
const String8 getMessage() const;
+ /**
+ * Returns the number of attributes contained in this instance
+ *
+ * @return Number of attributes
+ */
+ int getCount() const;
+
+ /**
+ * Adds optional information as <key, value> pair to this instance
+ *
+ * @param[in] key Key to add
+ * @param[in] value Value to add
+ * @return Returns the error code
+ */
+ status_t put(const String8& key, String8& value);
+
+ /**
+ * Retrieves the value of given key
+ *
+ * @param key Key whose value to be retrieved
+ * @return The value
+ */
+ const String8 get(const String8& key) const;
+
+ /**
+ * Returns KeyIterator object to walk through the keys associated with this instance
+ *
+ * @return KeyIterator object
+ */
+ KeyIterator keyIterator() const;
+
+ /**
+ * Returns Iterator object to walk through the values associated with this instance
+ *
+ * @return Iterator object
+ */
+ Iterator iterator() const;
+
+ /**
+ * Returns the Binary information associated with this instance
+ *
+ * @return Binary information
+ */
+ const DrmBuffer& getData() const;
+
+ /**
+ * Sets the Binary information associated with this instance.
+ * Data in drmBuffer are copied to newly allocated buffer.
+ *
+ * @param[in] drmBuffer Binary information associated with this instance
+ */
+ void setData(const DrmBuffer& drmBuffer);
+
+private:
+ DrmInfoEvent(const DrmInfoEvent& ref);
+ const DrmInfoEvent& operator=(const DrmInfoEvent& ref);
+
private:
int mUniqueId;
int mInfoType;
const String8 mMessage;
+ KeyedVector<String8, String8> mAttributes;
+ DrmBuffer mDrmBuffer;
};
};