bool IEMEDrmBridge::IsKeySystemSupported(const std::string& key_system) {
CHECK(!key_system.empty());
#if defined(PLATFORM_API_WRAPPER)
- return platform_api_wrapper::isKeySystemSupported(key_system.c_str()) ==
- eme::kSupported;
+ return static_cast<eme::Status>(platform_api_wrapper::isKeySystemSupported(
+ key_system.c_str())) == eme::kSupported;
#else
- return platform_api_wrapper::isKeySystemSupported(key_system) ==
- eme::kSupported;
+ return eme::IEME::isKeySystemSupported(key_system) == eme::kSupported;
#endif
}
std::vector<std::unique_ptr<media::KeySystemInfo>>* key_systems_info) {
eme::supportedCDMList supportedKeySystems;
#if defined(PLATFORM_API_WRAPPER)
- platform_api_wrapper::vector_wrapper<const char*> supportedKeySystemsCharList;
+ platform_api_wrapper::StringVector supportedKeySystemsCharList;
platform_api_wrapper::enumerateMediaKeySystems(&supportedKeySystemsCharList);
for (int i = 0; i < supportedKeySystemsCharList.size(); i++) {
supportedKeySystems.push_back(supportedKeySystemsCharList[i]);
# Script for building platform-api-wrapper library with cmake.
cd ./tizen_src/platform_api_wrapper
-rm -r build *.so
+if [ -d "build" ]; then
+ rm -r build
+fi
+if [ -f "*.so" ]; then
+ rm *.so
+fi
mkdir build && cd build
cmake ../ -DTIZEN_PROFILE=$1
make && make install
#include "platform_api_wrapper.h"
+#if defined(OS_TIZEN_TV_PRODUCT)
+#include <emeCDM/IEME.h>
+#endif
+
+#include <string>
+#include <vector>
+
namespace platform_api_wrapper {
+class StringVectorImpl {
+ public:
+ StringVectorImpl() {}
+ ~StringVectorImpl() { list_.clear(); }
+ void push_back(std::string data) { list_.push_back(data); }
+ std::string& operator[](size_t index) { return list_[index]; }
+ size_t size() { return list_.size(); }
+
+ private:
+ std::vector<std::string> list_;
+};
+
+StringVector::StringVector() {
+ impl_ = new StringVectorImpl;
+}
+StringVector::~StringVector() {
+ delete impl_;
+}
+void StringVector::push_back(const char* data) {
+ impl_->push_back(std::string(data));
+}
+const char* StringVector::operator[](size_t index) {
+ return (*impl_)[index].c_str();
+}
+size_t StringVector::size() {
+ return impl_->size();
+}
+
#if defined(OS_TIZEN_TV_PRODUCT)
// eme::IEME wrapper impl
-void enumerateMediaKeySystems(vector_wrapper<const char*>* list) {
+void enumerateMediaKeySystems(StringVector* list) {
eme::supportedCDMList supportedKeySystems;
eme::IEME::enumerateMediaKeySystems(&supportedKeySystems);
for (auto& it : supportedKeySystems) {
return eme::IEME::create(listener, std::string(key_system), privacy_mode);
}
-eme::Status isKeySystemSupported(const char* key_system) {
- return eme::IEME::isKeySystemSupported(std::string(key_system));
+unsigned isKeySystemSupported(const char* key_system) {
+ return (unsigned)eme::IEME::isKeySystemSupported(std::string(key_system));
}
#endif
#ifndef PLATFORM_API_WRAPPER_H_
#define PLATFORM_API_WRAPPER_H_
-#if defined(OS_TIZEN_TV_PRODUCT)
-#include <emeCDM/IEME.h>
-#endif
+#include <cstddef>
-#include <vector>
+namespace eme {
+class IEME;
+class IEventListener;
+} // namespace eme
namespace platform_api_wrapper {
// Wrapper impl for std::vector
+class StringVectorImpl;
-template <typename T>
-class vector_wrapper {
+class StringVector {
public:
- vector_wrapper() {}
- ~vector_wrapper() { list_.clear(); }
- void push_back(T data) { list_.push_back(data); }
- T& operator[](int index) { return list_[index]; }
- size_t size() { return list_.size(); }
+ StringVector();
+ ~StringVector();
+ void push_back(const char* data);
+ const char* operator[](size_t index);
+ size_t size();
private:
- std::vector<T> list_;
+ StringVectorImpl* impl_ = nullptr;
};
#if defined(OS_TIZEN_TV_PRODUCT)
// Wrapper APIs for <emeCDM/IEME.h>
-void enumerateMediaKeySystems(vector_wrapper<const char*>* list);
+void enumerateMediaKeySystems(StringVector* list);
eme::IEME* createIEME(eme::IEventListener* listener,
const char* key_system,
bool privacy_mode);
-eme::Status isKeySystemSupported(const char* key_system);
+unsigned isKeySystemSupported(const char* key_system);
#endif
} // namespace platform_api_wrapper