Remove "external/opencore/android/drm/" since
-- the code is not used/compiled;
-- the usage might be outdated
http://b/issue?id=2046893
diff --git a/android/drm/oma1/Android.mk b/android/drm/oma1/Android.mk
deleted file mode 100644
index 5690571..0000000
--- a/android/drm/oma1/Android.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(PV_TOP)/android/drm/oma1/src/Android.mk
-
-#include $(CLEAR_VARS)
-#include $(PV_TOP)/android/drm/oma1/test/Android.mk
diff --git a/android/drm/oma1/src/Android.mk b/android/drm/oma1/src/Android.mk
deleted file mode 100644
index b021a31..0000000
--- a/android/drm/oma1/src/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-ifeq ($(TARGET_ARCH), arm)
-LOCAL_DRM_1_PLUGIN_CFLAG = -DDRM_1_PLUGIN_ARCH_ARM
-endif
-
-ifeq ($(TARGET_ARCH), x86)
-LOCAL_DRM_1_PLUGIN_CFLAG = -DDRM_1_PLUGIN_ARCH_X86
-endif
-
-LOCAL_SRC_FILES := pvmf_cpmplugin_kmj_oma1.cpp \
- pvoma1_kmj_recognizer.cpp \
- pvmf_cpmplugin_kmj_oma1_factory.cpp \
- pvmf_cpmplugin_kmj_oma1_data_access.cpp
-
-LOCAL_MODULE := libkmj_oma1
-
-LOCAL_CFLAGS := $(PV_CFLAGS)
-LOCAL_CFLAGS += $(LOCAL_DRM_1_PLUGIN_CFLAG)
-
-
-LOCAL_C_INCLUDES := $(PV_TOP)//android/drm/oma1/src \
- $(PV_INCLUDES) \
- $(call include-path-for, libdrm1) \
- $(call include-path-for, system-core)/cutils
-
-LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
-LOCAL_COPY_HEADERS := \
- pvmf_cpmplugin_kmj_oma1.h \
- pvmf_cpmplugin_kmj_oma1_types.h \
- pvmf_cpmplugin_kmj_oma1_factory.h \
- pvoma1_kmj_recognizer.h \
- pvmf_cpmplugin_kmj_oma1_data_access.h
-
-LOCAL_SHARED_LIBRARIES := libdrm1
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1.cpp b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1.cpp
deleted file mode 100644
index 75b48a3..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1.cpp
+++ /dev/null
@@ -1,2060 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-#include "oscl_utf8conv.h"
-#include "oscl_exclusive_ptr.h"
-#include <stdio.h>
-#include <sys/socket.h>
-#include "objmng/svc_drm.h"
-#include "xml/xml_tinyParser.h"
-#include "pvmi_drm_kvp.h"
-#include "pvmf_cpmplugin_kmj_oma1.h"
-#include "pvlogger.h"
-#include "pvmf_basic_errorinfomessage.h"
-#include "pvmf_errorinfomessage_extension.h"
-#include "pvmf_local_data_source.h"
-#include "pvmf_cpmplugin_kmj_oma1_types.h"
-#include "log.h"
-
-PVMFCPMPluginInterface* PVMFCPMKmjPlugInOMA1::CreatePlugIn()
-{
- PVMFCPMKmjPlugInOMA1* plugIn = NULL;
- int32 err;
-
- // Create KMJ OMA1.0 Plugin
- OSCL_TRY(err,plugIn = OSCL_NEW(PVMFCPMKmjPlugInOMA1, ()););
-
- if (err != OsclErrNone)
- {
- OSCL_LEAVE(err);
- }
-
- return (OSCL_STATIC_CAST(PVMFCPMPluginInterface*, plugIn));
-}
-
-void PVMFCPMKmjPlugInOMA1::DestroyPlugIn(PVMFCPMPluginInterface* aPlugIn)
-{
- OSCL_DELETE(aPlugIn);
-}
-
-PVMFCPMKmjPlugInOMA1::PVMFCPMKmjPlugInOMA1(int32 aPriority)
- : OsclActiveObject(aPriority,"PVMFCPMKmjPlugInOMA1"),
- iExtensionRefCount(0)
-{
- bRunUT = false;
- m_oSourceSet = false;
- urlPort = HTTP_DEFAULT_PORT;
-
- int32 err;
-
- // Create the input command queue.
- // Use a reserve to avoid lots of dynamic memory allocation
- OSCL_TRY(err, iInputCommands.Construct(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START,
- PVMF_CPM_KMJ_PLUGIN_OMA1_INTERNAL_CMDQ_SIZE);
-
- /*
- * Create the "current command" queue.
- * It will only contain one command at a time, so use a reserve of 1
- */
- iCurrentCommand.Construct(0,1););
-
- if (err != OsclErrNone)
- {
- OSCL_LEAVE(err);
- }
-}
-
-PVMFCPMKmjPlugInOMA1::~PVMFCPMKmjPlugInOMA1()
-{
- m_oSourceSet = false;
-
- /*
- * Cleanup commands
- * The command queues are self-deleting, but we want to
- * notify the observer of unprocessed commands.
- */
- while (!iCurrentCommand.empty())
- {
- CommandComplete(iCurrentCommand,iCurrentCommand.front(),PVMFFailure);
- }
-
- while (!iInputCommands.empty())
- {
- CommandComplete(iInputCommands,iInputCommands.front(),PVMFFailure);
- }
-}
-
-void PVMFCPMKmjPlugInOMA1::ThreadLogon()
-{
- if(!iLoggedOn)
- {
- AddToScheduler();
- iLoggedOn = true;
- }
-}
-
-void PVMFCPMKmjPlugInOMA1::ThreadLogoff()
-{
- if(iLoggedOn)
- {
- Cancel();
- RemoveFromScheduler();
- iLoggedOn = false;
- }
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::Init(PVMFSessionId s, const OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
- cmd.PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,PVMF_CPM_KMJ_PLUGIN_OMA1_INIT, aContext);
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::QueryUUID( PVMFSessionId s,
- const PvmfMimeString& aMimeType,
- Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids,
- bool aExactUuidsOnly,
- const OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,
- PVMF_CPM_KMJ_PLUGIN_OMA1_QUERYUUID,
- aMimeType,
- aUuids,
- aExactUuidsOnly,
- aContext);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::QueryInterface( PVMFSessionId s,
- const PVUuid& aUuid,
- PVInterface*& aInterfacePtr,
- const OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,
- PVMF_CPM_KMJ_PLUGIN_OMA1_QUERYINTERFACE,
- aUuid,
- aInterfacePtr,
- aContext);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::AuthenticateUser( PVMFSessionId aSessionId,
- OsclAny* aAuthenticationData,
- OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.Construct(aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA1_AUTHENTICATE,
- aAuthenticationData,
- NULL,
- aContext);
-
- return QueueCommandL(cmd);
-}
-
-int32_t PVMFCPMKmjPlugInOMA1::GetMimeType(char* drmFileName)
-{
- if(!drmFileName)
- {
- return TYPE_DRM_UNKNOWN;
- }
-
- const char* extension = strrchr(drmFileName, '.');
-
- if(!extension)
- {
- return TYPE_DRM_UNKNOWN;
- }
-
- if (strcasecmp(extension, ".dm") == 0)
- {
- return TYPE_DRM_MESSAGE;
- }
- else if (strcasecmp(extension, ".dcf") == 0)
- {
- return TYPE_DRM_CONTENT;
- }
- else if (strcasecmp(extension, ".dr") == 0)
- {
- return TYPE_DRM_RIGHTS_XML;
- }
- else if (strcasecmp(extension, ".drc") == 0)
- {
- return TYPE_DRM_RIGHTS_WBXML;
- }
- else
- {
- return TYPE_DRM_UNKNOWN;
- }
-}
-
-PVMFStatus PVMFCPMKmjPlugInOMA1::SetSourceInitializationData( OSCL_wString& aSourceURL,
- PVMFFormatType& aSourceFormat,
- OsclAny* aSourceData)
-{
- LOGD("PVMFCPMKmjPlugInOMA1:SetSourceInitializationData in\r\n");
-
- char originalFile[256] = {0};
-
- oscl_UnicodeToUTF8( aSourceURL.get_cstr(),
- aSourceURL.get_size(),
- originalFile,
- 256);
-
- int32_t mimeType = GetMimeType(originalFile);
-
- Oscl_FileServer fileServ;
-
- // open local file
- int32 ret = m_pvfile.Open( aSourceURL.get_cstr(),Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,fileServ);
- if(0 != ret)
- {
- LOGD("PVMFCPMKmjPlugInOMA1:SetSourceInitializationData m_pvfile.Open failed");
- return PVMFFailure;
- }
-
- m_dataAccessFile = OSCL_NEW(DrmPluginDataAccess,(&m_pvfile));
-
- T_DRM_Input_Data drmInputData =
- {
- (int32_t)m_dataAccessFile,
- mimeType,
- DrmPluginGetDataLen,
- DrmPluginReadData,
- DrmPluginSeekData
- };
-
- m_drmSession = SVC_drm_openSession(drmInputData);
-
- if((DRM_MEDIA_DATA_INVALID == m_drmSession) || (DRM_FAILURE == m_drmSession))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:SetSourceInitializationData SVC_drm_openSession failed");
- return PVMFFailure;
- }
-
- int32_t method = SVC_drm_getDeliveryMethod(m_drmSession);
-
- if(DRM_FAILURE != method)
- {
- LOGD("PVMFCPMKmjPlugInOMA1:SetSourceInitializationData out\r\n");
- m_oSourceSet = true;
- return PVMFSuccess;
- }
- else
- {
- LOGD("PVMFCPMKmjPlugInOMA1:SetSourceInitializationData unknown delivery type\r\n");
- return PVMFFailure;
- }
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::AuthorizeUsage( PVMFSessionId aSessionId,
- PvmiKvp& aRequestedUsage,
- PvmiKvp& aApprovedUsage,
- PvmiKvp& aAuthorizationData,
- uint32& aRequestTimeOutInMS,
- OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.Construct(aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA1_AUTHORIZE_USAGE,
- &aRequestedUsage,
- &aApprovedUsage,
- &aAuthorizationData,
- &aRequestTimeOutInMS,
- aContext);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::UsageComplete(PVMFSessionId s, const OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.PVMFCPMKmjPlugInOMA1CommandBase::Construct( s,
- PVMF_CPM_KMJ_PLUGIN_OMA1_USAGE_COMPLETE,
- aContext);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::Reset(PVMFSessionId s, const OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,PVMF_CPM_KMJ_PLUGIN_OMA1_RESET,aContext);
-
- return QueueCommandL(cmd);
-}
-
-
-PVMFCPMContentType PVMFCPMKmjPlugInOMA1::GetCPMContentType()
-{
- return PVMF_CPM_FORMAT_OMA1;
-}
-
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::GetLicense( PVMFSessionId aSessionId,
- OSCL_wString& aContentName,
- OsclAny* aData,
- uint32 aDataSize,
- int32 aTimeoutMsec,
- OsclAny* aContextData)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.Construct(aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE_W,
- aContentName,
- aData,
- aDataSize,
- aTimeoutMsec,
- aContextData);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::GetLicense( PVMFSessionId aSessionId,
- OSCL_String& aContentName,
- OsclAny* aData,
- uint32 aDataSize,
- int32 aTimeoutMsec,
- OsclAny* aContextData)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.Construct(aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE,
- aContentName,
- aData,
- aDataSize,
- aTimeoutMsec,
- aContextData);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::CancelGetLicense( PVMFSessionId aSessionId,
- PVMFCommandId aCmdId,
- OsclAny* aContext)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.PVMFCPMKmjPlugInOMA1CommandBase::Construct( aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA1_CANCEL_GET_LICENSE,
- aCmdId,
- aContext);
-
- return QueueCommandL(cmd);
-}
-
-
-void PVMFCPMKmjPlugInOMA1::ParseUrl(char* rightsUrl)
-{
- const char *cur = rightsUrl;
- char buf[URL_MAX_LEN] = {0}; /* Buffer saving fields of url */
- int32_t indx = 0; /* The current position of url */
- int port = 0; /* The port in the url */
-
- //init host, path and port
- urlHost = "";
- urlPath = "";
- urlPort = HTTP_DEFAULT_PORT;
-
- /* Parse protocol */
- buf[indx] = 0;
-
- while (*cur)
- {
- if ((':' == cur[0]) && ('/' == cur[1]) && ('/' == cur[2]))
- {
- /* End the protocol */
- buf[indx] = 0;
-
- indx = 0;
- cur += 3;
-
- break;
- }
-
- buf[indx++] = *cur++;
- }
-
- /* Only protocol name */
- if (0 == *cur)
- {
- return;
- }
-
- /* Parse hostname */
- buf[indx] = 0;
-
- while(1)
- {
- if (':' == cur[0])
- {
- /* The hostname is end and next is port */
- buf[indx] = 0;
- urlHost = buf;
-
- indx = 0;
- cur += 1;
-
- /* Parse port */
- while (('0' <= *cur) && ('9' >= *cur))
- {
- port *= 10;
- port += *cur - '0';
- cur++;
- }
-
- if (port != 0)
- {
- urlPort = port;
- }
-
- while (('/' != cur[0]) && (0 != *cur))
- {
- cur++;
- }
-
- break;
- }
-
- if (cur && (('?' == *cur) || ('#' == *cur) || ('/' == *cur) || (0 == *cur)))
- {
- /* The hostname is end and next is path or null*/
- buf[indx] = 0;
- urlHost = buf;
-
- indx = 0;
- break;
- }
-
- buf[indx++] = *cur++;
- }
-
- /* Parse path */
- if (0 == *cur) /* No path,and default '/' */
- {
- urlPath = "/";
- }
- else
- {
- indx = 0;
- buf[indx] = 0;
-
- while(*cur)
- {
- buf[indx++] = *cur++;
- }
-
- buf[indx] = 0;
-
- if('/' != *buf)
- {
- urlPath = "/";
- }
-
- urlPath += buf;
- }
-}
-
-bool PVMFCPMKmjPlugInOMA1::getIpAddrByName(OSCL_HeapString<OsclMemAllocator> hostName)
-{
- struct hostent *h = NULL;
-
- urlIpAddr = inet_addr(hostName.get_cstr());
-
- if(INADDR_NONE != urlIpAddr)
- {
- return true;
- }
- else
- {
- h = gethostbyname(hostName.get_cstr());
-
- if(NULL == h)
- {
- return false;
- }
- }
-
- struct in_addr ia;
-
- /* Parse the hostent structure of h, make the sockaddr structure */
- for (int32_t i = 0; h->h_addr_list[i]; i++)
- {
- if (AF_INET == h->h_addrtype)/* A records (IPv4) */
- {
- memcpy(&ia, h->h_addr_list[i], h->h_length);
- }
- else
- {
- break;
- }
-
- /* Connect a host by socket address */
- urlIpAddr = ia.s_addr;
-
- return true;
- }
-
- return false;
-}
-
-void PVMFCPMKmjPlugInOMA1::DoGetLicense(PVMFCPMKmjPlugInOMA1Command& aCmd, bool aWideCharVersion)
-{
- char url[256] = {0};
- OsclAny* data = NULL;
- uint32 dataSize = 0;
- int32 timeoutMsec = 0;
-
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense in");
-
- if (aWideCharVersion == true)
- {
- OSCL_wString* contentName = NULL;
- aCmd.Parse(contentName,data, dataSize, timeoutMsec);
- }
- else
- {
- OSCL_String* contentName = NULL;
- aCmd.Parse(contentName,data,dataSize,timeoutMsec);
- }
-
- // get rights url
- if(DRM_SUCCESS != SVC_drm_getRightsIssuer(m_drmSession,(uint8_t*)url))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense SVC_drm_getRightsIssuer failed");
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- // parse URL to get host, port and path
- ParseUrl(url);
-
- // create a socket
- int s = socket(PF_INET, SOCK_STREAM, 0);
-
- if(s < 0)
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense socket failed");
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- if(false == getIpAddrByName(urlHost))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense getIpAddrByName failed");
- shutdown(s,true);
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- struct sockaddr_in sockin;
-
- sockin.sin_family = AF_INET;
- sockin.sin_addr.s_addr = ((u_long)urlIpAddr);
- sockin.sin_port = htons((u_short)urlPort);
-
- // connect to server
- if(0 > connect(s, (struct sockaddr *)&sockin, sizeof(sockin)))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense connect failed");
- shutdown(s,true);
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- // construct send http header
- OSCL_HeapString<OsclMemAllocator> sendHttpHeader = "GET ";
-
- sendHttpHeader += urlPath;
- sendHttpHeader += " HTTP/1.1\r\nHost:";
- sendHttpHeader += urlHost;
- sendHttpHeader += "\r\n\r\n";
-
- // send request to server
- if( 0 > send(s,sendHttpHeader.get_cstr(),sendHttpHeader.get_size(),0))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense send failed");
- shutdown(s,true);
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- char out[BUFFER_DEFAULT_CACHE_SIZE] = {0};
-
- // receive response from server
- int res = recv(s,out,sizeof(out),0);
-
- shutdown(s,true);
-
- if(0 > res)
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense receive failed");
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- // check http response whether success or not
- char* rightsData = strstr(out, "200 OK");
- if(!rightsData)
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense response invalid");
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- int32_t rightsType = TYPE_DRM_RIGHTS_WBXML;
-
- rightsData = strstr(out, "Content-Type:");
- if (rightsData)
- {
- rightsData += strlen("Content-Type:");
-
- while (*rightsData == ' ' || *rightsData == '\t')
- {
- rightsData++;
- }
-
- if (0 == strncmp( "application/vnd.oma.drm.rights+xml",
- rightsData,
- strlen("application/vnd.oma.drm.rights+xml")))
- {
- rightsType = TYPE_DRM_RIGHTS_XML;
- }
- }
-
- int rightsLen = 0;
-
- rightsData = strstr(out, "\r\n\r\n");
- if (rightsData)
- {
- rightsData += 4;
- rightsLen = res - (rightsData - out);
- }
-
- DrmPluginDataAccess dataAccess( NULL,
- DrmPluginDataAccess::ACCESS_BUFFER,
- rightsData,
- rightsLen);
-
- T_DRM_Input_Data drmInputData =
- {
- (int32_t)&dataAccess,
- rightsType,
- DrmPluginGetDataLen,
- DrmPluginReadData,
- DrmPluginSeekData
- };
- T_DRM_Rights_Info rightsInfo;
-
- memset(&rightsInfo, 0, sizeof(T_DRM_Rights_Info));
- if(DRM_SUCCESS != SVC_drm_installRights(drmInputData, &rightsInfo))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense SVC_drm_installRights failed");
- CommandComplete(iInputCommands, aCmd, PVMFErrResource);
- return;
- }
-
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
- LOGD("PVMFCPMKmjPlugInOMA1:DoGetLicense out");
-}
-
-void PVMFCPMKmjPlugInOMA1::DoCancelGetLicense(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- /* extract the command ID from the parameters.*/
- PVMFCommandId id = 0;
- aCmd.PVMFCPMKmjPlugInOMA1CommandBase::Parse(id);
-
- /* first check "current" command if any */
- PVMFCPMKmjPlugInOMA1Command* cmd = iCurrentCommand.FindById(id);
- if(cmd)
- {
- if ( cmd->iCmd == PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE_W
- || cmd->iCmd == PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE)
- {
- CommandComplete(iCurrentCommand, *cmd,PVMFErrCancelled);
- CommandComplete(iInputCommands, aCmd,PVMFSuccess);
- return ;
- }
- }
-
- /*
- * next check input queue.
- * start at element 1 since this cancel command is element 0.
- */
- cmd = iInputCommands.FindById(id,1);
- if (cmd)
- {
- if ( cmd->iCmd == PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE_W
- || cmd->iCmd == PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE)
- {
- /* cancel the queued command */
- CommandComplete(iInputCommands, *cmd, PVMFErrCancelled,NULL,NULL);
-
- /* report cancel success */
- CommandComplete(iInputCommands, aCmd,PVMFSuccess);
- return ;
- }
- }
-
- /* if we get here the command isn't queued so the cancel fails */
- CommandComplete(iInputCommands, aCmd,PVMFErrArgument);
- return ;
-}
-
-uint32 PVMFCPMKmjPlugInOMA1::GetNumMetadataKeys(char* aQueryKeyString)
-{
- GetAvailableKeys();
- uint32_t keySize = iAvailableMetadataKeys.size();
-
- if(0 == keySize)
- {
- return 0;
- }
-
- if(NULL == aQueryKeyString)
- {
- return keySize;
- }
- else
- {
- uint32 num_entries = 0;
-
- // Determine the number of metadata keys based on the query key string provided
- for (uint32 i = 0; i < keySize; i++)
- {
- // Check if the key matches the query key
- if (oscl_strcmp(iAvailableMetadataKeys[i].get_cstr(), aQueryKeyString) == 0)
- {
- num_entries++;
- }
- }
-
- return num_entries;
- }
-}
-
-uint32 PVMFCPMKmjPlugInOMA1::GetNumMetadataValues(PVMFMetadataList& aKeyList)
-{
- GetAvailableKeys();
-
- if(0 == iAvailableMetadataKeys.size())
- {
- return 0;
- }
-
- uint32_t keySize = aKeyList.size();
- if (0 == keySize)
- {
- return 0;
- }
-
- uint32 numvalentries = 0;
-
- for(uint32_t i = 0; i < keySize; i++)
- {
- if(true == IsQueryDataAvailable(aKeyList[i]))
- {
- ++numvalentries;
- }
- }
-
- return numvalentries;
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::GetNodeMetadataKeys( PVMFSessionId aSessionId,
- PVMFMetadataList& aKeyList,
- uint32 aStartingKeyIndex,
- int32 aMaxKeyEntries,
- char* aQueryKeyString,
- const OsclAny* aContextData)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- cmd.Construct( aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA_GET_NODEMETADATAKEYS,
- aKeyList,
- aStartingKeyIndex,
- aMaxKeyEntries,
- aQueryKeyString,
- aContextData);
-
- return QueueCommandL(cmd);
-}
-
-PVMFCommandId PVMFCPMKmjPlugInOMA1::GetNodeMetadataValues( PVMFSessionId aSessionId,
- PVMFMetadataList& aKeyList,
- Oscl_Vector<PvmiKvp,OsclMemAllocator>& aValueList,
- uint32 aStartingValueIndex,
- int32 aMaxValueEntries,
- const OsclAny* aContextData)
-{
- PVMFCPMKmjPlugInOMA1Command cmd;
-
- uint32_t keySize = aKeyList.size();
-
- cmd.Construct( aSessionId,
- PVMF_CPM_KMJ_PLUGIN_OMA_GET_NODEMETADATAVALUES,
- aKeyList,
- aValueList,
- aStartingValueIndex,
- aMaxValueEntries,
- aContextData);
-
- return QueueCommandL(cmd);
-}
-
-PVMFStatus PVMFCPMKmjPlugInOMA1::ReleaseNodeMetadataKeys( PVMFMetadataList& aKeyList,
- uint32 aStartingKeyIndex,
- uint32 aEndKeyIndex)
-{
- // Nothing needed-- there's no dynamic allocation in this node's key list
- return PVMFSuccess;
-}
-
-PVMFStatus PVMFCPMKmjPlugInOMA1::ReleaseNodeMetadataValues( Oscl_Vector<PvmiKvp,OsclMemAllocator>& aValueList,
- uint32 aStartingValueIndex,
- uint32 aEndValueIndex)
-{
- uint32_t numVaules = aValueList.size();
-
- if( (0 == numVaules)
- || (aStartingValueIndex >= numVaules)
- || (aStartingValueIndex > aEndValueIndex))
- {
- return PVMFErrArgument;
- }
-
- for(uint32 i = 0; i < numVaules; i++)
- {
- if(i < aStartingValueIndex)
- {
- continue;
- }
-
- if(i > (uint32_t)aEndValueIndex)
- {
- break;
- }
-
- char* key = aValueList[i].key;
-
- if (key)
- {
- if(oscl_strstr(key,"char*"))
- {
- if (aValueList[i].value.pChar_value)
- {
- OSCL_ARRAY_DELETE( aValueList[i].value.pChar_value);
- aValueList[i].value.pChar_value = NULL;
- }
- }
- else if(oscl_strstr(key,"uint8*"))
- {
- if (aValueList[i].value.pUint8_value)
- {
- OSCL_ARRAY_DELETE( aValueList[i].value.pUint8_value);
- aValueList[i].value.pUint8_value = NULL;
- }
- }
- }
- }
-
- return PVMFSuccess;
-}
-
-void PVMFCPMKmjPlugInOMA1::GetAvailableKeys()
-{
- iAvailableMetadataKeys.clear();
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- // no rigths, no any available keys
- if(DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession,&rightsInfo))
- {
- return;
- }
-
- if(0 == rightsInfo.playRights.indicator)
- {
- return;
- }
-
- //init metadata keys
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_IS_PROTECTED_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_IS_FORWARD_LOCKED_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_TYPE_QUERY);
-
- //has start time license
- if(rightsInfo.playRights.indicator & DRM_START_TIME_CONSTRAINT)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
-
- // has count license
- if(rightsInfo.playRights.indicator & DRM_COUNT_CONSTRAINT)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
-
- // has duration license
- if(rightsInfo.playRights.indicator & DRM_INTERVAL_CONSTRAINT)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- }
-
- // has end time license
- if(rightsInfo.playRights.indicator & DRM_END_TIME_CONSTRAINT)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY);
- }
-
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_ENVELOPE_DATA_SIZE_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_ENVELOPE_DATA_QUERY);
-}
-
-bool PVMFCPMKmjPlugInOMA1::IsQueryDataAvailable(OSCL_HeapString<OsclMemAllocator> queryData)
-{
- uint32_t numKeys = iAvailableMetadataKeys.size();
-
- for(uint32_t i = 0; i < numKeys; i++)
- {
- if(oscl_strcmp(queryData.get_cstr(), iAvailableMetadataKeys[i].get_cstr()) == 0)
- {
- return true;
- }
- }
-
- return false;
-}
-
-void PVMFCPMKmjPlugInOMA1::DoGetMetadataKeys(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- PVMFMetadataList* keylistptr = NULL;
- uint32 starting_index;
- int32 max_entries;
- char* query_key = NULL;
-
- aCmd.Parse( keylistptr,starting_index,max_entries,query_key);
-
- GetAvailableKeys();
- uint32_t numKeys = iAvailableMetadataKeys.size();
-
- if(0 == numKeys)
- {
- CommandComplete(iInputCommands,aCmd,PVMFSuccess);
- return ;
- }
-
- if((starting_index >= numKeys) || (max_entries < -1))
- {
- CommandComplete(iInputCommands,aCmd,PVMFErrArgument);
- return ;
- }
-
- if(-1 == max_entries)
- {
- max_entries = numKeys;
- }
-
- if(starting_index > (uint32)max_entries)
- {
- CommandComplete(iInputCommands,aCmd,PVMFErrArgument);
- return ;
- }
-
- for(uint32_t i = 0; i < numKeys; i++)
- {
- if(i < starting_index)
- {
- continue;
- }
-
- if(i > (uint32_t)max_entries)
- {
- break;
- }
-
- if(query_key == NULL)
- {
- keylistptr->push_back(iAvailableMetadataKeys[i]);
- }
- else
- {
- if(oscl_strcmp(iAvailableMetadataKeys[i].get_cstr(),query_key) == 0)
- {
- keylistptr->push_back(iAvailableMetadataKeys[i]);
- }
- }
- }
-
- CommandComplete(iInputCommands,aCmd,PVMFSuccess);
-}
-
-int32_t PVMFCPMKmjPlugInOMA1::IsStatelessLicense(void)
-{
- T_DRM_Rights_Info rights;
-
- memset(&rights, 0, sizeof(T_DRM_Rights_Info));
-
- if (DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession, &rights))
- {
- return FALSE;
- }
-
- /* For play permission rights, because this interface is currently provide to PV integrate */
- if (DRM_NO_CONSTRAINT == rights.playRights.indicator)
- {
- return TRUE;
- }
-
- if (DRM_NO_PERMISSION == rights.playRights.indicator)
- {
- return FALSE;
- }
-
- if ((0 == (DRM_INTERVAL_CONSTRAINT & rights.playRights.indicator))
- && (0 == (DRM_COUNT_CONSTRAINT & rights.playRights.indicator)))
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
-uint8_t* PVMFCPMKmjPlugInOMA1::GetLicenseType(void)
-{
- T_DRM_Rights_Info rights;
-
- memset(&rights, 0, sizeof(T_DRM_Rights_Info));
-
- if (DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession, &rights))
- {
- return NULL;
- }
-
- /* For play permission rights, because this interface is currently provide to PV integrate */
- if (DRM_NO_CONSTRAINT == rights.playRights.indicator)
- {
- return (uint8_t *)"unlimited";
- }
-
- /* time base */
- if(((DRM_END_TIME_CONSTRAINT | DRM_START_TIME_CONSTRAINT) == rights.playRights.indicator)
- || (DRM_START_TIME_CONSTRAINT == rights.playRights.indicator)
- || (DRM_END_TIME_CONSTRAINT == rights.playRights.indicator))
- {
- return (uint8_t *)"time";
- }
-
- if(DRM_INTERVAL_CONSTRAINT == rights.playRights.indicator)
- {
- return (uint8_t *)"duration";
- }
-
- if(DRM_COUNT_CONSTRAINT == rights.playRights.indicator)
- {
- return (uint8_t *)"count";
- }
-
- if((DRM_END_TIME_CONSTRAINT | DRM_START_TIME_CONSTRAINT | DRM_COUNT_CONSTRAINT) == rights.playRights.indicator)
- {
- return (uint8_t *)"time-count";
- }
-
- if((DRM_COUNT_CONSTRAINT | DRM_INTERVAL_CONSTRAINT) == rights.playRights.indicator)
- {
- return (uint8_t *)"duration-count";
- }
-
- if((DRM_END_TIME_CONSTRAINT | DRM_INTERVAL_CONSTRAINT) == rights.playRights.indicator)
- {
- return (uint8_t *)"duration-time";
- }
-
- if((DRM_END_TIME_CONSTRAINT | DRM_START_TIME_CONSTRAINT | DRM_COUNT_CONSTRAINT | DRM_INTERVAL_CONSTRAINT) == rights.playRights.indicator)
- {
- return (uint8_t *)"duration-time-count";
- }
-
- return NULL;
-}
-
-void PVMFCPMKmjPlugInOMA1::DoGetMetadataValues(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- PVMFMetadataList* keylistptr = NULL;
- Oscl_Vector<PvmiKvp,OsclMemAllocator>* valuelistptr = NULL;
- uint32 starting_index;
- int32 max_entries;
-
- aCmd.Parse( keylistptr,valuelistptr,starting_index,max_entries);
-
- GetAvailableKeys();
- uint32_t numKeys = iAvailableMetadataKeys.size();
-
- if(0 == numKeys)
- {
- CommandComplete(iInputCommands,aCmd,PVMFSuccess);
- return ;
- }
-
- uint32 numkeys = keylistptr->size();
-
- if (numkeys == 0 || starting_index >= numkeys || max_entries < -1)
- {
- CommandComplete(iInputCommands,aCmd,PVMFErrArgument);
- return ;
- }
-
- if(-1 == max_entries)
- {
- max_entries = iAvailableMetadataKeys.size();
- }
-
- if(starting_index > (uint32)max_entries)
- {
- CommandComplete(iInputCommands,aCmd,PVMFErrArgument);
- return ;
- }
-
- for(uint32_t i = 0; i < numkeys; i++)
- {
- if(i < starting_index)
- {
- continue;
- }
-
- if(i > (uint32_t)max_entries)
- {
- break;
- }
-
- PvmiKvp KeyVal = {NULL,1,1,{0}};
-
- /// get is protected
- if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_IS_PROTECTED_QUERY))
- {
- KeyVal.key = (char*)PVMF_DRM_INFO_IS_PROTECTED_VALUE;
- KeyVal.value.bool_value = true; ///drm 1.0 file is always protected
- }
- /// get is license available
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_QUERY))
- {
- KeyVal.key = (char*)PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_VALUE;
-
- // because pv only support audio and vedio, so we only check play license
- if(DRM_SUCCESS == SVC_drm_checkRights(m_drmSession,DRM_PERMISSION_PLAY))
- {
- KeyVal.value.bool_value = true;
- }
- else
- {
- KeyVal.value.bool_value = false;
- }
- }
- /// get is forward-lock
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_IS_FORWARD_LOCKED_QUERY))
- {
- KeyVal.key = (char*)PVMF_DRM_INFO_IS_FORWARD_LOCKED_VALUE;
-
- if(SEPARATE_DELIVERY == SVC_drm_getDeliveryMethod(m_drmSession))
- {
- KeyVal.value.bool_value = false;
- }
- else
- {
- KeyVal.value.bool_value = true;
- }
- }
- /// get can be used as ring-tone
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_QUERY))
- {
- KeyVal.key = (char*)PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_VALUE;
-
- if(TRUE == IsStatelessLicense())
- {
- KeyVal.value.bool_value = true;
- }
- else
- {
- KeyVal.value.bool_value = false;
- }
- }
- /// get license type
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_LICENSE_TYPE_QUERY))
- {
- char* value = (char*)GetLicenseType();
-
- if(NULL == value)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- uint32 valuelen = oscl_strlen(value) + 1;
-
- char* metaKeyValue = OSCL_ARRAY_NEW(char, valuelen);
- if(NULL == metaKeyValue)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- oscl_memset(metaKeyValue,0,valuelen);
- oscl_memcpy(metaKeyValue,value,valuelen);
-
- KeyVal.key = (char*)PVMF_DRM_INFO_LICENSE_TYPE_VALUE;
- KeyVal.length = valuelen;
- KeyVal.capacity = valuelen;
- KeyVal.value.pChar_value = metaKeyValue;
- }
- /// get license count
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_LICENSE_COUNT_QUERY))
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession,&rightsInfo))
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- /// no license count
- if(0 == (rightsInfo.playRights.indicator & DRM_COUNT_CONSTRAINT))
- {
- continue;
- }
-
- KeyVal.key = (char*)PVMF_DRM_INFO_LICENSE_COUNT_VALUE;
-
- // because pv only support audio and vedio, so we only check play count
- KeyVal.value.uint32_value = rightsInfo.playRights.count;
- }
- /// get license start time
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_LICENSE_START_TIME_QUERY))
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession,&rightsInfo))
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- // no license start time
- if(0 == (rightsInfo.playRights.indicator & DRM_START_TIME_CONSTRAINT))
- {
- continue;
- }
-
- int32_t startDate = rightsInfo.playRights.startDate;
- int32_t startTime = rightsInfo.playRights.startTime;
-
- if(startDate < 0 || startTime < 0)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- //convert to ISO 8601 Timeformat
- char* p = GetIso8601Time(startDate,startTime);
- if(p == NULL)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- uint32_t len = oscl_strlen(p) + 1;
-
- KeyVal.key = (char*)PVMF_DRM_INFO_LICENSE_START_TIME_VALUE;
- KeyVal.length = len;
- KeyVal.capacity = len;
- KeyVal.value.pChar_value = p;
- }
- /// get license expiration time
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY))
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession,&rightsInfo))
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- // no license expiration time
- if(0 == (rightsInfo.playRights.indicator & DRM_END_TIME_CONSTRAINT))
- {
- continue;
- }
-
- int32_t endDate = rightsInfo.playRights.endDate;
- int32_t endTime = rightsInfo.playRights.endTime;
-
- if(endDate < 0 || endTime < 0)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- //convert to ISO 8601 Timeformat
- char* p = GetIso8601Time(endDate,endTime);
- if(p == NULL)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- uint32_t len = oscl_strlen(p) + 1;
-
- KeyVal.key = (char*)PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_VALUE;
- KeyVal.length = len;
- KeyVal.capacity = len;
- KeyVal.value.pChar_value = p;
- }
- /// get license remain duration
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY))
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(DRM_SUCCESS != SVC_drm_getRightsInfo(m_drmSession,&rightsInfo))
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- // no license remain duration
- if(0 == (rightsInfo.playRights.indicator & DRM_INTERVAL_CONSTRAINT))
- {
- continue;
- }
-
- int32_t intervalDate = rightsInfo.playRights.intervalDate;
- int32_t intervalTime = rightsInfo.playRights.intervalTime;
-
- if(intervalDate < 0 || intervalTime < 0)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- KeyVal.key = (char*)PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_VALUE;
- KeyVal.value.uint32_value = GetDuration(intervalDate,intervalTime);
- }
- /// get enveloped content length
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_ENVELOPE_DATA_SIZE_QUERY))
- {
- int32_t contentSize = SVC_drm_getContentLength(m_drmSession);
-
- if(0 == contentSize)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- KeyVal.key = (char*)PVMF_DRM_INFO_ENVELOPE_DATA_SIZE_VALUE;
- KeyVal.value.uint32_value = (uint32_t)contentSize;
- }
- /// get enveloped content
- else if (oscl_strstr((*keylistptr)[i].get_cstr(), PVMF_DRM_INFO_ENVELOPE_DATA_QUERY))
- {
- int32_t contentSize = SVC_drm_getContentLength(m_drmSession);
-
- if(0 == contentSize)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- uint8_t* buf = OSCL_ARRAY_NEW(uint8_t,contentSize);
- if(NULL == buf)
- {
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- oscl_memset(buf,0,contentSize);
-
- if(0 >= SVC_drm_getContent(m_drmSession,0,buf,contentSize))
- {
- OSCL_ARRAY_DELETE(buf);
- CommandComplete(iInputCommands,aCmd,PVMFFailure);
- return;
- }
-
- KeyVal.key = (char*)PVMF_DRM_INFO_ENVELOPE_DATA_VALUE;
- KeyVal.length = contentSize;
- KeyVal.capacity = contentSize;
- KeyVal.value.pUint8_value = buf;
- }
- else
- {
- continue;
- }
-
- // adds metavalue
- valuelistptr->push_back(KeyVal);
- }
-
- CommandComplete(iInputCommands,aCmd,PVMFSuccess);
-}
-
-/// iDate Like: 20070915, iTime like: 200202
-/// ISO 8601 time like: 2007-09-15T20:02:02Z
-char* PVMFCPMKmjPlugInOMA1::GetIso8601Time(int32_t iDate, int32_t iTime)
-{
- char temp[20] = {0};
- char* p = temp;
- uint32_t digitalNum = 0;
- uint32_t count = 0;
- OSCL_HeapString<OsclMemAllocator> isoTime;
-
- // convert date
- do
- {
- // insert '-' between YYYY and MM and DD
- if( count == 2 || count == 4)
- {
- *p++ = '-';
- }
-
- digitalNum = iDate % 10;
- iDate /= 10;
-
- *p++ = (char)(digitalNum + '0');
-
- count++;
- }while(iDate > 0);
-
- if(8 != count)
- {
- return NULL;
- }
-
- p--;
-
- /* We now have the digit of the number in the buffer, but in reverse
- order. Thus we reverse them now. */
- do
- {
- isoTime += *p;
- p--;
- }while(p >= temp);
-
- // insert date and time separator
- isoTime += 'T';
-
- oscl_memset(temp,0,sizeof(temp));
- p = temp;
- count = 0;
-
- // convert time
- do
- {
- // insert ':' between HH and MM and SS
- if( count == 2 || count == 4)
- {
- *p++ = ':';
- }
-
- digitalNum = iTime % 10;
- iTime /= 10;
-
- *p++ = (char)(digitalNum + '0');
-
- count++;
- }while(iTime > 0);
-
- if((6 != count) && (5 != count))
- {
- return NULL;
- }
-
- p--;
-
- /* We now have the digit of the number in the buffer, but in reverse
- order. Thus we reverse them now. */
- do
- {
- isoTime += *p;
- p--;
- }while(p >= temp);
-
- /// 'Z' means UTC time
- isoTime += 'Z';
-
- uint32_t len = oscl_strlen(isoTime.get_cstr()) + 1;
-
- p = OSCL_ARRAY_NEW(char,len);
-
- if(p == NULL)
- {
- return NULL;
- }
-
- oscl_memset(p,0,len);
- oscl_strncpy(p,isoTime.get_cstr(),len);
-
- return p;
-}
-
-/// convert day and time to seconds
-uint32_t PVMFCPMKmjPlugInOMA1::GetDuration(int32_t iDay, int32_t iTime)
-{
- if((iDay < 0) || (iTime < 0))
- {
- return 0;
- }
-
- if((0 == iDay) && (0 == iTime))
- {
- return 0;
- }
-
- uint32_t duration = iDay * 24 * 60 * 60;
- uint32_t hours = iTime / 10000;
- uint32_t minutes = (iTime / 100) % 100;
- uint32_t seconds = iTime % 100;
-
- duration += hours * 60 * 60;
- duration += minutes * 60;
- duration += seconds;
-
- return duration;
-}
-
-// Called by the command handler AO to do the Query UUID
-void PVMFCPMKmjPlugInOMA1::DoQueryUuid(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- PvmfMimeString* mimetype;
- Oscl_Vector<PVUuid, OsclMemAllocator> *uuidvec;
- bool exactmatch;
-
- aCmd.PVMFCPMKmjPlugInOMA1CommandBase::Parse(mimetype, uuidvec, exactmatch);
-
- // Try to match the input mimetype against any of the interfaces supported by this plugin
- if (*mimetype == PVMF_CPMPLUGIN_AUTHENTICATION_INTERFACE_MIMETYPE)
- {
- PVUuid uuid(PVMFCPMPluginAuthenticationInterfaceUuid);
- uuidvec->push_back(uuid);
- }
- else if (*mimetype == PVMF_CPMPLUGIN_AUTHORIZATION_INTERFACE_MIMETYPE)
- {
- PVUuid uuid(PVMFCPMPluginAuthorizationInterfaceUuid);
- uuidvec->push_back(uuid);
- }
- else if (*mimetype == PVMF_CPMPLUGIN_ACCESS_INTERFACE_FACTORY_MIMETYPE)
- {
- PVUuid uuid(PVMFCPMPluginAccessInterfaceFactoryUuid);
- uuidvec->push_back(uuid);
- }
- else if (*mimetype == PVMF_CPMPLUGIN_LICENSE_INTERFACE_MIMETYPE)
- {
- PVUuid uuid(PVMFCPMPluginLicenseInterfaceUuid);
- uuidvec->push_back(uuid);
- }
- else if (*mimetype == PVMF_META_DATA_EXTENSION_INTERFACE_MIMETYPE)
- {
- PVUuid uuid(KPVMFMetadataExtensionUuid);
- uuidvec->push_back(uuid);
- }
-
- CommandComplete(iInputCommands,aCmd,PVMFSuccess);
-}
-
-// Called by the command handler AO to do the Query Interface.
-void PVMFCPMKmjPlugInOMA1::DoQueryInterface(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- PVUuid* uuid;
- PVInterface** ptr;
-
- aCmd.PVMFCPMKmjPlugInOMA1CommandBase::Parse(uuid, ptr);
-
- if ((*uuid == PVMFCPMPluginAuthorizationInterfaceUuid)
- || (*uuid == PVMFCPMPluginAccessInterfaceFactoryUuid))
- {
- if (m_oSourceSet == false)
- {
- CommandComplete(iInputCommands, aCmd, PVMFErrInvalidState);
- return;
- }
- }
-
- if(queryInterface(*uuid, *ptr))
- {
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
- }
- else // not supported
- {
- *ptr = NULL;
-
- CommandComplete(iInputCommands, aCmd, PVMFErrNotSupported);
- }
-}
-
-bool PVMFCPMKmjPlugInOMA1::queryInterface(const PVUuid& uuid, PVInterface*& iface)
-{
- if(uuid == PVMFCPMPluginAuthenticationInterfaceUuid)
- {
- PVMFCPMPluginAuthenticationInterface* myInterface
- = OSCL_STATIC_CAST(PVMFCPMPluginAuthenticationInterface*,this);
-
- iface = OSCL_STATIC_CAST(PVInterface*, myInterface);
- }
- else if(uuid == PVMFCPMPluginAuthorizationInterfaceUuid)
- {
- PVMFCPMPluginAuthorizationInterface* myInterface
- = OSCL_STATIC_CAST(PVMFCPMPluginAuthorizationInterface*,this);
-
- iface = OSCL_STATIC_CAST(PVInterface*, myInterface);
- }
- else if (uuid == PVMFCPMPluginAccessInterfaceFactoryUuid)
- {
- PVMFCPMPluginAccessInterfaceFactory* myInterface
- = OSCL_STATIC_CAST(PVMFCPMPluginAccessInterfaceFactory*,this);
-
- iface = OSCL_STATIC_CAST(PVInterface*, myInterface);
- }
- else if (uuid == PVMFCPMPluginLicenseInterfaceUuid)
- {
- PVMFCPMPluginLicenseInterface* myInterface
- = OSCL_STATIC_CAST(PVMFCPMPluginLicenseInterface*,this);
-
- iface = OSCL_STATIC_CAST(PVInterface*, myInterface);
- }
- else if (uuid == KPVMFMetadataExtensionUuid)
- {
- PVMFMetadataExtensionInterface* myInterface
- = OSCL_STATIC_CAST(PVMFMetadataExtensionInterface*,this);
-
- iface = OSCL_STATIC_CAST(PVInterface*, myInterface);
- }
- else
- {
- return false;
- }
-
- addRef();
- return true;
-}
-
-void PVMFCPMKmjPlugInOMA1::DoInit(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- CommandComplete(iInputCommands,aCmd,PVMFSuccess);
-}
-
-void PVMFCPMKmjPlugInOMA1::DoReset(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- m_oSourceSet = false;
- iAvailableMetadataKeys.clear();
-
- if(true == m_pvfile.IsOpen())
- {
- m_pvfile.Close();
- }
-
- if(m_dataAccessFile)
- {
- OSCL_DELETE(m_dataAccessFile);
- m_dataAccessFile = NULL;
- }
-
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
-}
-
-void PVMFCPMKmjPlugInOMA1::DoAuthenticate(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- OsclAny* authenticationData;
- OsclAny* dummy;
- aCmd.Parse(authenticationData,dummy);
-
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
-}
-
-void PVMFCPMKmjPlugInOMA1::DoAuthorizeUsage(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- PvmiKvp* requestedUsage;
- PvmiKvp* approvedUsage;
- PvmiKvp* authorizationData;
- uint32* requestTimeOutInMS;
-
- aCmd.Parse(OSCL_STATIC_CAST(OsclAny*&,requestedUsage),
- OSCL_STATIC_CAST(OsclAny*&,approvedUsage),
- OSCL_STATIC_CAST(OsclAny*&,authorizationData),
- OSCL_STATIC_CAST(OsclAny*&,requestTimeOutInMS));
-
- //Get DRM delivery type
- int32_t drmMethod = SVC_drm_getDeliveryMethod(m_drmSession);
-
- //Check and update the rights
- switch (drmMethod)
- {
- case FORWARD_LOCK:
- break;
-
- case COMBINED_DELIVERY:
- case SEPARATE_DELIVERY:
- case SEPARATE_DELIVERY_FL:
- {
- if (BITMASK_PVMF_CPM_DRM_INTENT_PLAY & requestedUsage->value.uint32_value)
- {
- //Check whether there is a valid rights
- if (DRM_SUCCESS != SVC_drm_checkRights(m_drmSession, DRM_PERMISSION_PLAY))
- {
- if( (SEPARATE_DELIVERY == drmMethod ) || (SEPARATE_DELIVERY_FL == drmMethod))
- {
- CommandComplete(iInputCommands, aCmd,PVMFErrLicenseRequired);
- }
- else
- {
- CommandComplete(iInputCommands, aCmd, PVMFErrAccessDenied);
- }
-
- LOGD("PVMFCPMKmjPlugInOMA1:DoAuthorizeUsage SVC_drm_checkRights failed");
- return;
- }
- }
- else //unsupported rights
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoAuthorizeUsage unsupported rights");
- CommandComplete(iInputCommands, aCmd, PVMFErrAccessDenied);
- return;
- }
- }
- break;
- default:
- CommandComplete(iInputCommands, aCmd, PVMFFailure);
- return;
- }
-
- approvedUsage->value.uint32_value = requestedUsage->value.uint32_value;
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
-}
-
-void PVMFCPMKmjPlugInOMA1::DoUsageComplete(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- //consume rights
- if (DRM_SUCCESS != SVC_drm_consumeRights(m_drmSession, DRM_PERMISSION_PLAY))
- {
- LOGD("PVMFCPMKmjPlugInOMA1:DoAuthorizeUsage SVC_drm_consumeRights failed");
- CommandComplete(iInputCommands, aCmd, PVMFErrAccessDenied);
- return;
- }
-
- CommandComplete(iInputCommands, aCmd, PVMFSuccess);
-}
-
-PVMFStatus PVMFCPMKmjPlugInOMA1::QueryAccessInterfaceUUIDs( Oscl_Vector<PVUuid,
- OsclMemAllocator>& aUuids)
-{
- aUuids.push_back(PVMFCPMPluginLocalSyncAccessInterfaceUuid);
- return PVMFSuccess;
-}
-
-PVInterface* PVMFCPMKmjPlugInOMA1::CreatePVMFCPMPluginAccessInterface(PVUuid& aUuid)
-{
- if (aUuid == PVMFCPMPluginLocalSyncAccessInterfaceUuid)
- {
- PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl* iface
- = OSCL_NEW( PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl,(*this));
-
- PVMFCPMPluginLocalSyncAccessInterface* interimPtr1
- = OSCL_STATIC_CAST(PVMFCPMPluginLocalSyncAccessInterface*, iface);
-
- PVMFCPMPluginAccessInterface* interimPtr2
- = OSCL_STATIC_CAST(PVMFCPMPluginAccessInterface*, interimPtr1);
-
- return (OSCL_STATIC_CAST(PVInterface*, interimPtr2));
- }
-
- return NULL;
-}
-
-void PVMFCPMKmjPlugInOMA1::DestroyPVMFCPMPluginAccessInterface(PVUuid& aUuid,PVInterface* aPtr)
-{
- if (aUuid == PVMFCPMPluginLocalSyncAccessInterfaceUuid)
- {
- PVMFCPMPluginAccessInterface* interimPtr1
- = OSCL_STATIC_CAST(PVMFCPMPluginAccessInterface*,aPtr);
-
- PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl* iface
- = OSCL_STATIC_CAST(PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl*,interimPtr1);
-
- OSCL_DELETE(iface);
- }
- else
- {
- OSCL_ASSERT(false);
- }
-}
-
-/**
- * This routine is called by various command APIs to queue an
- * asynchronous command for processing by the command handler AO.
- * This function may leave if the command can't be queued due to memory allocation failure.
- */
-PVMFCommandId PVMFCPMKmjPlugInOMA1::QueueCommandL(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- PVMFCommandId id = iInputCommands.AddL(aCmd);
-
- /* wakeup the AO */
- if(false == bRunUT)
- {
- RunIfNotReady();
- }
-
- return id;
-}
-
-// The various command handlers call this when a command is complete.
-void PVMFCPMKmjPlugInOMA1::CommandComplete( PVMFCPMKmjPlugInOMA1CmdQ& aCmdQ,
- PVMFCPMKmjPlugInOMA1Command& aCmd,
- PVMFStatus aStatus,
- OsclAny* aEventData,
- PVUuid* aEventUUID,
- int32* aEventCode)
-{
- PVInterface* extif = NULL;
- PVMFBasicErrorInfoMessage* errormsg = NULL;
-
- if (aEventUUID && aEventCode)
- {
- errormsg = OSCL_NEW(PVMFBasicErrorInfoMessage,(*aEventCode,*aEventUUID,NULL));
- extif = OSCL_STATIC_CAST(PVInterface*,errormsg);
- }
-
- /* create event response */
- PVMFCmdResp resp(aCmd.iId,aCmd.iContext,aStatus,extif,aEventData);
- PVMFSessionId session = aCmd.iSession;
-
- /* Erase the command from the queue */
- aCmdQ.Erase(&aCmd);
-
- /* Report completion to the session observer */
- ReportCmdCompleteEvent(session,resp);
-
- if (errormsg)
- {
- errormsg->removeRef();
- }
-
- //Reschedule if there are more commands.
- if(!iInputCommands.empty() && IsAdded())
- {
- RunIfNotReady();
- }
-
- cmdStatus = aStatus;
-}
-
-void PVMFCPMKmjPlugInOMA1::MoveCmdToCurrentQueue(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- int32 err;
- OSCL_TRY(err,iCurrentCommand.StoreL(aCmd););
-
- if (err != OsclErrNone)
- {
- CommandComplete(iInputCommands,aCmd,PVMFErrNoMemory);
- return;
- }
-
- iInputCommands.Erase(&aCmd);
- return;
-}
-
-/**
- * This AO handles API commands. The AO will process one command per call.
- * It will re-schedule itself and run continuously until it runs out of things to do.
- */
-void PVMFCPMKmjPlugInOMA1::Run()
-{
- // Process commands.
- if (!iInputCommands.empty())
- {
- ProcessCommand(iInputCommands.front());
- }
-}
-
-/**
- * Called by the command handler AO to process a command from the input queue.
- * Return true if a command was processed, false if the command
- * processor is busy and can't process another command now.
- */
-bool PVMFCPMKmjPlugInOMA1::ProcessCommand(PVMFCPMKmjPlugInOMA1Command& aCmd)
-{
- /*
- * normally this node will not start processing one command until the prior one is finished.
- * However, a hi priority command such as Cancel must be able to interrupt a command in progress.
- */
- if (!iCurrentCommand.empty()
- && !aCmd.hipri()
- && aCmd.iCmd != PVMF_CPM_KMJ_PLUGIN_OMA1_CANCEL_GET_LICENSE)
- {
- return false;
- }
-
- switch(aCmd.iCmd)
- {
- case PVMF_CPM_KMJ_PLUGIN_OMA1_QUERYUUID:
- DoQueryUuid(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_QUERYINTERFACE:
- DoQueryInterface(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_INIT:
- DoInit(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_RESET:
- DoReset(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_AUTHENTICATE:
- DoAuthenticate(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_AUTHORIZE_USAGE:
- DoAuthorizeUsage(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_USAGE_COMPLETE:
- DoUsageComplete(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE_W:
- DoGetLicense(aCmd,true);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE:
- DoGetLicense(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA1_CANCEL_GET_LICENSE:
- DoCancelGetLicense(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA_GET_NODEMETADATAKEYS:
- DoGetMetadataKeys(aCmd);
- break;
- case PVMF_CPM_KMJ_PLUGIN_OMA_GET_NODEMETADATAVALUES:
- DoGetMetadataValues(aCmd);
- break;
- default:
- /* unknown command type */
- CommandComplete(iInputCommands,aCmd,PVMFErrNotSupported);
- break;
- }
-
- return true;
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::OpenContent()
-{
- //file should has been opened by outer when come to here
- if(false == iContainer.m_pvfile.IsOpen())
- {
- return -1;
- }
-
- filePos = 0;
- return 0;
-}
-
-uint32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::ReadAndUnlockContent( OsclAny *buffer,
- uint32 size,
- uint32 numelements)
-{
- uint32 readLen = size * numelements;
- int32_t ret = SVC_drm_getContent(iContainer.m_drmSession,filePos,(uint8_t*)buffer,readLen);
- LOGD("in drm plugin ReadAndUnlockContent: require read len: %d, actul read len: %d\r\n",readLen, ret);
- filePos += readLen;
- return readLen;
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::SeekContent( int32 offset,
- Oscl_File::seek_type origin)
-{
- switch(origin)
- {
- case Oscl_File::SEEKSET:
- filePos = offset;
- break;
- case Oscl_File::SEEKCUR:
- filePos += offset;
- break;
- case Oscl_File::SEEKEND:
- filePos = SVC_drm_getContentLength(iContainer.m_drmSession);
- break;
- }
-
- return 0;
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::GetCurrentContentPosition()
-{
- return filePos;
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::Flush()
-{
- return iContainer.m_pvfile.Flush();
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::GetContentAccessError()
-{
- return 0;
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::GetContentSize()
-{
- return SVC_drm_getContentLength(iContainer.m_drmSession);
-}
-
-int32 PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::CloseContent()
-{
- //file would be closed by outer
- filePos = 0;
- return 0;
-}
-
-bool PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl::queryInterface(const PVUuid& uuid, PVInterface*& iface)
-{
- if (uuid == PVMFCPMPluginLocalSyncAccessInterfaceUuid)
- {
- PVMFCPMPluginLocalSyncAccessInterface* interimPtr1
- = OSCL_STATIC_CAST(PVMFCPMPluginLocalSyncAccessInterface*, this);
-
- PVMFCPMPluginAccessInterface* interimPtr2
- = OSCL_STATIC_CAST(PVMFCPMPluginAccessInterface*, interimPtr1);
-
- iface = OSCL_STATIC_CAST(PVInterface*, interimPtr2);
- return true;
- }
-
- return false;
-}
-
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1.h b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1.h
deleted file mode 100644
index 19dbb23..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1.h
+++ /dev/null
@@ -1,818 +0,0 @@
-/*
- * Copyright (C) 2007 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 PVMF_CPMPLUGIN_KMJ_OMA1_H_INCLUDED
-#define PVMF_CPMPLUGIN_KMJ_OMA1_H_INCLUDED
-
-#include "oscl_base.h"
-#include "oscl_types.h"
-#include "pvfile.h"
-#include "oscl_file_io.h"
-#include "pvlogger.h"
-#include "pvmf_node_interface.h"
-#include "pvmf_node_utils.h"
-#include "oscl_scheduler_ao.h"
-#include "pvmf_cpmplugin_interface.h"
-#include "pvmf_cpmplugin_authorization_interface.h"
-#include "pvmf_cpmplugin_authentication_interface.h"
-#include "pvmf_cpmplugin_access_interface_factory.h"
-#include "pvmf_cpmplugin_access_interface.h"
-#include "pvmf_cpmplugin_factory_registry.h"
-#include "pvmf_cpmplugin_kmj_oma1_factory.h"
-#include "pvmf_cpmplugin_kmj_oma1_types.h"
-#include "oscl_string_containers.h"
-#include "pvmf_cpmplugin_license_interface.h"
-#include "pvmf_meta_data_extension.h"
-#include "pvmf_cpmplugin_kmj_oma1_data_access.h"
-
-
-#define PVMFCPMKmjPlugInOMA1CommandBase PVMFGenericNodeCommand<OsclMemAllocator>
-
-class PVMFCPMKmjPlugInOMA1Command : public PVMFCPMKmjPlugInOMA1CommandBase
-{
-public:
- void Construct(PVMFSessionId s,
- int32 cmd,
- OsclAny* aArg1,
- OsclAny* aArg2,
- const OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s, cmd, aContext);
-
- iParam1 = aArg1;
- iParam2 = aArg2;
- };
-
- void Parse(OsclAny*&arg1, OsclAny*&arg2)
- {
- arg1 = iParam1;
- arg2 = iParam2;
- };
-
- void Construct(PVMFSessionId s,
- int32 cmd,
- OsclAny* aArg1,
- OsclAny* aArg2,
- OsclAny* aArg3,
- const OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s, cmd, aContext);
-
- iParam1 = aArg1;
- iParam2 = aArg2;
- iParam3 = aArg3;
- };
-
- void Parse(OsclAny*&arg1, OsclAny*&arg2, OsclAny*&arg3)
- {
- arg1 = iParam1;
- arg2 = iParam2;
- arg3 = iParam3;
- };
-
- void Construct(PVMFSessionId s,
- int32 cmd,
- OsclAny* aArg1,
- OsclAny* aArg2,
- OsclAny* aArg3,
- OsclAny* aArg4,
- const OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s, cmd, aContext);
-
- iParam1 = aArg1;
- iParam2 = aArg2;
- iParam3 = aArg3;
- iParam4 = aArg4;
- };
-
- void Parse(OsclAny*&arg1, OsclAny*&arg2, OsclAny*&arg3, OsclAny*&arg4)
- {
- arg1 = iParam1;
- arg2 = iParam2;
- arg3 = iParam3;
- arg4 = iParam4;
- };
-
- /* Constructor and parser for GetLicenseW */
- void Construct(PVMFSessionId s,
- int32 cmd,
- OSCL_wString& aContentName,
- OsclAny* aLicenseData,
- uint32 aDataSize,
- int32 aTimeoutMsec,
- OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,cmd,aContext);
-
- iParam1 = (OsclAny*)&aContentName;
- iParam2 = (OsclAny*)aLicenseData;
- iParam3 = (OsclAny*)aDataSize;
- iParam4 = (OsclAny*)aTimeoutMsec;
- iParam5 = NULL;
- }
-
- void Parse(OSCL_wString*& aContentName,
- OsclAny*& aLicenseData,
- uint32& aDataSize,
- int32& aTimeoutMsec)
- {
- aContentName = (OSCL_wString*)iParam1;
- aLicenseData = (PVMFTimestamp*)iParam2;
- aDataSize = (uint32)iParam3;
- aTimeoutMsec = (int32)iParam4;
- }
-
- /* Constructor and parser for GetLicense */
- void Construct(PVMFSessionId s,
- int32 cmd,
- OSCL_String& aContentName,
- OsclAny* aLicenseData,
- uint32 aDataSize,
- int32 aTimeoutMsec,
- OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,cmd,aContext);
-
- iParam1 = (OsclAny*)&aContentName;
- iParam2 = (OsclAny*)aLicenseData;
- iParam3 = (OsclAny*)aDataSize;
- iParam4 = (OsclAny*)aTimeoutMsec;
- iParam5 = NULL;
- }
-
- void Parse(OSCL_String*& aContentName,
- OsclAny*& aLicenseData,
- uint32& aDataSize,
- int32& aTimeoutMsec)
- {
- aContentName = (OSCL_String*)iParam1;
- aLicenseData = (PVMFTimestamp*)iParam2;
- aDataSize = (uint32)iParam3;
- aTimeoutMsec = (int32)iParam4;
- }
-
- // Constructor and parser for GetNodeMetadataKeys
- void Construct( PVMFSessionId s,
- int32 cmd,
- PVMFMetadataList& aKeyList,
- uint32 aStartingIndex,
- int32 aMaxEntries,
- char* aQueryKey,
- const OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,cmd,aContext);
-
- iParam1 = (OsclAny*)&aKeyList;
- iParam2 = (OsclAny*)aStartingIndex;
- iParam3 = (OsclAny*)aMaxEntries;
-
- if (aQueryKey)
- {
- //allocate a copy of the query key string.
- Oscl_TAlloc<OSCL_HeapString<OsclMemAllocator>,OsclMemAllocator> str;
- iParam4 = str.ALLOC_AND_CONSTRUCT(aQueryKey);
- }
- }
-
- void Parse( PVMFMetadataList*& MetaDataListPtr,
- uint32 &aStartingIndex,
- int32 &aMaxEntries,
- char*& aQueryKey)
- {
- MetaDataListPtr = (PVMFMetadataList*)iParam1;
- aStartingIndex = (uint32)iParam2;
- aMaxEntries = (int32)iParam3;
- aQueryKey = NULL;
-
- if ( iParam4 )
- {
- OSCL_HeapString<OsclMemAllocator>* keystring = (OSCL_HeapString<OsclMemAllocator>*)iParam4;
- aQueryKey = keystring->get_str();
- }
- }
-
- // Constructor and parser for GetNodeMetadataValue
- void Construct( PVMFSessionId s,
- int32 cmd,
- PVMFMetadataList& aKeyList,
- Oscl_Vector<PvmiKvp,OsclMemAllocator>& aValueList,
- uint32 aStartIndex,
- int32 aMaxEntries,
- const OsclAny* aContext)
- {
- PVMFCPMKmjPlugInOMA1CommandBase::Construct(s,cmd,aContext);
-
- iParam1 = (OsclAny*)&aKeyList;
- iParam2 = (OsclAny*)&aValueList;
- iParam3 = (OsclAny*)aStartIndex;
- iParam4 = (OsclAny*)aMaxEntries;
-
- }
-
- void Parse( PVMFMetadataList* &aKeyList,
- Oscl_Vector<PvmiKvp,OsclMemAllocator>* &aValueList,
- uint32 &aStartingIndex,
- int32 &aMaxEntries)
- {
- aKeyList = (PVMFMetadataList*)iParam1;
- aValueList = (Oscl_Vector<PvmiKvp,OsclMemAllocator>*)iParam2;
- aStartingIndex = (uint32)iParam3;
- aMaxEntries = (int32)iParam4;
- }
-};
-
-typedef PVMFNodeCommandQueue<PVMFCPMKmjPlugInOMA1Command,OsclMemAllocator> PVMFCPMKmjPlugInOMA1CmdQ;
-
-#define PVMF_CPM_KMJ_PLUGIN_OMA1_INTERNAL_CMDQ_SIZE 15
-
-/* Start range for command IDs */
-#define PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START 50000
-
-/*
- * IDs for all of the asynchronous plugin commands.
- */
-enum TPVMFCPMKmjPlugInOMA1Command
-{
- PVMF_CPM_KMJ_PLUGIN_OMA1_QUERYUUID = PVMF_GENERIC_NODE_QUERYUUID,
- PVMF_CPM_KMJ_PLUGIN_OMA1_QUERYINTERFACE = PVMF_GENERIC_NODE_QUERYINTERFACE,
- PVMF_CPM_KMJ_PLUGIN_OMA1_INIT = PVMF_GENERIC_NODE_COMMAND_LAST,
- PVMF_CPM_KMJ_PLUGIN_OMA1_RESET,
- PVMF_CPM_KMJ_PLUGIN_OMA1_AUTHENTICATE,
- PVMF_CPM_KMJ_PLUGIN_OMA1_AUTHORIZE_USAGE,
- PVMF_CPM_KMJ_PLUGIN_OMA1_USAGE_COMPLETE,
- PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE_W,
- PVMF_CPM_KMJ_PLUGIN_OMA1_GET_LICENSE,
- PVMF_CPM_KMJ_PLUGIN_OMA1_CANCEL_GET_LICENSE,
- PVMF_CPM_KMJ_PLUGIN_OMA_GET_NODEMETADATAKEYS,
- PVMF_CPM_KMJ_PLUGIN_OMA_GET_NODEMETADATAVALUES
-};
-
-class OsclFileHandle;
-
-// CPM OMA1.0 Plugin for KMJ DRM
-class PVMFCPMKmjPlugInOMA1 : public OsclActiveObject,
- public PVMFCPMPluginInterface,
- public PVMFCPMPluginAuthenticationInterface,
- public PVMFCPMPluginAuthorizationInterface,
- public PVMFCPMPluginAccessInterfaceFactory,
- public PVMFCPMPluginLicenseInterface,
- public PVMFMetadataExtensionInterface
-{
-public:
- /**
- * create this plugin
- * @param none
- *
- * @returns this plugin created
- **/
- static PVMFCPMPluginInterface* CreatePlugIn();
-
- /**
- * destroy this plugin
- *
- * @param PVMFCPMPluginInterface the plugin to be destroied
- *
- * @returns none
- **/
- static void DestroyPlugIn(PVMFCPMPluginInterface*);
-
-public:
- /* From PVInterface */
- void addRef()
- {
- ++iExtensionRefCount;
- }
-
- void removeRef()
- {
- --iExtensionRefCount;
- }
-
- ////////////////* From PVMFCPMPluginInterface */
- /**
- * starts initialization of the plugin
- *
- * @param aSession a valid session id
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns a unique commmand id for asynchronous completion
- **/
- PVMFCommandId Init(PVMFSessionId aSession,const OsclAny* aContext = NULL);
-
- /**
- * This API is to allow for extensibility of the CPM plugin interface.
- * It allows a caller to ask for all UUIDs associated with a particular MIME type.
- * If interfaces of the requested MIME type are found within the system, they are added
- * to the UUIDs array.
- *
- * Also added to the UUIDs array will be all interfaces which have the requested MIME
- * type as a base MIME type. This functionality can be turned off.
- *
- * @param aMimeType The MIME type of the desired interfaces
- * @param aUuids A vector to hold the discovered UUIDs
- * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns A unique command id for asynchronous completion
- **/
- PVMFCommandId QueryUUID( PVMFSessionId aSession,
- const PvmfMimeString& aMimeType,
- Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids,
- bool aExactUuidsOnly = false,
- const OsclAny* aContext = NULL);
-
- /**
- * This API is to allow for extensibility of the CPM Plugin interface.
- * It allows a caller to ask for an instance of a particular interface object to be returned.
- * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with
- * an interface ID that is a UUID as in DCE and a pointer to the interface object is
- * returned if it is supported. Otherwise the returned pointer is NULL.
- *
- * @param aUuid The UUID of the desired interface
- * @param aInterfacePtr The output pointer to the desired interface
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns A unique command id for asynchronous completion
- **/
- PVMFCommandId QueryInterface( PVMFSessionId aSession,
- const PVUuid& aUuid,
- PVInterface*& aInterfacePtr,
- const OsclAny* aContext = NULL);
-
-
- /**
- * intimate the plugin of the source content for current playback
- *
- * @param aSourceURL string containing the source URL( fila name etc)
- * @param aSourceFormat format type of the source(MP4, MP3,ASF, etc)
- * @param aSourceData opaque pointer interpreted based on source type
- *
- * @returns PVMFSuccess success
- * PVMFFailure failure
- * PVMFErrLicenseRequired license required
- **/
- PVMFStatus SetSourceInitializationData( OSCL_wString& aSourceURL,
- PVMFFormatType& aSourceFormat,
- OsclAny* aSourceData);
-
- /**
- * resets the plugin
- *
- * @param aSession a valid session id
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns a unique commmand id for asynchronous completion
- **/
- PVMFCommandId Reset(PVMFSessionId aSession,const OsclAny* aContext = NULL);
-
- /**
- * returns the cpm content type
- *
- * @param none
- *
- * @returns PVMF_CPM_FORMAT_OMA1
- **/
- PVMFCPMContentType GetCPMContentType();
-
- ///////////////////////////////* From PVMFCPMPluginAuthenticationInterface */
- /**
- * asynchronous method to authenticate with a plugin
- *
- * @param aSessionId a valid session id
- * @param aAuthenticationData the authentication data that may be needed by the plugin to authenticate
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns a unique commmand id for asynchronous completion
- **/
- PVMFCommandId AuthenticateUser( PVMFSessionId aSessionId,
- OsclAny* aAuthenticationData,
- OsclAny* aContext = NULL);
-
-
- ///////////////////////////////* From PVMFCPMPluginAuthorizationInterface */
- /**
- * asynchronous method to athorize usage with a plugin
- *
- * @param aSessionId a valid session id
- * @param aRequestedUsage the requested usage
- * @param aApprovedUsage the approved intent
- * @param aAuthorizationData the authorization data
- * @param aRequestTimeOutInMS timeout with which the authorization request has to complete
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns a unique commmand id for asynchronous completion
- **/
- PVMFCommandId AuthorizeUsage( PVMFSessionId aSessionId,
- PvmiKvp& aRequestedUsage,
- PvmiKvp& aApprovedUsage,
- PvmiKvp& aAuthorizationData,
- uint32& aRequestTimeOutInMS,
- OsclAny* aContext = NULL);
- /**
- * asynchronous method to indicate to the plugin that the content usage is complete
- *
- * @param aSessionId a valid session id
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns a unique commmand id for asynchronous completion
- **/
- PVMFCommandId UsageComplete(PVMFSessionId aSessionId,const OsclAny* aContext = NULL);
-
- //////////////////////////////* From PVMFCPMPluginLicenseInterface */
- /**
- * get license URL
- *
- * @param aSessionId the assigned plugin session ID to use for this request
- * @param aContentName Null terminated unicode string containing the content name
- * @param aLicenseURL Null terminated unicode string containing the license URL
- *
- * @returns PVMFErrNotSupported not supported
- **/
- PVMFStatus GetLicenseURL(PVMFSessionId aSessionId,
- OSCL_wString& aContentName,
- OSCL_wString& aLicenseURL)
- {
- //must use Async method.
- return PVMFErrNotSupported;
- }
-
- /**
- * get license URL
- *
- * @param aSessionId the assigned plugin session ID to use for this request
- * @param aContentName Null terminated unicode string containing the content name
- * @param aLicenseURL Null terminated unicode string containing the license URL
- *
- * @returns PVMFErrNotSupported not supported
- **/
- PVMFStatus GetLicenseURL(PVMFSessionId aSessionId,
- OSCL_String& aContentName,
- OSCL_String& aLicenseURL)
- {
- //must use Async method.
- return PVMFErrNotSupported;
- }
-
- /**
- * get license
- *
- * @param aSessionId the assigned plugin session ID to use for this request
- * @param aContentName Null terminated unicode string containing the content name
- * @param aData buffer to store license
- * @param aDataSize the length of license
- * @param aTimeoutMsec the timeout for get license
- *
- * @returns a unique command id for asynchronous completion
- **/
- PVMFCommandId GetLicense(PVMFSessionId aSessionId,
- OSCL_wString& aContentName,
- OsclAny* aData,
- uint32 aDataSize,
- int32 aTimeoutMsec,
- OsclAny* aContextData);
- /**
- * get license
- *
- * @param aSessionId the assigned plugin session ID to use for this request
- * @param aContentName Null terminated unicode string containing the content name
- * @param aData buffer to store license
- * @param aDataSize the length of license
- * @param aTimeoutMsec the timeout for get license
- * @param aContextData
- *
- * @returns a unique command id for asynchronous completion
- **/
- PVMFCommandId GetLicense(PVMFSessionId aSessionId,
- OSCL_String& aContentName,
- OsclAny* aData,
- uint32 aDataSize,
- int32 aTimeoutMsec,
- OsclAny* aContextData);
-
- /**
- * Method to cancel GetLicense requests.
- *
- * @param [in] The assigned plugin session ID to use for this request
- * @param aContext [in] Optional opaque data that will be passed back to
- * the user with the command response
- *
- * @returns A unique command id for asynchronous completion.
- */
- PVMFCommandId CancelGetLicense(PVMFSessionId aSessionId,
- PVMFCommandId aCmdId,
- OsclAny* aContext = NULL);
-
- /////////////////////////////* From PVMFCPMPluginAccessInterfaceFactory */
- /**
- * ask for all supported access interface UUIDs
- *
- * @param aUuids a vector to hold the all supported uuids
- *
- * @returns PVMFSuccess success
- * PVMFFailure failure
- **/
- PVMFStatus QueryAccessInterfaceUUIDs(Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids);
-
- /**
- * create a access interface
- *
- * @param aUuid UUID of the interface to be created
- *
- * @returns the interface pointer on successful creation, NULL otherwise
- **/
- PVInterface* CreatePVMFCPMPluginAccessInterface(PVUuid& aUuid);
-
- /**
- * destroy a access interface
- *
- * @param aUuid UUID of the interface to be destroyed
- * @param aPtr ptr to the interface
- *
- * @returns none
- **/
- void DestroyPVMFCPMPluginAccessInterface(PVUuid& aUuid,PVInterface* aPtr);
-
- /////////////////////////////* From PVMFMetadataExtensionInterface
- /**
- * Synchronous method to return the number of metadata keys for the specified query key string
- *
- * @param aQueryKeyString A NULL terminated character string specifying a subset of metadata keys to count.
- * If the string is NULL, total number of all keys will be returned
- *
- * @returns The number of metadata keys
- **/
- uint32 GetNumMetadataKeys(char* aQueryKeyString = NULL);
-
- /**
- * Synchronous method to return the number of metadata values for the specified list of key strings
- *
- * @param aKeyList A reference to a metadata key list to specifying the values of interest to count
- *
- * @returns The number of metadata values based on the provided key list
- **/
- uint32 GetNumMetadataValues(PVMFMetadataList& aKeyList);
-
- /**
- * Asynchronous method to retrieve a list of metadata keys. The subset of all available keys in the node can
- * be specified by providing a combination of query key string, starting index, and maximum number of keys to retrieve
- *
- * @param aSessionId The assigned node session ID to use for this request
- * @param aKeyList A reference to a metadata key list to add the metadata keys
- * @param aStartingKeyIndex Index into the node's total key list that corresponds to the first key entry to retrieve
- * @param aMaxKeyEntries The maximum number of key entries to add to aKeyList. If there is no maximum, set to -1.
- * @param aQueryKeyString Optional NULL terminated character string to select a subset of keys
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns A unique command ID for asynchronous completion
- **/
- PVMFCommandId GetNodeMetadataKeys( PVMFSessionId aSessionId,
- PVMFMetadataList& aKeyList,
- uint32 aStartingKeyIndex,
- int32 aMaxKeyEntries,
- char* aQueryKeyString = NULL,
- const OsclAny* aContextData = NULL);
-
- /**
- * Asynchronous method to retrieve a list of metadata values. The subset of all available values in the node can
- * be specified by providing a combination of key list, starting index, and maximum number of values to retrieve
- *
- * @param aSessionId The assigned node session ID to use for this request
- * @param aKeyList A reference to a metadata key list specifying the metadata values to retrieve
- * @param aValueList A reference to a metadata value list to add the metadata values
- * @param aStartingValueIndex Index into the node's value list specified by the key list that corresponds to the first value entry to retrieve
- * @param aMaxValueEntries The maximum number of value entries to add to aValueList. If there is no maximum, set to -1.
- * @param aContext Optional opaque data to be passed back to user with the command response
- *
- * @returns A unique command ID for asynchronous completion
- **/
- PVMFCommandId GetNodeMetadataValues( PVMFSessionId aSessionId,
- PVMFMetadataList& aKeyList,
- Oscl_Vector<PvmiKvp,OsclMemAllocator>& aValueList,
- uint32 aStartingValueIndex,
- int32 aMaxValueEntries,
- const OsclAny* aContextData = NULL);
-
- /**
- * Synchronous method to free up the specified range of metadata keys in the list. It is assumed that caller of this function
- * knows that start and end indices should correspond to metadata keys returned by this particular instance of the
- * metadata extension interface using GetNodeMetadataKeys().
- *
- * @param aKeyList A reference to a metadata key list to free the key entries
- * @param aStartingKeyIndex Index into aKeyList that corresponds to the first key entry to release
- * @param aEndKeyIndex Index into aKeyList that corresponds to the last key entry to release
- *
- * @returns PVMFSuccess if the release of specified keys succeeded.
- * PVMFErrArgument if indices are invalid or the list is empty.
- * PVMFFailure otherwise.
- **/
- PVMFStatus ReleaseNodeMetadataKeys( PVMFMetadataList& aKeyList,
- uint32 aStartingKeyIndex,
- uint32 aEndKeyIndex);
-
- /**
- * Synchronous method to free up the specified range of metadata values in the list. It is assumed that caller of this function
- * knows that start and end indices should correspond to metadata values returned by this particular instance of the
- * metadata extension interface using GetNodeMetadataValues().
- *
- * @param aValueList A reference to a metadata value list to free the value entries
- * @param aStartingValueIndex Index into aValueList that corresponds to the first value entry to release
- * @param aEndValueIndex Index into aValueList that corresponds to the last value entry to release
- *
- * @returns PVMFSuccess if the release of specified values succeeded. PVMFErrArgument if indices are invalid or the list is empty.
- * PVMFFailure otherwise.
- **/
- PVMFStatus ReleaseNodeMetadataValues( Oscl_Vector<PvmiKvp,OsclMemAllocator>& aValueList,
- uint32 aStartingValueIndex,
- uint32 aEndValueIndex);
-PRIVATE:
- /* From PVMFCPMPluginInterface */
- void ThreadLogon();
- void ThreadLogoff();
-
- PVMFCPMKmjPlugInOMA1(int32 aPriority = OsclActiveObject::EPriorityNominal);
- virtual ~PVMFCPMKmjPlugInOMA1();
- void Run();
-
- PVMFCommandId QueueCommandL(PVMFCPMKmjPlugInOMA1Command&);
- void MoveCmdToCurrentQueue(PVMFCPMKmjPlugInOMA1Command& aCmd);
- bool ProcessCommand(PVMFCPMKmjPlugInOMA1Command&);
- void CommandComplete( PVMFCPMKmjPlugInOMA1CmdQ&,
- PVMFCPMKmjPlugInOMA1Command&,
- PVMFStatus,
- OsclAny* aData = NULL,
- PVUuid* aEventUUID = NULL,
- int32* aEventCode = NULL);
-
- void DoQueryUuid(PVMFCPMKmjPlugInOMA1Command&);
- void DoQueryInterface(PVMFCPMKmjPlugInOMA1Command&);
- void DoInit(PVMFCPMKmjPlugInOMA1Command&);
- void DoReset(PVMFCPMKmjPlugInOMA1Command&);
- void DoAuthenticate(PVMFCPMKmjPlugInOMA1Command&);
- void DoAuthorizeUsage(PVMFCPMKmjPlugInOMA1Command&);
- void DoUsageComplete(PVMFCPMKmjPlugInOMA1Command& aCmd);
- bool queryInterface(const PVUuid& uuid, PVInterface*& iface);
-
- int32_t GetMimeType(char* drmFileName);
-
- // for get license
- void ParseUrl(char* rightsUrl);
- bool getIpAddrByName(OSCL_HeapString<OsclMemAllocator> hostName);
- void DoGetLicense(PVMFCPMKmjPlugInOMA1Command& aCmd,bool aWideCharVersion = false);
- void DoCancelGetLicense(PVMFCPMKmjPlugInOMA1Command& aCmd);
-
- // For metadata extention interface
- void DoGetMetadataKeys(PVMFCPMKmjPlugInOMA1Command& aCmd);
- void DoGetMetadataValues(PVMFCPMKmjPlugInOMA1Command& aCmd);
- void GetAvailableKeys();
- char* GetIso8601Time(int32_t iDate, int32_t iTime);
- uint32_t GetDuration(int32_t iDay, int32_t iTime);
- bool IsQueryDataAvailable(OSCL_HeapString<OsclMemAllocator> queryData);
- int32_t IsStatelessLicense(void);
- uint8_t* GetLicenseType(void);
-
- // for get license
- static const uint32_t HTTP_DEFAULT_PORT = 80;
- static const uint32_t URL_MAX_LEN = 1024;
- static const uint32 BUFFER_DEFAULT_CACHE_SIZE = 4096;
- uint32_t urlIpAddr;
- int urlPort;
- OSCL_HeapString<OsclMemAllocator> urlHost;
- OSCL_HeapString<OsclMemAllocator> urlPath;
-
- PVMFCPMKmjPlugInOMA1CmdQ iInputCommands;
- PVMFCPMKmjPlugInOMA1CmdQ iCurrentCommand;
-
- uint32 iExtensionRefCount;
- Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> iAvailableMetadataKeys;
-
- // for set data source
- bool m_oSourceSet;
- int32_t m_drmSession;
- PVFile m_pvfile;
- DrmPluginDataAccess* m_dataAccessFile;
- OsclFileHandle* iFileHandle;
-
- /// the following is used for UT
- bool bRunUT;
- PVMFStatus cmdStatus;
-
- friend class PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl;
-};
-
-class PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl // : public PVMFCPMPluginLocalSyncAccessInterface
-{
-public:
- PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl(PVMFCPMKmjPlugInOMA1&c)
- : iContainer(c){ }
-
- virtual ~PVMFCPMKmjPlugInOMA1LocalSyncAccessInterfaceImpl(){ }
-
- /* From PVInterface */
- virtual void addRef() {};
- virtual void removeRef() {};
- virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface);
-
- /* From PVMFCPMPluginLocalSyncAccessInterface */
- void Init(void) {};
- void Reset(void) {};
-
- /**
- * Opens the registered content.
- * @return returns 0 if successful and a non-zero value otherwise
- */
- int32 OpenContent();
-
- /**
- * The File Read & Decrypt operation
- * Reads from the file into the buffer a maximum of 'numelements'
- * of size 'size'.
- *
- * @param buffer pointer to buffer of type void
- * @param size element size in bytes
- * @param numelements max number of elements to read
- * @return returns the number of full elements actually read, which
- * may be less than count if an error occurs or if the end
- * of the file is encountered before reaching count. Use the
- * CheckEndOfFile or GetError function to distinguish a read
- * error from an end-of-file condition.
- */
- uint32 ReadAndUnlockContent(OsclAny *buffer,uint32 size,uint32 numelements);
-
- /**
- * The File Seek operation
- * Sets the position for file pointer
- * @param offset offset from the specified origin.
- * @param origin starting point
- * @return returns 0 on success, and a non-zero value otherwise
- */
- int32 SeekContent(int32 offset, Oscl_File::seek_type origin);
-
- /**
- * The File Tell operation
- * Returns the current file position for file specified by fp
- */
- int32 GetCurrentContentPosition();
-
- /**
- * The File Size operation
- * Returns the file size
- */
- int32 GetContentSize();
-
- /**
- * The File Close operation
- * Closes the file after flushing any remaining data in the buffers.
- * @return returns 0 if successful, and a non-zero value otherwise
- */
- int32 CloseContent();
-
- /**
- * The File Flush operation
- * On an output stream OSCL_FileFlush causes any buffered
- * but unwritten data to be written to the file.
- * @return returns 0 if successful, and a non-zero value otherwise
- */
- int32 Flush();
-
- /**
- * The File Error operation
- * @return If no error has occurred on stream, returns 0.
- * Otherwise,it returns a nonzero value
- */
- int32 GetContentAccessError();
-
- /**
- * Determines if the content is drm protected or not.
- * @param aProtected set to true if protected, false otherwise.
- * Value undefined in case of error
- * @return returns PVMFSuccess if successful and an appropriate errcode
- * otherwise
- */
- PVMFStatus IsContentProtected(bool& aProtected)
- {
- aProtected = true;
- return PVMFSuccess;
- }
-
-PRIVATE:
- PVMFCPMKmjPlugInOMA1& iContainer;
- uint32 filePos;
-};
-
-#endif
-
-
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_data_access.cpp b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_data_access.cpp
deleted file mode 100644
index c7623c8..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_data_access.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#include "oscl_base.h"
-#include "oscl_types.h"
-#include "pvfile.h"
-#include "oscl_file_io.h"
-#include "pvmf_cpmplugin_kmj_oma1_data_access.h"
-
-int32_t DrmPluginDataAccess::GetDataLen()
-{
- if(ACCESS_FILE == accessMode)
- {
- pvfile->Seek(0,Oscl_File::SEEKEND);
-
- int32_t dataLen = pvfile->Tell();
- if(-1 == dataLen) // get content len failed
- {
- pvfile->Close();
- return -1;
- }
-
- pvfile->Seek(0,Oscl_File::SEEKSET);
- return dataLen;
- }
- else if(ACCESS_BUFFER == accessMode)
- {
- return dataLen;
- }
- else
- {
- return -1;
- }
-}
-
-int32_t DrmPluginDataAccess::SeekData(int32_t offset)
-{
- if(ACCESS_FILE == accessMode)
- {
- return pvfile->Seek(offset,Oscl_File::SEEKSET);
- }
- else if(ACCESS_BUFFER == accessMode)
- {
- if(offset < 0)
- {
- return -1;
- }
-
- if((offset > dataLen) || (dataPos - dataBuf) + offset > dataLen)
- {
- dataPos = dataBuf + dataLen;
- }
-
- dataPos = dataBuf + offset;
- return 0;
- }
- else
- {
- return -1;
- }
-}
-
-int32_t DrmPluginDataAccess::ReadData(uint8_t* buf,int32_t bufLen)
-{
- if(ACCESS_FILE == accessMode)
- {
- return pvfile->Read(buf,sizeof(uint8_t),bufLen);
- }
- else if(ACCESS_BUFFER == accessMode)
- {
- if((dataPos - dataBuf) >= dataLen)
- {
- return 0;
- }
-
- int32_t readDataLen;
-
- if(((dataPos - dataBuf) + bufLen) <= dataLen)
- {
- readDataLen = bufLen;
- }
- else
- {
- readDataLen = dataLen - (dataPos - dataBuf);
- }
-
- memcpy(buf,dataPos,readDataLen);
-
- return readDataLen;
- }
- else
- {
- return 0;
- }
-}
-
-int32_t DrmPluginGetDataLen(int32_t dataHandle)
-{
- DrmPluginDataAccess* dataAccess = (DrmPluginDataAccess*)dataHandle;
- return dataAccess->GetDataLen();
-}
-
-int32_t DrmPluginSeekData( int32_t dataHandle,int32_t dataOffset)
-{
- DrmPluginDataAccess* dataAccess = (DrmPluginDataAccess*)dataHandle;
- return dataAccess->SeekData(dataOffset);
-}
-
-int32_t DrmPluginReadData( int32_t dataHandle,uint8_t* buf,int32_t bufLen)
-{
- DrmPluginDataAccess* dataAccess = (DrmPluginDataAccess*)dataHandle;
- return dataAccess->ReadData(buf,bufLen);
-}
-
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_data_access.h b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_data_access.h
deleted file mode 100644
index b03880f..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_data_access.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2007 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 PVMF_CPMPLUGIN_KMJ_OMA1_DATA_ACCESS_H
-#define PVMF_CPMPLUGIN_KMJ_OMA1_DATA_ACCESS_H
-
-class DrmPluginDataAccess
-{
-public:
- typedef enum
- {
- ACCESS_FILE, // access data through file
- ACCESS_BUFFER // access data through buffer
- }DataAccessMode;
-
- /**
- * Get the data size in bytes.
- *
- * @return - The size of the data, or -1 on error.
- */
- int32_t GetDataLen();
-
- /**
- * The data Seek operation
- * Sets the position for data access
- *
- * @param offset offset from the start
- *
- * @return returns 0 on success, or -1 on error.
- */
- int32_t SeekData(int32_t offset);
-
- /**
- * The data Read operation
- *
- * @param buf pointer to buffer to store read data
- * @param bufLen dat size in bytes need to read
- *
- * @return returns the number of actually read, or <= 0 on error
- */
- int32_t ReadData(uint8_t* buf,int32_t bufLen);
-
- // constuctor
- DrmPluginDataAccess( PVFile* dataFile,
- DataAccessMode mode = ACCESS_FILE,
- char* buf = NULL,
- int len = 0)
- : pvfile(dataFile),
- accessMode(mode),
- dataBuf(buf),
- dataLen(len),
- dataPos(buf)
- {}
-
-private:
- // access data mode, now support file and buffer
- DataAccessMode accessMode;
-
- // access data from file
- PVFile* pvfile;
-
- // access data from buffer
- char* dataBuf;
- int dataLen;
- char* dataPos;
-};
-
-/**
- * Get the data size in bytes.
- *
- * @param dataHandle the data handle from which get data len
- *
- * @return - The size of the data, or -1 on error.
- */
-extern int32_t DrmPluginGetDataLen(int32_t dataHandle);
-
-/**
- * The data Seek operation
- * Sets the position for data access
- *
- * @param dataHandle the data handle from which seek data
- * @param offset offset from the start
- *
- * @return returns 0 on success, or -1 on error.
- */
-extern int32_t DrmPluginSeekData( int32_t dataHandle,int32_t dataOffset);
-
-/**
- * The data Read operation
- *
- * @param dataHandle the data handle from which read data
- * @param buf pointer to buffer to store read data
- * @param bufLen dat size in bytes need to read
- *
- * @return returns the number of actually read, or <= 0 on error
- */
-extern int32_t DrmPluginReadData( int32_t dataHandle,uint8_t* buf,int32_t bufLen);
-
-#endif
-
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_factory.cpp b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_factory.cpp
deleted file mode 100644
index 8b8969c..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_factory.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-#include "pvmf_cpmplugin_kmj_oma1.h"
-#include "pvmf_cpmplugin_kmj_oma1_factory.h"
-
-PVMFCPMPluginInterface* PVMFOma1KmjPluginFactory::CreateCPMPlugin()
-{
- return PVMFCPMKmjPlugInOMA1::CreatePlugIn();
-}
-
-void PVMFOma1KmjPluginFactory::DestroyCPMPlugin(PVMFCPMPluginInterface* aPlugIn)
-{
- PVMFCPMKmjPlugInOMA1::DestroyPlugIn(aPlugIn);
-}
-
-
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_factory.h b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_factory.h
deleted file mode 100644
index 9be4f2e..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_factory.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 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 PVMF_CPMPLUGIN_KMJ_OMA1_FACTORY_H_
-#define PVMF_CPMPLUGIN_KMJ_OMA1_FACTORY_H_
-
-#include "pvmf_cpmplugin_interface.h"
-
-//Oma1 KMJ plugin factory
-class PVMFOma1KmjPluginFactory :public PVMFCPMPluginFactory
-{
-public:
- /**
- * create KMJ plugin
- * \param none
- * \return <ul>
- * <li> this plugin created
- * </ul>
- */
- PVMFCPMPluginInterface* CreateCPMPlugin();
-
- /**
- * destroy KMJ plugin
- * \param PVMFCPMPluginInterface the plugin to be destroied
- * \return <ul>
- * <li> none
- * </ul>
- */
- void DestroyCPMPlugin(PVMFCPMPluginInterface* aPlugIn);
-};
-
-#endif
-
diff --git a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_types.h b/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_types.h
deleted file mode 100644
index 3a7c960..0000000
--- a/android/drm/oma1/src/pvmf_cpmplugin_kmj_oma1_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2007 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 PVMF_CPMPLUGIN_KMJ_OMA1_TYPES_H_
-#define PVMF_CPMPLUGIN_KMJ_OMA1_TYPES_H_
-
-/** Mime type for KMJ plugin */
-#define PVMF_CPM_MIME_KMJ_OMA1 "X-CPM-PLUGIN/PV-DRM-KMJ-OMA1"
-
-#ifdef KMJ_PLUGIN_UT
- #define PROTECTED public
- #define PRIVATE public
-#else
- #define PROTECTED protected
- #define PRIVATE private
-#endif
-
-#endif
diff --git a/android/drm/oma1/src/pvoma1_kmj_recognizer.cpp b/android/drm/oma1/src/pvoma1_kmj_recognizer.cpp
deleted file mode 100644
index f08e525..0000000
--- a/android/drm/oma1/src/pvoma1_kmj_recognizer.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-#include "pvoma1_kmj_recognizer.h"
-#include "pv_mime_string_utils.h"
-#include "pvfile.h"
-#include "oscl_file_io.h"
-#include "objmng/svc_drm.h"
-#include "log.h"
-#include "pvmf_cpmplugin_kmj_oma1_data_access.h"
-
-PVMFStatus PVOMA1KMJRecognizerPlugin::Recognize( PVMFDataStreamFactory& aSourceDataStreamFactory,
- PVMFRecognizerMIMEStringList* aFormatHint,
- Oscl_Vector<PVMFRecognizerResult,OsclMemAllocator>& aRecognizerResult
- )
-{
- Oscl_FileServer fileServ;
- PVFile pvfile;
-
- // set data stream
- pvfile.SetCPM(&aSourceDataStreamFactory);
-
- // open data stream
- int32 ret = pvfile.Open( NULL,Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,fileServ);
- if(ret) // open data stream failed
- {
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize pvfile.Open failed");
- return PVMFFailure;
- }
-
- DrmPluginDataAccess dataAccess(&pvfile);
-
- T_DRM_Input_Data drmInputData =
- {
- (int32_t)&dataAccess,
- TYPE_DRM_UNKNOWN,
- DrmPluginGetDataLen,
- DrmPluginReadData,
- DrmPluginSeekData
- };
-
- int32_t session = SVC_drm_openSession(drmInputData);
-
- if((DRM_MEDIA_DATA_INVALID == session) || (DRM_FAILURE == session))
- {
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize SVC_drm_openSession failed");
- pvfile.Close();
- return PVMFFailure;
- }
-
- char mediaType[CONTENT_TYPE_LEN] = {0};
- ret = SVC_drm_getContentType(session,(uint8_t*)mediaType);
-
- SVC_drm_closeSession(session);
- pvfile.Close();
-
- if(DRM_SUCCESS != ret) // get DRM content type failed
- {
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize SVC_drm_getTypeDirectly failed");
- return PVMFFailure;
- }
-
- // save content type for use by outer
- PVMFRecognizerResult result;
-
- RecognizeContentType(mediaType,result.iRecognizedFormat);
- result.iRecognitionConfidence = PVMFRecognizerConfidenceCertain;
- aRecognizerResult.push_back(result);
-
- return PVMFSuccess;
-}
-
-
-PVMFStatus PVOMA1KMJRecognizerPlugin::SupportedFormats(PVMFRecognizerMIMEStringList& aSupportedFormatsList)
-{
- // do nothing
- return PVMFSuccess;
-}
-
-PVMFStatus PVOMA1KMJRecognizerPlugin::GetRequiredMinBytesForRecognition(uint32& aBytes)
-{
- // do nothing
- return PVMFSuccess;
-}
-
-void PVOMA1KMJRecognizerPlugin::RecognizeContentType(char* mediaType, OSCL_HeapString<OsclMemAllocator>& aRecognizedFormat)
-{
- if (0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_VIDEO_MP4)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_MP4)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_VIDEO_3GPP2)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_VIDEO_3GPP)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_3GPP2)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_3GPP))
- {
- aRecognizedFormat = PVMF_MIME_MPEG4FF;
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize MP4");
- }
- else if (0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_MP3)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_MPEG)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_MPA))
- {
- aRecognizedFormat = PVMF_MIME_MP3FF;
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize MP3");
- }
- else if(0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_AMR)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_AMR_WB)
- || 0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_ARM_WBPLUS))
- {
- aRecognizedFormat = PVMF_MIME_AMRFF;
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize AMR");
- }
- else if(0 == oscl_CIstrcmp( mediaType,PVMF_OMA_RECOGNIZER_AUDIO_MPEG4_GENERIC))
- {
- aRecognizedFormat = PVMF_MIME_AACFF;
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize AAC");
- }
- else
- {
- aRecognizedFormat = PVMF_MIME_FORMAT_UNKNOWN;
- LOGD("PVOMA1KMJRecognizerPlugin:Recognize unknown");
- }
-}
-
diff --git a/android/drm/oma1/src/pvoma1_kmj_recognizer.h b/android/drm/oma1/src/pvoma1_kmj_recognizer.h
deleted file mode 100644
index 95efe50..0000000
--- a/android/drm/oma1/src/pvoma1_kmj_recognizer.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2007 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 PVOMA1FFREC_PLUGIN_H_INCLUDED
-#define PVOMA1FFREC_PLUGIN_H_INCLUDED
-
-#include "pvmf_cpmplugin_kmj_oma1_types.h"
-#include "pvmf_recognizer_plugin.h"
-
-#define CONTENT_TYPE_LEN 64
-
-#define PVMF_OMA_RECOGNIZER_AUDIO_3GPP "audio/3gpp"
-#define PVMF_OMA_RECOGNIZER_AUDIO_3GPP2 "audio/3gpp2"
-#define PVMF_OMA_RECOGNIZER_VIDEO_3GPP "video/3gpp"
-#define PVMF_OMA_RECOGNIZER_VIDEO_3GPP2 "video/3gpp2"
-#define PVMF_OMA_RECOGNIZER_AUDIO_MP4 "audio/mp4"
-#define PVMF_OMA_RECOGNIZER_VIDEO_MP4 "video/mp4"
-
-#define PVMF_OMA_RECOGNIZER_AUDIO_AMR "audio/AMR"
-#define PVMF_OMA_RECOGNIZER_AUDIO_AMR_WB "audio/AMR-WB"
-#define PVMF_OMA_RECOGNIZER_AUDIO_ARM_WBPLUS "audio/amr-wb+"
-
-#define PVMF_OMA_RECOGNIZER_AUDIO_MPEG "audio/mpeg"
-#define PVMF_OMA_RECOGNIZER_AUDIO_MPA "audio/MPA"
-#define PVMF_OMA_RECOGNIZER_AUDIO_MP3 "audio/mp3"
-
-#define PVMF_OMA_RECOGNIZER_AUDIO_MPEG4_GENERIC "audio/mpeg4-generic"
-
-class PVOMA1KMJRecognizerPlugin : public PVMFRecognizerPluginInterface
-{
-public:
- PVOMA1KMJRecognizerPlugin()
- {
- };
-
- ~PVOMA1KMJRecognizerPlugin()
- {
- };
-
- PVMFStatus SupportedFormats(PVMFRecognizerMIMEStringList& aSupportedFormatsList);
- PVMFStatus Recognize(PVMFDataStreamFactory& aSourceDataStreamFactory,
- PVMFRecognizerMIMEStringList* aFormatHint,
- Oscl_Vector<PVMFRecognizerResult, OsclMemAllocator>& aRecognizerResult);
- PVMFStatus GetRequiredMinBytesForRecognition(uint32& aBytes);
-
-PRIVATE:
- void RecognizeContentType(char* mediaType, OSCL_HeapString<OsclMemAllocator>& aRecognizedFormat);
-};
-
-#endif
diff --git a/android/drm/oma1/test/Android.mk b/android/drm/oma1/test/Android.mk
deleted file mode 100644
index ac00cb1..0000000
--- a/android/drm/oma1/test/Android.mk
+++ /dev/null
@@ -1,141 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_DRM_CFLAG = -DKMJ_PLUGIN_UT
-
-ifeq ($(TARGET_ARCH), arm)
-LOCAL_DRM_1_PLUGIN_CFLAG = -DDRM_1_PLUGIN_ARCH_ARM
-endif
-
-ifeq ($(TARGET_ARCH), x86)
-LOCAL_DRM_1_PLUGIN_CFLAG = -DDRM_1_PLUGIN_ARCH_X86
-endif
-
-LOCAL_SRC_FILES := \
- test_pv_drm_plugin.cpp \
- test_pv_drm_plugin_ut.cpp \
- test_pv_player_engine_main.cpp \
- test_pv_player_engine_testset_mio_file.cpp
-
-LOCAL_MODULE := pv_drm_plugin_test
-
-LOCAL_STATIC_LIBRARIES := \
- libpvplayer_engine \
- libpvfileoutputnode \
- libpvpvxparser \
- libpvasfffparsernode \
- libpvmp3ffparsernode \
- libpvwmadecnode \
- libmp3decnode \
- libpvdownloadmanagernode \
- libpvmp4ffparsernode \
- libcpm \
- libpassthru_oma1 \
- libpvaacffparsernode \
- libpvmp3ff \
- libpvasfff \
- libpvmp4ff \
- libpvaacparser \
- libgetactualaacconfig \
- libpvmp3 \
- libwmadecoder \
- libpvwavffparsernode \
- libpvwav \
- libpvomxvideodecnode \
- libpv_video_config_parser \
- libm4v_config \
- libpvlogger \
- libpvvideodecnode \
- libpvavcdecnode \
- libpvwmvdecnode \
- libgsmamrdecnode \
- libaacdecnode \
- libpvstreamingmanagernode_3gpp \
- libpvjitterbuffernode \
- libpvmediaplayernode \
- librtprtcp \
- libpvrtsp_cli_eng_node_3gpp \
- libprotocolenginenode \
- libpv_http_parcom \
- libpvsocketnode \
- librtppayloadparser_3gpp \
- libpvmf \
- libpvsdpparser \
- libpv_rtsp_parcom \
- libomx_common_lib \
- libomx_avc_component_lib \
- libpvavcdecoder \
- libpv_avc_common_lib \
- libomx_m4v_component_lib \
- libpvcrypto \
- libomx_m4v_component_lib \
- libpvmp4decoder \
- libpvdecoder_gsmamr \
- libpv_amr_nb_common_lib \
- libpvamrwbdecoder \
- libpv_aac_dec \
- libfile_mediaio \
- libpvgendatastruct \
- libpvmimeutils \
- libpvmediaoutputnode \
- libpvmediadatastruct \
- libpvamrffparsernode \
- libpvgsmamrparser \
- libpvlatmpayloadparser \
- libpvmfrecognizer \
- libpvamrffrecognizer \
- libpvmp3ffrecognizer \
- libpvasfffrecognizer \
- libpvmp4ffrecognizer \
- libpvwavffrecognizer \
- libpvoma1ffrecognizer \
- libpvfileparserutils \
- libpvid3parcom \
- libpvdbmanager \
- libpvwmdrm \
- libcsprng \
- libpvcrypto \
- libpventropysrc \
- libosclregcli \
- libosclregserv \
- libosclio \
- libosclproc \
- libosclutil \
- libosclmemory \
- libosclerror \
- libosclbase \
- libpvomx_proxy_lib \
- libomx_wmv_component_interface \
- libomx_queue_lib \
- libthreadsafe_callback_ao \
- liboscllib \
- libunit_test \
- libkmj_oma1
-
-LOCAL_SHARED_LIBRARIES := libdrm1
-
-LOCAL_C_INCLUDES := $(PV_INCLUDES) \
- $(PV_TOP)/engines/common/include \
- $(PV_TOP)/pvmi/media_io/pvmiofileoutput/include \
- $(PV_TOP)/nodes/pvmediaoutputnode/include \
- $(PV_TOP)/engines/player/include \
- $(PV_TOP)/nodes/common/include \
- $(PV_TOP)/engines/player/src \
- $(PV_TOP)/engines/player/test/config/android \
- $(PV_TOP)/android/drm/oma1/test \
- $(PV_TOP)/oscl/unit_test/src \
- libs/drm/mobile1/include
-
-LOCAL_CFLAGS := $(PV_CFLAGS)
-
-LOCAL_COPY_HEADERS_TO := $(PV_COPY_HEADERS_TO)
-LOCAL_COPY_HEADERS := \
-
-ifeq ($(TARGET_ARCH), x86)
-LOCAL_LDLIBS += -lpthread
-endif
-
-LOCAL_CFLAGS += $(LOCAL_DRM_CFLAG)
-LOCAL_CFLAGS += $(LOCAL_DRM_1_PLUGIN_CFLAG)
-
-include $(BUILD_EXECUTABLE)
diff --git a/android/drm/oma1/test/test_pv_drm_plugin.cpp b/android/drm/oma1/test/test_pv_drm_plugin.cpp
deleted file mode 100644
index 6294268..0000000
--- a/android/drm/oma1/test/test_pv_drm_plugin.cpp
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#include "test_pv_drm_plugin.h"
-#include "oscl_error_codes.h"
-#include "oscl_tickcount.h"
-#include "pv_player_datasinkpvmfnode.h"
-#include "pvmi_media_io_fileoutput.h"
-#include "pv_media_output_node_factory.h"
-#include "oscl_utf8conv.h"
-#include "pvmi_kvp.h"
-#include "pvmi_kvp_util.h"
-#include "pvmf_timestamp.h"
-#include "pvmf_track_level_info_extension.h"
-#include "pvmf_errorinfomessage_extension.h"
-#include "pvmi_config_and_capability.h"
-#include "pvmf_local_data_source.h"
-#include "pvmf_cpmplugin_kmj_oma1_factory.h"
-#include "pvmf_cpmplugin_kmj_oma1_types.h"
-#include "pvmi_media_io_fileoutput.h"
-#include "pv_media_output_node_factory.h"
-#include "pv_player_engine.h"
-#include "pvmf_cpmplugin_kmj_oma1.h"
-#include "pvmi_drm_kvp.h"
-
-//
-// pvplayer_async_test_drmcpmplugin section
-//
-void pvplayer_async_test_drmcpmplugin::StartTest()
-{
- AddToScheduler();
- iState = STATE_CREATE;
- RunIfNotReady();
- aLicenseData = NULL;
- bDoGetLicenseProc = false;
- bForceDownloadRights = false;
-
- if (DRM_DOWNLOAD_RIGHTS_AND_PLAY == iUseMethod)
- {
- bForceDownloadRights = true;
- }
-}
-
-
-void pvplayer_async_test_drmcpmplugin::Run()
-{
- int error = 0;
-
- switch(iState)
- {
- case STATE_CREATE:
- {
- iPlayer = NULL;
-
- OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this));
- if (error)
- {
- PVPATB_TEST_IS_TRUE(false);
- iObserver->TestCompleted(*iTestCase);
- break;
- }
- else
- {
- if(PVMFSuccess != PVMFRecognizerRegistry::Init())
- {
- PVPATB_TEST_IS_TRUE(false);
- iObserver->TestCompleted(*iTestCase);
- }
- else
- {
- // Create recognizer plug-in factories
- iRecognizePluginFactory =
- (PVMFRecognizerPluginFactory*)OSCL_NEW(PVMFRecognizerPluginFactoryBasic<PVOMA1KMJRecognizerPlugin>, ());
-
- if(!iRecognizePluginFactory)
- {
- PVPATB_TEST_IS_TRUE(false);
- iObserver->TestCompleted(*iTestCase);
- break;
- }
-
- // Register recognizer plug-in factories
- if ((PVMFSuccess != PVMFRecognizerRegistry::RegisterPlugin(*iRecognizePluginFactory)))
- {
- PVPATB_TEST_IS_TRUE(false);
- iObserver->TestCompleted(*iTestCase);
- break;
- }
-
- //Connect to plugin registry
- PVMFStatus status = iPluginRegistryClient.Connect();
- if(status != PVMFSuccess)
- {
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- break;
- }
-
- //Create kmj plugin factory.
- iPluginFactory = new PVMFOma1KmjPluginFactory();
- if(!iPluginFactory)
- {
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- break;
- }
-
- //Register kmj plugin factory.
- iPluginMimeType = PVMF_CPM_MIME_KMJ_OMA1;
- if(iPluginRegistryClient.RegisterPlugin(iPluginMimeType,*iPluginFactory) != PVMFSuccess)
- {
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- break;
- }
-
- iState=STATE_ADDDATASOURCE;
- RunIfNotReady();
- }
- }
- }
- break;
-
- case STATE_ADDDATASOURCE:
- {
- iDataSource = new PVPlayerDataSourceURL;
- oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName),output,512);
- wFileName.set(output,oscl_strlen(output));
- iDataSource->SetDataSourceURL(wFileName);
- iDataSource->SetDataSourceFormatType(iFileType);
-
- //Create a data source
- iLocalDataSource = new PVMFLocalDataSource();
- iDataSource->SetDataSourceContextData((OsclAny*)iLocalDataSource);
-
- //Add the data source
- OSCL_TRY( error,
- iCurrentCmdId = iPlayer->AddDataSource( *iDataSource,
- (OsclAny*)&iContextObject)
- );
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
-
- if(DRM_NEW_CD == iUseMethod)
- {
- if(iFileServer.Connect())
- {
- return ;
- }
-
- iFileObject = OSCL_NEW(Oscl_File,(4096,iFileHandle));
- if (iFileObject == NULL)
- {
- return ;
- }
-
- int32 ret = iFileObject->Open( iFileName,
- Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,
- iFileServer);
-
- if (ret)
- {
- OSCL_DELETE( iFileObject);
- iFileObject = NULL;
- return ;
- }
-
- int32_t mimeType = GetMimeType(iFileName);
-
- T_DRM_Input_Data drmInputData =
- {
- (int32_t)iFileObject,
- mimeType,
- DrmPluginSTGetFileDataLen,
- DrmPluginSTReadFileData,
- DrmPluginSTSeekFileData
- };
- T_DRM_Rights_Info rightsInfo;
-
- memset(&rightsInfo, 0, sizeof(T_DRM_Rights_Info));
- ret = SVC_drm_installRights(drmInputData, &rightsInfo);
-
- iFileObject->Close();
- OSCL_DELETE(iFileObject);
- iFileObject = NULL;
- iFileServer.Close();
-
- if( DRM_SUCCESS != ret)
- {
- return;
- }
- }
- }
- break;
-
- case STATE_INIT:
- {
- OSCL_TRY(error, iCurrentCmdId=iPlayer->Init((OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_ACQUIRELICENSE:
- {
- aLicenseData = OSCL_ARRAY_NEW(uint8_t,(1024));
-
- if(NULL == aLicenseData)
- {
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- }
- else
- {
- PVPlayerEngine* pEngine = OSCL_DYNAMIC_CAST(PVPlayerEngine*,iPlayer);
-
- if (pEngine)
- {
- OSCL_TRY(error, iCurrentCmdId=pEngine->AcquireLicense(aLicenseData,
- 1024,
- iFileName,
- 1000,
- (OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- }
- }
- }
- break;
-
- // Tests the Ability to get Metadata after the Init State
- case STATE_GETMETADATAKEYS1:
- {
- iKeyList.clear();
- OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iKeyList,0,-1,NULL,(OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
- }
- break;
-
- case STATE_GETMETADATAVALUES1:
- {
- iValueList.clear();
- iNumAvailableValues = 0;
- OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList,0,-1,iNumAvailableValues,iValueList,(OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
- }
- break;
-
- case STATE_ADDDATASINK_VIDEO:
- {
- OSCL_wHeapString<OsclMemAllocator> SinkFileName;
- SinkFileName=OUTPUTNAME_PREPEND_WSTRING;
- SinkFileName+=_STRLIT_WCHAR("test_player_cpmopenplaystop_");
- OSCL_wHeapString<OsclMemAllocator> inputfilename;
- RetrieveFilename(wFileName.get_str(), inputfilename);
- SinkFileName+=inputfilename;
- SinkFileName+=_STRLIT_WCHAR("_video.dat");
-
- iMIOFileOutVideo = PVPlayerTestMioFactory::CreateVideoOutput((OsclAny*)&SinkFileName);
- iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo);
- iDataSinkVideo = new PVPlayerDataSinkPVMFNode;
- ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo);
- ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkFormatType(PVMF_YUV420);
-
- OSCL_TRY( error,
- iCurrentCmdId = iPlayer->AddDataSink( *iDataSinkVideo,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_ADDDATASINK_AUDIO:
- {
- OSCL_wHeapString<OsclMemAllocator> SinkFileName;
- SinkFileName=OUTPUTNAME_PREPEND_WSTRING;
- SinkFileName+=_STRLIT_WCHAR("test_player_cpmopenplaystop_");
- OSCL_wHeapString<OsclMemAllocator> inputfilename;
- RetrieveFilename(wFileName.get_str(), inputfilename);
- SinkFileName+=inputfilename;
- SinkFileName+=_STRLIT_WCHAR("_audio.dat");
-
- iMIOFileOutAudio = PVPlayerTestMioFactory::CreateAudioOutput((OsclAny*)&SinkFileName);
- iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio);
- iDataSinkAudio = new PVPlayerDataSinkPVMFNode;
- ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio);
- ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkFormatType(AUDIOSINK_FORMAT_TYPE);
-
- OSCL_TRY( error,
- iCurrentCmdId = iPlayer->AddDataSink( *iDataSinkAudio,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_ADDDATASINK_TEXT:
- {
- OSCL_wHeapString<OsclMemAllocator> SinkFileName;
- SinkFileName=OUTPUTNAME_PREPEND_WSTRING;
- SinkFileName+=_STRLIT_WCHAR("test_player_cpmopenplaystop_");
- OSCL_wHeapString<OsclMemAllocator> inputfilename;
- RetrieveFilename(wFileName.get_str(), inputfilename);
- SinkFileName+=inputfilename;
- SinkFileName+=_STRLIT_WCHAR("_text.dat");
-
- iMIOFileOutText = PVPlayerTestMioFactory::CreateAudioOutput((OsclAny*)&SinkFileName);
- iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText);
- iDataSinkText = new PVPlayerDataSinkPVMFNode;
- ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText);
- ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkFormatType(PVMF_3GPP_TIMEDTEXT);
-
- OSCL_TRY( error,
- iCurrentCmdId=iPlayer->AddDataSink( *iDataSinkText,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_PREPARE:
- {
- OSCL_TRY(error, iCurrentCmdId=iPlayer->Prepare((OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_START:
- {
- OSCL_TRY(error, iCurrentCmdId=iPlayer->Start((OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_STOP:
- {
- OSCL_TRY(error, iCurrentCmdId=iPlayer->Stop((OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_REMOVEDATASINK_VIDEO:
- {
- OSCL_TRY( error,
- iCurrentCmdId=iPlayer->RemoveDataSink( *iDataSinkVideo,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_REMOVEDATASINK_AUDIO:
- {
- OSCL_TRY( error,
- iCurrentCmdId=iPlayer->RemoveDataSink( *iDataSinkAudio,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_REMOVEDATASINK_TEXT:
- {
- OSCL_TRY( error,
- iCurrentCmdId=iPlayer->RemoveDataSink( *iDataSinkText,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_RESET:
- {
- OSCL_TRY(error, iCurrentCmdId=iPlayer->Reset((OsclAny*)&iContextObject));
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_REMOVEDATASOURCE:
- {
- OSCL_TRY( error,
- iCurrentCmdId=iPlayer->RemoveDataSource( *iDataSource,
- (OsclAny*)&iContextObject)
- );
-
- OSCL_FIRST_CATCH_ANY( error,
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady()
- );
- }
- break;
-
- case STATE_WAIT_FOR_ERROR_HANDLING:
- {
- // Timed out waiting for error handling to complete
- PVPATB_TEST_IS_TRUE(false);
-
- // Forcibly terminate the test
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- }
- break;
-
- case STATE_CLEANUPANDCOMPLETE:
- {
- PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer));
- iPlayer=NULL;
-
- delete iDataSource;
- iDataSource=NULL;
-
- delete iDataSinkVideo;
- iDataSinkVideo = NULL;
-
- PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo);
- iIONodeVideo=NULL;
-
- PVPlayerTestMioFactory::DestroyVideoOutput(iMIOFileOutVideo);
- iMIOFileOutVideo=NULL;
-
- delete iDataSinkAudio;
- iDataSinkAudio=NULL;
-
- PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio);
- iIONodeAudio=NULL;
-
- PVPlayerTestMioFactory::DestroyAudioOutput(iMIOFileOutAudio);
- iMIOFileOutAudio=NULL;
-
- delete iDataSinkText;
- iDataSinkText=NULL;
-
- PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText);
- iIONodeText=NULL;
-
- PVPlayerTestMioFactory::DestroyTextOutput(iMIOFileOutText);
- iMIOFileOutText=NULL;
-
- //close and cleanup the CPM plugin registry.
- iPluginRegistryClient.Close();
-
- //delete the plugin factory.
- if(iPluginFactory)
- {
- delete iPluginFactory;
- iPluginFactory=NULL;
- }
-
- delete iLocalDataSource;
- iLocalDataSource=NULL;
-
- if(aLicenseData)
- {
- OSCL_ARRAY_DELETE(aLicenseData);
- aLicenseData = NULL;
- }
-
- if (bDoGetLicenseProc)
- {
- bDoGetLicenseProc = false;
- iState=STATE_CREATE;
- RunIfNotReady();
- }
- else
- {
- iObserver->TestCompleted(*iTestCase);
- }
-
- // Unregister the plug-ins
- PVMFRecognizerRegistry::RemovePlugin(*iRecognizePluginFactory);
-
- // Destroy the plug-in factory instances
- if (iRecognizePluginFactory)
- {
- OSCL_TEMPLATED_DELETE(((PVMFRecognizerPluginFactoryBasic<PVOMA1KMJRecognizerPlugin>*)iRecognizePluginFactory),
- PVMFRecognizerPluginFactoryBasic<PVOMA1KMJRecognizerPlugin>, PVMFRecognizerPluginFactoryBasic);
- iRecognizePluginFactory = NULL;
- }
-
- PVMFRecognizerRegistry::Cleanup();
- }
- break;
-
- default:
- break;
-
- }
-}
-
-void pvplayer_async_test_drmcpmplugin::CommandCompleted(const PVCmdResponse& aResponse)
-{
- if (aResponse.GetCmdId()!=iCurrentCmdId)
- {
- // Wrong command ID.
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- return;
- }
-
- if (aResponse.GetContext()!=NULL)
- {
- if (aResponse.GetContext()==(OsclAny*)&iContextObject)
- {
- if (iContextObject!=iContextObjectRefValue)
- {
- // Context data value was corrupted
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- return;
- }
- }
- else
- {
- // Context data pointer was corrupted
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- return;
- }
- }
-
- switch (iState)
- {
- case STATE_ADDDATASOURCE:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_INIT;
- RunIfNotReady();
- }
- else
- {
- // AddDataSource failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_INIT:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- if (bForceDownloadRights)
- {
- bForceDownloadRights = false;
- iState=STATE_ACQUIRELICENSE;
- }
- else
- {
- iState=STATE_GETMETADATAKEYS1;
-
- SavePureMediaForCompare();
- }
-
- RunIfNotReady();
- }
- else if (aResponse.GetCmdStatus()==PVMFErrLicenseRequired)
- {
- if (DRM_DOWNLOAD_RIGHTS_AND_PLAY == iUseMethod)
- {
- if(true == bForceDownloadRights)
- {
- bForceDownloadRights = false;
- iState=STATE_ACQUIRELICENSE;
- RunIfNotReady();
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- }
- else
- {
- // Init failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_ACQUIRELICENSE:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- SavePureMediaForCompare();
-
- if (bForceDownloadRights)
- {
- bForceDownloadRights = false;
- iState=STATE_GETMETADATAKEYS1;
- }
- else
- {
- bDoGetLicenseProc = true;
- iState=STATE_CLEANUPANDCOMPLETE;
- }
-
- RunIfNotReady();
- }
- else if (aResponse.GetCmdStatus()==PVMFErrResource)
- {
- // rights downloaded are error
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- else
- {
- // Acquire license failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_GETMETADATAKEYS1:
- if (aResponse.GetCmdStatus() == PVMFSuccess)
- {
- iState = STATE_GETMETADATAVALUES1;
- RunIfNotReady();
- }
- else
- {
- // GetMetadataKeys failed
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_GETMETADATAVALUES1:
- if (aResponse.GetCmdStatus() == PVMFSuccess)
- {
- /* save the media object data to a temp file for ST,
- and this file will be remove by ST script. */
- int count = iValueList.size();
-
- for (int i = 0; i < count; i++)
- {
- if (0 == strcmp(PVMF_DRM_INFO_ENVELOPE_DATA_VALUE, iValueList[i].key))
- {
- FILE *handle = fopen("/data/drm/drm1_core_files/tmp1.drm", "wb");
-
- if (NULL != handle)
- {
- if (iValueList[i].length > 0 && iValueList[i].value.pUint8_value != NULL)
- {
- fwrite(iValueList[i].value.pUint8_value, iValueList[i].length, 1, handle);
- }
-
- fclose(handle);
- }
- break;
- }
- }
-
- PVPATB_TEST_IS_TRUE(true);
- iState = STATE_ADDDATASINK_VIDEO;
- RunIfNotReady();
- break;
- }
- else
- {
- // GetMetadataValues failed
- PVPATB_TEST_IS_TRUE(false);
- iState = STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_ADDDATASINK_VIDEO:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_ADDDATASINK_AUDIO;
- RunIfNotReady();
- }
- else
- {
- // AddDataSink failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_ADDDATASINK_AUDIO:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_ADDDATASINK_TEXT;
- RunIfNotReady();
- }
- else
- {
- // AddDataSink failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_ADDDATASINK_TEXT:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_PREPARE;
- RunIfNotReady();
- }
- else
- {
- // AddDataSink failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_PREPARE:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_START;
- RunIfNotReady();
- }
- else
- {
- // Prepare failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_START:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_STOP;
- RunIfNotReady(5000000);
- }
- else
- {
- // Start failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_STOP:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_REMOVEDATASINK_VIDEO;
- RunIfNotReady();
- }
- else
- {
- // Stop failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_REMOVEDATASINK_VIDEO:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_REMOVEDATASINK_AUDIO;
- RunIfNotReady();
- }
- else
- {
- // RemoveDataSink failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_REMOVEDATASINK_AUDIO:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_REMOVEDATASINK_TEXT;
- RunIfNotReady();
- }
- else
- {
- // RemoveDataSink failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_REMOVEDATASINK_TEXT:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_RESET;
- RunIfNotReady();
- }
- else
- {
- // RemoveDataSink failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_RESET:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- iState=STATE_REMOVEDATASOURCE;
- RunIfNotReady();
- }
- else
- {
- // Reset failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
- }
- break;
-
- case STATE_REMOVEDATASOURCE:
- if (aResponse.GetCmdStatus()==PVMFSuccess)
- {
- PVPATB_TEST_IS_TRUE(true);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- }
- else
- {
- // RemoveDataSource failed
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- }
- break;
-
- default:
- {
- // Testing error if this is reached
- PVPATB_TEST_IS_TRUE(false);
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- }
- break;
- }
-}
-
-
-void pvplayer_async_test_drmcpmplugin::HandleErrorEvent(const PVAsyncErrorEvent& aEvent)
-{
- switch(aEvent.GetEventType())
- {
- case PVMFErrResourceConfiguration:
- // Just log the error
- PVPATB_TEST_IS_TRUE(false);
- break;
-
- case PVMFErrResource:
- // Just log the error
- PVPATB_TEST_IS_TRUE(false);
- break;
-
- case PVMFErrCorrupt:
- // Just log the error
- PVPATB_TEST_IS_TRUE(false);
- break;
-
- case PVMFErrProcessing:
- // Just log the error
- PVPATB_TEST_IS_TRUE(false);
- break;
-
- default:
- // Unknown error and just log the error
- PVPATB_TEST_IS_TRUE(false);
- break;
- }
-
- // Wait for engine to handle the error
- Cancel();
- iState=STATE_WAIT_FOR_ERROR_HANDLING;
- RunIfNotReady(3000000);
-}
-
-
-void pvplayer_async_test_drmcpmplugin::HandleInformationalEvent(
- const PVAsyncInformationalEvent& aEvent)
-{
- // Wait for error handling to complete
- if (iState==STATE_WAIT_FOR_ERROR_HANDLING
- && aEvent.GetEventType()==PVMFInfoErrorHandlingComplete)
- {
- PVPlayerState pstate;
- iPlayer->GetPVPlayerStateSync(pstate);
-
- switch(pstate)
- {
- case PVP_STATE_INITIALIZED:
- Cancel();
- iState=STATE_REMOVEDATASINK_VIDEO;
- RunIfNotReady();
- break;
-
- case PVP_STATE_IDLE:
- Cancel();
- iState=STATE_REMOVEDATASOURCE;
- RunIfNotReady();
- break;
-
- default:
- // Engine should not be in any other state when error handling completes
- PVPATB_TEST_IS_TRUE(false);
- Cancel();
- iState=STATE_CLEANUPANDCOMPLETE;
- RunIfNotReady();
- break;
- }
- }
-
- if (aEvent.GetEventType()==PVMFInfoPositionStatus)
- {
- PVInterface* iface=(PVInterface*)(aEvent.GetEventExtensionInterface());
- if(iface==NULL)
- {
- return;
- }
-
- PVUuid infomsguuid=PVMFErrorInfoMessageInterfaceUUID;
- PVMFErrorInfoMessageInterface* infomsgiface=NULL;
-
- if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface)==true)
- {
- int32 infocode;
- PVUuid infouuid;
- infomsgiface->GetCodeUUID(infocode, infouuid);
-
- if ((infouuid==PVPlayerErrorInfoEventTypesUUID)
- && (infocode==PVPlayerInfoPlaybackPositionStatus))
- {
- PVPPlaybackPosition aPos1;
- uint32 aPos2;
-
- aPos1.iPosUnit=PVPPBPOSUNIT_MILLISEC;
- iPlayer->GetCurrentPositionSync(aPos1);
-
- uint8* localbuf=aEvent.GetLocalBuffer();
-
- if (aEvent.GetLocalBufferSize()==8 && localbuf[0]==1)
- {
- oscl_memcpy(&aPos2, &localbuf[4], sizeof(uint32));
- }
- else
- {
- aPos2=0;
- }
- }
- }
- }
-}
-
-int32_t pvplayer_async_test_drmcpmplugin::GetMimeType(char* drmFileName)
-{
- if(!drmFileName)
- {
- return TYPE_DRM_UNKNOWN;
- }
-
- const char* extension = strrchr(drmFileName, '.');
-
- if(!extension)
- {
- return TYPE_DRM_UNKNOWN;
- }
-
- if (strcasecmp(extension, ".dm") == 0)
- {
- return TYPE_DRM_MESSAGE;
- }
- else if (strcasecmp(extension, ".dcf") == 0)
- {
- return TYPE_DRM_CONTENT;
- }
- else if (strcasecmp(extension, ".dr") == 0)
- {
- return TYPE_DRM_RIGHTS_XML;
- }
- else if (strcasecmp(extension, ".drc") == 0)
- {
- return TYPE_DRM_RIGHTS_WBXML;
- }
- else
- {
- return TYPE_DRM_UNKNOWN;
- }
-}
-
-void pvplayer_async_test_drmcpmplugin::SavePureMediaForCompare(void)
-{
- if(iFileServer.Connect())
- {
- return ;
- }
-
- iFileObject = OSCL_NEW(Oscl_File,(4096,iFileHandle));
- if (iFileObject == NULL)
- {
- iFileServer.Close();
- return ;
- }
-
- int32 ret = iFileObject->Open( iFileName,
- Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,
- iFileServer);
-
- if (ret)
- {
- iFileServer.Close();
- OSCL_DELETE( iFileObject);
- iFileObject = NULL;
- return ;
- }
-
- int32_t mimeType = GetMimeType(iFileName);
-
- T_DRM_Input_Data drmInputData =
- {
- (int32_t)iFileObject,
- mimeType,
- DrmPluginSTGetFileDataLen,
- DrmPluginSTReadFileData,
- DrmPluginSTSeekFileData
- };
-
- drmSession = SVC_drm_openSession(drmInputData);
-
- if((DRM_MEDIA_DATA_INVALID == drmSession) || (DRM_FAILURE == drmSession))
- {
- iFileObject->Close();
- OSCL_DELETE(iFileObject);
- iFileObject = NULL;
- iFileServer.Close();
- return ;
- }
-
- int32_t bufLen = SVC_drm_getContentLength(drmSession);
-
- if (bufLen > 0)
- {
- uint8_t *buf = OSCL_ARRAY_NEW(uint8_t, (bufLen));
- if (buf)
- {
- if (DRM_SUCCESS == SVC_drm_getContent(drmSession,0, buf, bufLen))
- {
- FILE *handle = fopen(DRM_MEDIA_FILE_FOR_COMPARE, "wb");
-
- if (handle)
- {
- fwrite(buf, bufLen, 1, handle);
- fclose(handle);
- }
- }
-
- OSCL_FREE(buf);
- }
- }
-
- iFileObject->Close();
- OSCL_DELETE(iFileObject);
- iFileObject = NULL;
- iFileServer.Close();
-}
-
-int32_t DrmPluginSTGetFileDataLen(int32_t fileHandle)
-{
- Oscl_File* fileObject = (Oscl_File*)fileHandle;
- return fileObject->Size();
-}
-
-int32_t DrmPluginSTSeekFileData( int32_t fileHandle,int32_t offset)
-{
- Oscl_File* fileObject = (Oscl_File*)fileHandle;
- return fileObject->Seek(offset,Oscl_File::SEEKSET);
-}
-
-int32_t DrmPluginSTReadFileData( int32_t fileHandle,uint8_t* buf,int32_t bufLen)
-{
- Oscl_File* fileObject = (Oscl_File*)fileHandle;
- return fileObject->Read(buf,sizeof(uint8_t),bufLen);
-}
diff --git a/android/drm/oma1/test/test_pv_drm_plugin.h b/android/drm/oma1/test/test_pv_drm_plugin.h
deleted file mode 100644
index c02cc8c..0000000
--- a/android/drm/oma1/test/test_pv_drm_plugin.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2007 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 TEST_PV_DRM_PLUGIN_H_INCLUDED
-#define TEST_PV_DRM_PLUGIN_H_INCLUDED
-
-/**
- * @file test_pv_drm_plugin.h
- * @brief This file contains the class definitions for the oma drm 1.0
- * test cases for PVPlayerEngine
- */
-#include "test_pv_player_engine_main.h"
-#include "pv_player_datasourceurl.h"
-#include "pvmf_node_interface.h"
-#include "pv_engine_types.h"
-#include "test_pv_player_engine_config.h"
-#include "oscl_file_io.h"
-#include "pvmi_config_and_capability_observer.h"
-#include "pvmf_cpmplugin_factory_registry.h"
-#include "pvmf_recognizer_types.h"
-#include "pvmf_recognizer_registry.h"
-#include "pvoma1_kmj_recognizer.h"
-#include "pvmi_datastreamsyncinterface_ref_factory.h"
-#include "pvmi_data_stream_interface.h"
-
-
-class PVMFLocalDataSource;
-class PVMFOma1KmjPluginFactory;
-
-/*!
- * A test case to test the normal engine sequence of playing a specified
- * source with kmj CPM plug-in
- * - Data Source: Passed in parameter
- * - Data Sink(s):
- * Video[FileOutputNode-test_player_cpmopenplaystop_[SRCFILENAME]_video.dat]\n
- * Audio[FileOutputNode-test_player_cpmopenplaystop_[SRCFILENAME]_audio.dat]\n
- * Text[FileOutputNode-test_player_cpmopenplaystop_[SRCFILENAME]_text.dat]
- * - Sequence:
- * -# CreatePlayer()
- * -# AddDataSource() with pass-through CPM plug-in
- * -# Init()
- * -# AddDataSink() (video)
- * -# AddDataSink() (audio)
- * -# AddDataSink() (text)
- * -# Prepare()
- * -# Start()
- * -# WAIT 15 sec.
- * -# Stop()
- * -# RemoveDataSink() (video)
- * -# RemoveDataSink() (audio)
- * -# RemoveDataSink() (text)
- * -# Reset()
- * -# RemoveDataSource()
- * -# DeletePlayer()
- *
- */
-class pvplayer_async_test_drmcpmplugin : public pvplayer_async_test_base,
- public PVMFRecognizerCommmandHandler
-{
-public:
- pvplayer_async_test_drmcpmplugin(PVPlayerAsyncTestParam aTestParam):
- pvplayer_async_test_base(aTestParam)
- ,iPlayer(NULL)
- ,iDataSource(NULL)
- ,iDataSinkVideo(NULL)
- ,iIONodeVideo(NULL)
- ,iMIOFileOutVideo(NULL)
- ,iDataSinkAudio(NULL)
- ,iIONodeAudio(NULL)
- ,iMIOFileOutAudio(NULL)
- ,iDataSinkText(NULL)
- ,iIONodeText(NULL)
- ,iMIOFileOutText(NULL)
- ,iCurrentCmdId(0)
- {
- iTestCaseName=_STRLIT_CHAR("DRM plugin Open-Play-Stop-Reset");
- iLocalDataSource=NULL;
- iPluginFactory=NULL;
- }
-
- ~pvplayer_async_test_drmcpmplugin() {}
-
- void StartTest();
- void Run();
- void RecognizerCommandCompleted(const PVMFCmdResp& aResponse){}
-
- void CommandCompleted(const PVCmdResponse& aResponse);
- void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
- void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
-
- enum PVTestState
- {
- STATE_CREATE,
- STATE_ADDDATASOURCE,
- STATE_INIT,
- STATE_ACQUIRELICENSE,
- STATE_GETMETADATAKEYS1,
- STATE_GETMETADATAVALUES1,
- STATE_ADDDATASINK_VIDEO,
- STATE_ADDDATASINK_AUDIO,
- STATE_ADDDATASINK_TEXT,
- STATE_PREPARE,
- STATE_START,
- STATE_STOP,
- STATE_REMOVEDATASINK_VIDEO,
- STATE_REMOVEDATASINK_AUDIO,
- STATE_REMOVEDATASINK_TEXT,
- STATE_RESET,
- STATE_REMOVEDATASOURCE,
- STATE_WAIT_FOR_ERROR_HANDLING,
- STATE_CLEANUPANDCOMPLETE
- };
-
- PVTestState iState;
-
- PVPlayerInterface* iPlayer;
- PVPlayerDataSourceURL* iDataSource;
- PVPlayerDataSink* iDataSinkVideo;
- PVMFNodeInterface* iIONodeVideo;
- PvmiMIOControl* iMIOFileOutVideo;
- PVPlayerDataSink* iDataSinkAudio;
- PVMFNodeInterface* iIONodeAudio;
- PvmiMIOControl* iMIOFileOutAudio;
- PVPlayerDataSink* iDataSinkText;
- PVMFNodeInterface* iIONodeText;
- PvmiMIOControl* iMIOFileOutText;
- PVCommandId iCurrentCmdId;
-
- PVMFRecognizerPluginFactory* iRecognizePluginFactory;
- PVMFLocalDataSource* iLocalDataSource;
- PVMFCPMPluginFactoryRegistryClient iPluginRegistryClient;
- PVMFOma1KmjPluginFactory* iPluginFactory;
- OSCL_HeapString<OsclMemAllocator> iPluginMimeType;
-
-private:
- uint8_t* aLicenseData;
- PVPMetadataList iKeyList;
- int32 iNumAvailableValues;
- Oscl_Vector<PvmiKvp,OsclMemAllocator> iValueList;
- OSCL_wHeapString<OsclMemAllocator> wFileName;
- oscl_wchar output[512];
- bool bDoGetLicenseProc;
- bool bForceDownloadRights;
- int32_t drmSession;
- Oscl_FileServer iFileServer;
- OsclFileHandle* iFileHandle;
- Oscl_File* iFileObject;
-
- #define DRM_MEDIA_FILE_FOR_COMPARE "/data/drm/drm1_core_files/tmp1.drm"
- void SavePureMediaForCompare(void);
- int32_t GetMimeType(char* drmFileName);
-};
-
-extern int32_t DrmPluginSTGetFileDataLen(int32_t fileHandle);
-extern int32_t DrmPluginSTSeekFileData( int32_t fileHandle,int32_t offset);
-extern int32_t DrmPluginSTReadFileData( int32_t fileHandle,uint8_t* buf,int32_t bufLen);
-
-#endif /* TEST_PV_DRM_PLUGIN_H_INCLUDED */
diff --git a/android/drm/oma1/test/test_pv_drm_plugin_ut.cpp b/android/drm/oma1/test/test_pv_drm_plugin_ut.cpp
deleted file mode 100644
index 5adb18c..0000000
--- a/android/drm/oma1/test/test_pv_drm_plugin_ut.cpp
+++ /dev/null
@@ -1,5856 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#include <stdio.h>
-#include "oscl_utf8conv.h"
-#include "pvmi_drm_kvp.h"
-#include "test_pv_drm_plugin_ut.h"
-#include "pvmi_datastreamsyncinterface_ref_factory.h"
-#include "pvmi_data_stream_interface.h"
-
-pvplayer_test_drmcpmplugin_ut::pvplayer_test_drmcpmplugin_ut(PVPlayerAsyncTestParam aTestParam)
- : pvplayer_async_test_base(aTestParam)
-{
- iTestCaseName =_STRLIT_CHAR("DRM plugin unit test");
- pluginInterface = PVMFCPMKmjPlugInOMA1::CreatePlugIn();
- kmjPlugin = OSCL_DYNAMIC_CAST(PVMFCPMKmjPlugInOMA1*,pluginInterface);
-
- recognizerInterface = OSCL_STATIC_CAST(PVMFRecognizerPluginInterface*, OSCL_NEW(PVOMA1KMJRecognizerPlugin, ()));
-
- if (recognizerInterface == NULL)
- {
- OSCL_LEAVE(OsclErrNoMemory);
- return;
- }
-
- recognizer = OSCL_DYNAMIC_CAST(PVOMA1KMJRecognizerPlugin*,recognizerInterface);
-}
-
-pvplayer_test_drmcpmplugin_ut::~pvplayer_test_drmcpmplugin_ut()
-{
- PVMFCPMKmjPlugInOMA1::DestroyPlugIn(pluginInterface);
- if (recognizerInterface)
- {
- OSCL_DELETE(((PVOMA1KMJRecognizerPlugin*)recognizerInterface));
- }
-}
-
-bool pvplayer_test_drmcpmplugin_ut::InitBeforeOneCaseStart()
-{
- if(kmjPlugin)
- {
- kmjPlugin->bRunUT = true;
- kmjPlugin->iAvailableMetadataKeys.clear();
- kmjPlugin->iInputCommands.Construct(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START,
- PVMF_CPM_KMJ_PLUGIN_OMA1_INTERNAL_CMDQ_SIZE);
-
- OSCL_wHeapString<OsclMemAllocator> wFileName;
- oscl_wchar output[512];
-
- oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName),output,512);
- wFileName.set(output,oscl_strlen(output));
-
- if(PVMFSuccess != kmjPlugin->SetSourceInitializationData(wFileName,iFileType,NULL))
- {
- return false;
- }
- }
- else
- {
- return false;
- }
-
- GetAvailableKeys();
-
- return true;
-}
-
-void pvplayer_test_drmcpmplugin_ut::ResetAfterOneCaseComplete()
-{
- numKeys = 0;
- kmjPlugin->bRunUT = false;
-
- kmjPlugin->m_pvfile.Close();
-
- if(kmjPlugin->m_dataAccessFile)
- {
- OSCL_DELETE(kmjPlugin->m_dataAccessFile);
- kmjPlugin->m_dataAccessFile = NULL;
- }
-
- if(iAvailableMetadataKeys.size() > 0)
- {
- iAvailableMetadataKeys.clear();
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->iAvailableMetadataKeys.clear();
- kmjPlugin->iInputCommands.clear();
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::GetAvailableKeys()
-{
- numKeys = 0;
- iAvailableMetadataKeys.clear();
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(FALSE == SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo))
- {
- return;
- }
-
- if(0 == rightsInfo.playRights.indicator)
- {
- return;
- }
-
- //init metadata keys
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_IS_PROTECTED_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_IS_FORWARD_LOCKED_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_TYPE_QUERY);
-
- //has start time license
- if(rightsInfo.playRights.indicator & 0x01)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
-
- // has count license
- if(rightsInfo.playRights.indicator & 0x02)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
-
- // has duration license
- if(rightsInfo.playRights.indicator & 0x04)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- }
-
- // has end time license
- if(rightsInfo.playRights.indicator & 0x08)
- {
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY);
- }
-
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_ENVELOPE_DATA_SIZE_QUERY);
- iAvailableMetadataKeys.push_front(PVMF_DRM_INFO_ENVELOPE_DATA_QUERY);
-
- numKeys = iAvailableMetadataKeys.size();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_QueryUUID()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_CPMPLUGIN_LICENSE_INTERFACE_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryUuid_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_CPMPLUGIN_CONTENTMANAGEMENT_INTERFACE_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryUuid(*cmd);
-
- if(0 == uuIds.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryUuid_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_CPMPLUGIN_AUTHENTICATION_INTERFACE_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryUuid(*cmd);
-
- if(1 == uuIds.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryUuid_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_CPMPLUGIN_AUTHORIZATION_INTERFACE_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryUuid(*cmd);
-
- if(1 == uuIds.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryUuid_4()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_CPMPLUGIN_ACCESS_INTERFACE_FACTORY_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryUuid(*cmd);
-
- if(1 == uuIds.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryUuid_5()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_CPMPLUGIN_LICENSE_INTERFACE_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryUuid(*cmd);
-
- if(1 == uuIds.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryUuid_6()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> mimeType = PVMF_META_DATA_EXTENSION_INTERFACE_MIMETYPE;
- Oscl_Vector<PVUuid, OsclMemAllocator> uuIds;
- int retCmdId = kmjPlugin->QueryUUID( 0,
- mimeType,
- uuIds,
- false,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryUuid(*cmd);
-
- if(1 == uuIds.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_QueryInterface()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginAuthorizationInterfaceUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginAuthorizationInterfaceUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->m_oSourceSet = false;
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFErrInvalidState == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginAccessInterfaceFactoryUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->m_oSourceSet = false;
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFErrInvalidState == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->m_oSourceSet == false;
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginContentManagementInterfaceUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFErrNotSupported == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_4()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->m_oSourceSet == false;
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginAuthenticationInterfaceUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(ptrPvInterface)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_5()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->m_oSourceSet == false;
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginAuthorizationInterfaceUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(ptrPvInterface)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_6()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->m_oSourceSet == false;
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginAccessInterfaceFactoryUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(ptrPvInterface)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_7()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->m_oSourceSet == false;
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- PVMFCPMPluginLicenseInterfaceUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(ptrPvInterface)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoQueryInterface_8()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- kmjPlugin->m_oSourceSet == false;
- PVInterface* ptrPvInterface = NULL;
- int retCmdId = kmjPlugin->QueryInterface( 0,
- KPVMFMetadataExtensionUuid,
- ptrPvInterface,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoQueryInterface(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(ptrPvInterface)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_AuthorizeUsage()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- uint32_t requestTime = 1000;
- PvmiKvp requestUsage = {(char*)"request",1,1,{0}};
- requestUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- PvmiKvp approveUsage = {(char*)"approve",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- PvmiKvp authorizeData = {(char*)"authorize",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- int retCmdId = kmjPlugin->AuthorizeUsage( 0,
- requestUsage,
- approveUsage,
- authorizeData,
- requestTime,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_UsageComplete()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- int retCmdId = kmjPlugin->UsageComplete( 0,NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoAuthorizeUsage_1(void)
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- uint32_t requestTime = 1000;
- PvmiKvp requestUsage = {(char*)"request",1,1,{0}};
- requestUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PREVIEW;
-
- PvmiKvp approveUsage = {(char*)"approve",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- PvmiKvp authorizeData = {(char*)"authorize",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- int retCmdId = kmjPlugin->AuthorizeUsage( 0,
- requestUsage,
- approveUsage,
- authorizeData,
- requestTime,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- int32_t drmMethod = SVC_drm_getDeliveryMethod(kmjPlugin->m_drmSession);
-
- kmjPlugin->DoAuthorizeUsage(*cmd);
-
- if(FORWARD_LOCK == drmMethod)
- {
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- if( PVMFFailure == kmjPlugin->cmdStatus
- || PVMFErrLicenseRequired == kmjPlugin->cmdStatus
- || PVMFErrAccessDenied == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoAuthorizeUsage_2(void)
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- uint32_t requestTime = 1000;
- PvmiKvp requestUsage = {(char*)"request",1,1,{0}};
- requestUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_EXECUTE;
-
- PvmiKvp approveUsage = {(char*)"approve",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- PvmiKvp authorizeData = {(char*)"authorize",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- int retCmdId = kmjPlugin->AuthorizeUsage( 0,
- requestUsage,
- approveUsage,
- authorizeData,
- requestTime,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- int32_t drmMethod = SVC_drm_getDeliveryMethod(kmjPlugin->m_drmSession);
-
- kmjPlugin->DoAuthorizeUsage(*cmd);
-
- if(FORWARD_LOCK == drmMethod)
- {
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- }
- else
- {
- if( PVMFFailure == kmjPlugin->cmdStatus
- || PVMFErrLicenseRequired == kmjPlugin->cmdStatus
- || PVMFErrAccessDenied == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoAuthorizeUsage_3(void)
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- uint32_t requestTime = 1000;
- PvmiKvp requestUsage = {(char*)"request",1,1,{0}};
- requestUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PRINT;
-
- PvmiKvp approveUsage = {(char*)"approve",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- PvmiKvp authorizeData = {(char*)"authorize",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- int retCmdId = kmjPlugin->AuthorizeUsage( 0,
- requestUsage,
- approveUsage,
- authorizeData,
- requestTime,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- int32_t drmMethod = SVC_drm_getDeliveryMethod(kmjPlugin->m_drmSession);
-
- kmjPlugin->DoAuthorizeUsage(*cmd);
-
- if(FORWARD_LOCK == drmMethod)
- {
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- }
- else
- {
- if( PVMFFailure == kmjPlugin->cmdStatus
- || PVMFErrLicenseRequired == kmjPlugin->cmdStatus
- || PVMFErrAccessDenied == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoAuthorizeUsage_4(void)
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- uint32_t requestTime = 1000;
- PvmiKvp requestUsage = {(char*)"request",1,1,{0}};
- requestUsage.value.uint32_value = ( BITMASK_PVMF_CPM_DRM_INTENT_PLAY );
-
- PvmiKvp approveUsage = {(char*)"approve",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- PvmiKvp authorizeData = {(char*)"authorize",1,1,{0}};
- approveUsage.value.uint32_value = BITMASK_PVMF_CPM_DRM_INTENT_PLAY;
-
- int retCmdId = kmjPlugin->AuthorizeUsage( 0,
- requestUsage,
- approveUsage,
- authorizeData,
- requestTime,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- int32_t drmMethod = SVC_drm_getDeliveryMethod(kmjPlugin->m_drmSession);
- int32_t retCheckRights = SVC_drm_checkRights(kmjPlugin->m_drmSession,DRM_PERMISSION_PLAY);
- kmjPlugin->DoAuthorizeUsage(*cmd);
-
- if(DRM_SUCCESS == retCheckRights)
- {
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- if( PVMFFailure == kmjPlugin->cmdStatus
- || PVMFErrLicenseRequired == kmjPlugin->cmdStatus
- || PVMFErrAccessDenied == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- printf("cmd status = %d\r\n",kmjPlugin->cmdStatus);
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_ParseUrlHost(void)
-{
- char* url = (char*)"http://starfish.esmertec.com.cn/tc/drm/Others/mp4_sd_ip.dr";
-
- if(kmjPlugin)
- {
- kmjPlugin->ParseUrl(url);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if( strncmp( kmjPlugin->urlHost.get_cstr(),
- "starfish.esmertec.com.cn",
- strlen("starfish.esmertec.com.cn")))
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if(kmjPlugin->urlPort != 80)
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if( strncmp( kmjPlugin->urlPath.get_cstr(),
- "/tc/drm/Others/mp4_sd_ip.dr",
- strlen("/tc/drm/Others/mp4_sd_ip.dr")))
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- PVPATB_TEST_IS_TRUE(true);
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_ParseUrlIp(void)
-{
- char* url = (char*)"http://221.10.65.38:8080/tc/drm/Others/mp4_sd_ip.dr";
-
- if(kmjPlugin)
- {
- kmjPlugin->ParseUrl(url);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if( strncmp( kmjPlugin->urlHost.get_cstr(),
- "221.10.65.38",
- strlen("221.10.65.38")))
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if(kmjPlugin->urlPort != 8080)
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if( strncmp( kmjPlugin->urlPath.get_cstr(),
- "/tc/drm/Others/mp4_sd_ip.dr",
- strlen("/tc/drm/Others/mp4_sd_ip.dr")))
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- PVPATB_TEST_IS_TRUE(true);
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetLicense()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_HeapString<OsclMemAllocator> contentName;
-
- uint8_t licensData[1024] = {0};
-
- int retCmdId = kmjPlugin->GetLicense( 0,
- contentName,
- licensData,
- sizeof(licensData),
- 1000,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetLicense_w()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_wHeapString<OsclMemAllocator> contentName;
- uint8_t licensData[1024] = {0};
-
- int retCmdId = kmjPlugin->GetLicense( 0,
- contentName,
- licensData,
- sizeof(licensData),
- 1000,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetLicense(void)
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- OSCL_wHeapString<OsclMemAllocator> contentName;
- uint8_t licensData[1024] = {0};
-
- int retCmdId = kmjPlugin->GetLicense( 0,
- contentName,
- licensData,
- sizeof(licensData),
- 1000,
- NULL);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- char url[256] = {0};
-
- // get rights url
- if(DRM_SUCCESS != SVC_drm_getRightsIssuer(kmjPlugin->m_drmSession,(uint8_t*)url))
- {
- kmjPlugin->DoGetLicense(*cmd,true);
-
- if(PVMFFailure == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- kmjPlugin->DoGetLicense(*cmd,true);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNumMetadataKeys_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- uint32_t retNum = kmjPlugin->GetNumMetadataKeys(NULL);
- if(numKeys == retNum)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNumMetadataKeys_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- if(1 == kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_TYPE_QUERY))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNumMetadataKeys_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- char* keyString = (char*)kmjPlugin->GetLicenseType();
-
- if(NULL == keyString)
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- bool licenseUnlimited = false;
- bool licenseTime = false;
- bool licenseDuration = false;
- bool licenseCount = false;
- bool licenseTimeCount = false;
- bool licenseDurationCount = false;
-
- if(strstr(keyString,"unlimited"))
- {
- licenseUnlimited = true;
- }
- else if(strstr(keyString,"time"))
- {
- licenseTime = true;
- }
- else if(strstr(keyString,"duration"))
- {
- licenseDuration = true;
- }
- else if(strstr(keyString,"count"))
- {
- licenseCount = true;
- }
- else if(strstr(keyString,"time-count"))
- {
- licenseTimeCount = true;
- }
- else if(strstr(keyString,"duration-count"))
- {
- licenseDurationCount = true;
- }
-
- uint32_t retNumKeys = 0;
-
- if(false == licenseUnlimited)
- {
- if(false == licenseTime)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY);
- }
- else if(false == licenseCount)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else if(false == licenseDuration)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- }
- else if(false == licenseTimeCount)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else if(false == licenseDurationCount)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
-
- if(0 == retNumKeys)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
-
- if(false == licenseTime)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
-
- if(0 == retNumKeys)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
-
- if(false == licenseDuration)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
-
- if(0 == retNumKeys)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
-
- if(false == licenseCount)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
-
- if(0 == retNumKeys)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
-
- if(false == licenseTimeCount)
- {
- if(false == licenseCount)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
-
- if(0 == retNumKeys)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
-
- if(false == licenseDurationCount)
- {
- if(false == licenseCount)
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else
- {
- retNumKeys = kmjPlugin->GetNumMetadataKeys((char*)PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
-
- if(0 == retNumKeys)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNumMetadataValules_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- if(numKeys == kmjPlugin->GetNumMetadataValues(iAvailableMetadataKeys))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNumMetadataValules_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> metaKeys;
- metaKeys.push_back(PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_QUERY);
-
- if(1 == kmjPlugin->GetNumMetadataValues(metaKeys))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNumMetadataValules_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- char* keyString = (char*)kmjPlugin->GetLicenseType();
-
- if(NULL == keyString)
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- bool licenseUnlimited = false;
- bool licenseTime = false;
- bool licenseDuration = false;
- bool licenseCount = false;
- bool licenseTimeCount = false;
- bool licenseDurationCount = false;
-
- if(strstr(keyString,"unlimited"))
- {
- licenseUnlimited = true;
- }
- else if(strstr(keyString,"time"))
- {
- licenseTime = true;
- }
- else if(strstr(keyString,"duration"))
- {
- licenseDuration = true;
- }
- else if(strstr(keyString,"count"))
- {
- licenseCount = true;
- }
- else if(strstr(keyString,"time-count"))
- {
- licenseTimeCount = true;
- }
- else if(strstr(keyString,"duration-count"))
- {
- licenseDurationCount = true;
- }
-
- Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> metaKeys;
-
- if(false == licenseUnlimited)
- {
- if(false == licenseTime)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY);
- }
- else if(false == licenseCount)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else if(false == licenseDuration)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- }
- else if(false == licenseTimeCount)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else if(false == licenseDurationCount)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- }
-
- if(false == licenseTime)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
-
- if(false == licenseDuration)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- }
-
- if(false == licenseCount)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
-
- if(false == licenseTimeCount)
- {
- if(false == licenseCount)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
- }
-
- if(false == licenseDurationCount)
- {
- if(false == licenseCount)
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- }
- else
- {
- metaKeys.push_back(PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- }
- }
-
- uint32_t retNum = kmjPlugin->GetNumMetadataValues(metaKeys);
- if(0 == retNum)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNodeMetadataKeys()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- iAvailableMetadataKeys.size());
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetNodeMetadataValues()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- iAvailableMetadataKeys.size());
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- -2);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFErrArgument == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 1,
- 0);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFErrArgument == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- iAvailableMetadataKeys.size(),
- iAvailableMetadataKeys.size());
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFErrArgument == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_4()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- char* keyString = (char*)kmjPlugin->GetLicenseType();
-
- if(NULL == keyString)
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- bool licenseUnlimited = false;
- bool licenseTime = false;
- bool licenseDuration = false;
- bool licenseCount = false;
- bool licenseTimeCount = false;
- bool licenseDurationCount = false;
-
- if(strstr(keyString,"unlimited"))
- {
- licenseUnlimited = true;
- }
- else if(strstr(keyString,"time"))
- {
- licenseTime = true;
- }
- else if(strstr(keyString,"duration"))
- {
- licenseDuration = true;
- }
- else if(strstr(keyString,"count"))
- {
- licenseCount = true;
- }
- else if(strstr(keyString,"time-count"))
- {
- licenseTimeCount = true;
- }
- else if(strstr(keyString,"duration-count"))
- {
- licenseDurationCount = true;
- }
-
- int i = 0;
-
- if(false == licenseUnlimited)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
-
- if(false == licenseTime)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
-
- if(false == licenseDuration)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
-
- if(false == licenseCount)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
-
- if(false == licenseTimeCount)
- {
- if(false == licenseCount)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
- else
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
- }
-
- if(false == licenseDurationCount)
- {
- if(false == licenseCount)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
- else
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0,
- (char*)PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START + i == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(retCmdId);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(0 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- i++;
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_5()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- 0);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_6()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- iAvailableMetadataKeys.size() - 1,
- iAvailableMetadataKeys.size() - 1);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_7()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- -1,
- (char*)PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_QUERY);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_8()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- -1);
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(iAvailableMetadataKeys.size() == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataKeys_9()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- int retCmdId = kmjPlugin->GetNodeMetadataKeys( 0,
- aKeyList,
- 0,
- iAvailableMetadataKeys.size());
-
- if(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataKeys(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(iAvailableMetadataKeys.size() == aKeyList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- iAvailableMetadataKeys.size());
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFErrArgument == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_IS_FORWARD_LOCKED_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 2,
- iAvailableMetadataKeys.size());
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFErrArgument == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_IS_FORWARD_LOCKED_QUERY);
- aKeyList.push_back(PVMF_DRM_INFO_LICENSE_TYPE_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 2,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFErrArgument == kmjPlugin->cmdStatus)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_4()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_IS_PROTECTED_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_IS_PROTECTED_VALUE))
- {
- if( (1 == KeyVal.length) && (1 == KeyVal.capacity))
- {
- if(true == KeyVal.value.bool_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_5()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_IS_LICENSE_AVAILABLE_VALUE))
- {
- if( (1 == KeyVal.length) && (1 == KeyVal.capacity))
- {
- bool bIsLicenseAvailable = false;
-
- if(TRUE == SVC_drm_checkRights(kmjPlugin->m_drmSession,DRM_PERMISSION_PLAY))
- {
- bIsLicenseAvailable = true;
- }
-
- if(bIsLicenseAvailable == KeyVal.value.bool_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_6()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_IS_FORWARD_LOCKED_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_IS_FORWARD_LOCKED_VALUE))
- {
- if( (1 == KeyVal.length) && (1 == KeyVal.capacity))
- {
- bool bIsFL = true;
-
- if(SEPARATE_DELIVERY == SVC_drm_getDeliveryMethod(kmjPlugin->m_drmSession))
- {
- bIsFL = false;
- }
-
- if(bIsFL == KeyVal.value.bool_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_7()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_CAN_USE_AS_RINGTONE_VALUE))
- {
- if( (1 == KeyVal.length) && (1 == KeyVal.capacity))
- {
- bool bIsCanBeRingTone = false;
-
- if(TRUE == kmjPlugin->IsStatelessLicense())
- {
- bIsCanBeRingTone = true;
- }
-
- if(bIsCanBeRingTone == KeyVal.value.bool_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_8()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_LICENSE_TYPE_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_LICENSE_TYPE_VALUE))
- {
- char* value = (char*)kmjPlugin->GetLicenseType();
-
- if(NULL == value)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- int32_t len = (int32_t)oscl_strlen(value)+1;
-
- if( (len == KeyVal.length) && (len == KeyVal.capacity))
- {
- if(0 == oscl_strcmp(value,KeyVal.value.pChar_value))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_9()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_LICENSE_COUNT_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(FALSE == SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo))
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- /// no license count
- if(0 == (rightsInfo.playRights.indicator & DRM_COUNT_CONSTRAINT))
- {
- if(0 == aValueList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(1 == aValueList.size())
- {
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_LICENSE_COUNT_VALUE))
- {
- if( (1 == KeyVal.length) && (1 == KeyVal.capacity))
- {
- if((uint32_t)rightsInfo.playRights.count == KeyVal.value.uint32_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_10()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_LICENSE_START_TIME_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(FALSE == SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo))
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- // no license start time
- if(0 == (rightsInfo.playRights.indicator & DRM_START_TIME_CONSTRAINT))
- {
- if(0 == aValueList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(1 == aValueList.size())
- {
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_LICENSE_START_TIME_VALUE))
- {
- if( (KeyVal.length > 1) && (KeyVal.capacity > 1))
- {
- if(KeyVal.value.pChar_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_11()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(FALSE == SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo))
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- // no license expiration time
- if(0 == (rightsInfo.playRights.indicator & DRM_END_TIME_CONSTRAINT))
- {
- if(0 == aValueList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(1 == aValueList.size())
- {
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_LICENSE_EXPIRATION_TIME_VALUE))
- {
- if( (KeyVal.length > 1) && (KeyVal.capacity > 1))
- {
- if(KeyVal.value.pChar_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_12()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- if(FALSE == SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo))
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- // no license remain duration
- if(0 == (rightsInfo.playRights.indicator & DRM_INTERVAL_CONSTRAINT))
- {
- if(0 == aValueList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(1 == aValueList.size())
- {
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_LICENSE_DURATION_SINCE_FIRST_USE_VALUE))
- {
- if( (KeyVal.length > 1) && (KeyVal.capacity > 1))
- {
- if(KeyVal.value.pChar_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_13()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_ENVELOPE_DATA_SIZE_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_ENVELOPE_DATA_SIZE_VALUE))
- {
- if( (1 == KeyVal.length) && (1 == KeyVal.capacity))
- {
- int32_t contentSize = SVC_drm_getContentLength(kmjPlugin->m_drmSession);
-
- if(0 == contentSize)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- if((uint32_t)contentSize == KeyVal.value.uint32_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_14()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- PVMFMetadataList aKeyList;
- aKeyList.push_back(PVMF_DRM_INFO_ENVELOPE_DATA_QUERY);
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- aKeyList,
- aValueList,
- 0,
- 1);
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(1 == aValueList.size())
- {
- PvmiKvp KeyVal = aValueList[0];
-
- if(0 == oscl_strcmp(KeyVal.key,PVMF_DRM_INFO_ENVELOPE_DATA_VALUE))
- {
- int32_t contentSize = SVC_drm_getContentLength(kmjPlugin->m_drmSession);
-
- if(0 == contentSize)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- if( (contentSize == KeyVal.length) && (contentSize == KeyVal.capacity))
- {
- if(KeyVal.value.pUint8_value)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_DoGetMetadataValues_15()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- iAvailableMetadataKeys,
- aValueList,
- 0,
- iAvailableMetadataKeys.size());
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(iAvailableMetadataKeys.size() == aValueList.size())
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_ReleaseNodeMetadataValues_1()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- if(PVMFErrArgument == kmjPlugin->ReleaseNodeMetadataValues(aValueList,0,0))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_ReleaseNodeMetadataValues_2()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
- PvmiKvp KeyVal = {NULL,1,1,{0}};
- KeyVal.key = (char*)PVMF_DRM_INFO_IS_PROTECTED_VALUE;
- KeyVal.value.bool_value = true;
-
- aValueList.push_back(KeyVal);
-
- if(PVMFErrArgument == kmjPlugin->ReleaseNodeMetadataValues(aValueList,1,0))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_ReleaseNodeMetadataValues_3()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- for( uint32_t i = 0; i < 2; i++)
- {
- PvmiKvp KeyVal = {NULL,1,1,{0}};
- KeyVal.key = (char*)PVMF_DRM_INFO_IS_PROTECTED_VALUE;
- KeyVal.value.bool_value = true;
-
- aValueList.push_back(KeyVal);
- }
-
- if(PVMFErrArgument == kmjPlugin->ReleaseNodeMetadataValues(aValueList,1,0))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_ReleaseNodeMetadataValues_4()
-{
- if(false == InitBeforeOneCaseStart())
- {
- PVPATB_TEST_IS_TRUE(false);
- ResetAfterOneCaseComplete();
- return;
- }
-
- T_DRM_Rights_Info rightsInfo;
- oscl_memset(&rightsInfo,0,sizeof(T_DRM_Rights_Info));
-
- int32_t ret = SVC_drm_getRightsInfo(kmjPlugin->m_drmSession,&rightsInfo);
- if(FALSE == ret || 0 == rightsInfo.playRights.indicator)
- {
- PVPATB_TEST_IS_TRUE(true);
- ResetAfterOneCaseComplete();
- return;
- }
-
- if(kmjPlugin)
- {
- Oscl_Vector<PvmiKvp,OsclMemAllocator> aValueList;
-
- int retCmdId = kmjPlugin->GetNodeMetadataValues( 0,
- iAvailableMetadataKeys,
- aValueList,
- 0,
- iAvailableMetadataKeys.size());
-
- if( PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START == retCmdId)
- {
- PVMFCPMKmjPlugInOMA1Command* cmd = kmjPlugin->iInputCommands.FindById(PVMF_CPM_KMJ_PLUGIN_OMA1_COMMAND_ID_START);
-
- if(NULL == cmd)
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- kmjPlugin->DoGetMetadataValues(*cmd);
-
- if(PVMFSuccess == kmjPlugin->cmdStatus)
- {
- if(iAvailableMetadataKeys.size() == aValueList.size())
- {
- if(PVMFSuccess == kmjPlugin->ReleaseNodeMetadataValues(aValueList,0,aValueList.size()))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- ResetAfterOneCaseComplete();
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetIso8601Time_1()
-{
- if(kmjPlugin)
- {
- if(NULL == kmjPlugin->GetIso8601Time(200709266,110000))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetIso8601Time_2()
-{
- if(kmjPlugin)
- {
- if(NULL == kmjPlugin->GetIso8601Time(-2007926,110000))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetIso8601Time_3()
-{
- if(kmjPlugin)
- {
- if(NULL == kmjPlugin->GetIso8601Time(20070926,1102000))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetIso8601Time_4()
-{
- if(kmjPlugin)
- {
- char* retTime = kmjPlugin->GetIso8601Time(20070926,111111);
- if(retTime)
- {
- if(0 == oscl_strcmp(retTime,"2007-09-26T11:11:11Z"))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetDuration_1()
-{
- if(kmjPlugin)
- {
- if(0 == kmjPlugin->GetDuration(-1,1))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetDuration_2()
-{
- if(kmjPlugin)
- {
- if(0 == kmjPlugin->GetDuration(1,-1))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetDuration_3()
-{
- if(kmjPlugin)
- {
- if(0 == kmjPlugin->GetDuration(0,0))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_plugin_GetDuration_4()
-{
- if(kmjPlugin)
- {
- uint32_t expectRet = 1 * 24 * 60 * 60 + 1 * 60 * 60 + 1 * 60 + 1;
-
- if(expectRet == kmjPlugin->GetDuration(1,10101))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_dataaccess_DrmPluginGetDataLen_file()
-{
- Oscl_FileServer fileServ;
- PVFile pvfile;
- oscl_wchar wcharFileName[512];
-
- oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName),wcharFileName,512);
-
- // open file
- int32 ret = pvfile.Open( wcharFileName,Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,fileServ);
- if(ret) // open file failed
- {
- PVPATB_TEST_IS_TRUE(false);
- return ;
- }
-
- DrmPluginDataAccess dataAccess(&pvfile);
-
- int32_t len = DrmPluginGetDataLen((int32_t)&dataAccess);
-
- if(len > 0)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_dataaccess_DrmPluginSeekData_file()
-{
- Oscl_FileServer fileServ;
- PVFile pvfile;
- oscl_wchar wcharFileName[512];
-
- oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName),wcharFileName,512);
-
- // open file
- int32 ret = pvfile.Open( wcharFileName,Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,fileServ);
- if(ret) // open file failed
- {
- PVPATB_TEST_IS_TRUE(false);
- return ;
- }
-
- DrmPluginDataAccess dataAccess(&pvfile);
-
- int32_t len = DrmPluginGetDataLen((int32_t)&dataAccess);
-
- if(len > 0)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if(0 == DrmPluginSeekData((int32_t)&dataAccess, len - 1))
- {
- int32 filePos = pvfile.Tell();
-
- if((len - 1) == filePos)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if(0 == DrmPluginSeekData((int32_t)&dataAccess,0))
- {
- int32 filePos = pvfile.Tell();
-
- if(0 == filePos)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_dataaccess_DrmPluginReadData_file()
-{
- Oscl_FileServer fileServ;
- PVFile pvfile;
- oscl_wchar wcharFileName[512];
-
- oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName),wcharFileName,512);
-
- // open file
- int32 ret = pvfile.Open( wcharFileName,Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,fileServ);
- if(ret) // open file failed
- {
- PVPATB_TEST_IS_TRUE(false);
- return ;
- }
-
- DrmPluginDataAccess dataAccess(&pvfile);
-
- int32_t len = DrmPluginGetDataLen((int32_t)&dataAccess);
-
- if(len > 0)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- int32_t firstReadLen = len/2;
- uint8_t* firstReadBuf = OSCL_ARRAY_NEW(uint8_t,firstReadLen);
- if(!firstReadBuf)
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- int32_t actulLen = DrmPluginReadData((int32_t)&dataAccess,firstReadBuf,firstReadLen);
- OSCL_ARRAY_DELETE(firstReadBuf);
- if(firstReadLen == actulLen)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- int32_t secondReadLen = len - firstReadLen;
- uint8_t* secondReadBuf = OSCL_ARRAY_NEW(uint8_t,secondReadLen);
- if(!secondReadBuf)
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- actulLen = DrmPluginReadData((int32_t)&dataAccess,secondReadBuf,secondReadLen);
- if(secondReadLen == actulLen)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- OSCL_ARRAY_DELETE(secondReadBuf);
- return;
- }
-
- actulLen = DrmPluginReadData((int32_t)&dataAccess,secondReadBuf,secondReadLen);
- if(actulLen > 0)
- {
- PVPATB_TEST_IS_TRUE(false);
- OSCL_ARRAY_DELETE(secondReadBuf);
- return;
- }
- else
- {
- PVPATB_TEST_IS_TRUE(true);
- }
-
- if(0 == DrmPluginSeekData((int32_t)&dataAccess, len - 1))
- {
- actulLen = DrmPluginReadData((int32_t)&dataAccess,secondReadBuf,1);
- if(actulLen != 1)
- {
- PVPATB_TEST_IS_TRUE(false);
- OSCL_ARRAY_DELETE(secondReadBuf);
- return;
- }
- else
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- OSCL_ARRAY_DELETE(secondReadBuf);
-}
-
-static uint8_t testData_buf[] =
-{
- 0x01, 0x0a, 0x1a, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x63, 0x69, 0x64,
- 0x3a, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,
- 0x69, 0x64, 0x2d, 0x68, 0x65, 0x72, 0x65, 0x4f, 0x20, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74,
- 0x69, 0x6f, 0x6e, 0x2d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3a, 0x20, 0x41, 0x45, 0x53, 0x31,
- 0x32, 0x38, 0x43, 0x42, 0x43, 0x0d, 0x0a, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x2d, 0x49, 0x73,
- 0x73, 0x75, 0x65, 0x72, 0x3a, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x72, 0x69, 0x67,
- 0x68, 0x74, 0x73, 0x2d, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
- 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x0d, 0x0a, 0xbe, 0xc0, 0xcb, 0x13, 0xcd, 0x35, 0xc3, 0xe1,
- 0xbf, 0x47, 0xb6, 0x89, 0x33, 0xb1, 0x06, 0x9b, 0xd8, 0x3b, 0x1c, 0xe5, 0xba, 0xe6, 0x32, 0x19,
- 0x50, 0xba, 0x1c, 0xcd, 0x2d, 0x32, 0xec, 0xd7
-};
-
-static int32_t testData_len = sizeof(testData_buf);
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_dataaccess_DrmPluginGetDataLen_buffer()
-{
- DrmPluginDataAccess dataAccess( NULL,
- DrmPluginDataAccess::ACCESS_BUFFER,
- (char*)testData_buf,
- testData_len);
-
- int32_t len = DrmPluginGetDataLen((int32_t)&dataAccess);
-
- if(len == testData_len)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_dataaccess_DrmPluginSeekData_buffer()
-{
- DrmPluginDataAccess dataAccess( NULL,
- DrmPluginDataAccess::ACCESS_BUFFER,
- (char*)testData_buf,
- testData_len);
-
- int32_t len = DrmPluginGetDataLen((int32_t)&dataAccess);
-
- if(len == testData_len)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if(0 == DrmPluginSeekData((int32_t)&dataAccess, len - 1))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- if(0 == DrmPluginSeekData((int32_t)&dataAccess, len + 1))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- if(0 == DrmPluginSeekData((int32_t)&dataAccess, -100))
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(true);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_dataaccess_DrmPluginReadData_buffer()
-{
- DrmPluginDataAccess dataAccess( NULL,
- DrmPluginDataAccess::ACCESS_BUFFER,
- (char*)testData_buf,
- testData_len);
-
- int32_t len = DrmPluginGetDataLen((int32_t)&dataAccess);
-
- if(len == testData_len)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- int32_t firstReadLen = len/2;
- uint8_t* firstReadBuf = OSCL_ARRAY_NEW(uint8_t,firstReadLen);
- if(!firstReadBuf)
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- int32_t actulLen = DrmPluginReadData((int32_t)&dataAccess,firstReadBuf,firstReadLen);
- OSCL_ARRAY_DELETE(firstReadBuf);
- if(firstReadLen == actulLen)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- int32_t secondReadLen = len - firstReadLen;
- uint8_t* secondReadBuf = OSCL_ARRAY_NEW(uint8_t,secondReadLen);
- if(!secondReadBuf)
- {
- PVPATB_TEST_IS_TRUE(false);
- return;
- }
-
- DrmPluginSeekData((int32_t)&dataAccess,secondReadLen);
- actulLen = DrmPluginReadData((int32_t)&dataAccess,secondReadBuf,secondReadLen);
- if(secondReadLen == actulLen)
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- OSCL_ARRAY_DELETE(secondReadBuf);
- return;
- }
-
- DrmPluginSeekData((int32_t)&dataAccess,len);
- actulLen = DrmPluginReadData((int32_t)&dataAccess,secondReadBuf,secondReadLen);
- if(actulLen > 0)
- {
- PVPATB_TEST_IS_TRUE(false);
- OSCL_ARRAY_DELETE(secondReadBuf);
- return;
- }
- else
- {
- PVPATB_TEST_IS_TRUE(true);
- }
-
- OSCL_ARRAY_DELETE(secondReadBuf);
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_recognizer_RecognizeContentType_mp4()
-{
- if(recognizer)
- {
- OSCL_HeapString<OsclMemAllocator> recognizedFormat;
-
- recognizer->RecognizeContentType("viDeo/Mp4",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("video/mp4",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/mp4",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("video/3gpp2",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("video/3gpp",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/3gpp2",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/3gpp",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MPEG4FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_recognizer_RecognizeContentType_mp3()
-{
- if(recognizer)
- {
- OSCL_HeapString<OsclMemAllocator> recognizedFormat;
-
- recognizer->RecognizeContentType("Audio/Mp3",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MP3FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/mp3",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MP3FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/MPA",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MP3FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/mpeg",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_MP3FF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_recognizer_RecognizeContentType_amr()
-{
- if(recognizer)
- {
- OSCL_HeapString<OsclMemAllocator> recognizedFormat;
-
- recognizer->RecognizeContentType("aUdio/AmR",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_AMRFF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/AMR",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_AMRFF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/AMR-WB",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_AMRFF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/amr-wb+",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_AMRFF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_recognizer_RecognizeContentType_aac()
-{
- if(recognizer)
- {
- OSCL_HeapString<OsclMemAllocator> recognizedFormat;
-
- recognizer->RecognizeContentType("aUdiO/mpeG4-geneRic",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_AACFF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/mpeg4-generic",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_AACFF))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_recognizer_RecognizeContentType_unknown()
-{
- if(recognizer)
- {
- OSCL_HeapString<OsclMemAllocator> recognizedFormat;
-
- recognizer->RecognizeContentType("aUdi/mpeG4-geneRic",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_FORMAT_UNKNOWN))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("audio/AM",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_FORMAT_UNKNOWN))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("ideo/mp4",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_FORMAT_UNKNOWN))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-
- recognizer->RecognizeContentType("aio/mp3",recognizedFormat);
-
- if(0 == oscl_strcmp(recognizedFormat.get_cstr(),PVMF_MIME_FORMAT_UNKNOWN))
- {
- PVPATB_TEST_IS_TRUE(true);
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-void pvplayer_test_drmcpmplugin_ut::test_kmj_recognizer_Recognize()
-{
- if(recognizer)
- {
- oscl_wchar iTempWCharBuf[512];
-
- // Convert the source file name to UCS2
- OSCL_wHeapString<OsclMemAllocator> filename_wstr;
- oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName),iTempWCharBuf,512);
- filename_wstr.set(iTempWCharBuf,oscl_strlen(iTempWCharBuf));
-
- // Create a ref data stream access factory based on the filename
- PVMFDataStreamFactory* iRefDataStreamFactory = OSCL_STATIC_CAST(PVMFDataStreamFactory*, OSCL_NEW(PVMIDataStreamSyncInterfaceRefFactory, (filename_wstr)));
-
- Oscl_Vector<PVMFRecognizerResult,OsclMemAllocator> recognizerResult;
- if(PVMFSuccess != recognizer->Recognize(*iRefDataStreamFactory,NULL,recognizerResult))
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else if(recognizerResult.empty())
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- else
- {
- PVMFRecognizerResult& recogResult = recognizerResult.front();
- const char* contentType = recogResult.iRecognizedFormat.get_cstr();
-
- if(0 == oscl_strcmp(contentType,PVMF_MIME_MPEG4FF))
- {
- printf("PVOMA1KMJRecognizerPlugin::Recognize: MP4\r\n");
- }
- else if(0 == oscl_strcmp(contentType,PVMF_MIME_MP3FF))
- {
- printf("PVOMA1KMJRecognizerPlugin::Recognize: MP3\r\n");
- }
- else if(0 == oscl_strcmp(contentType,PVMF_MIME_AMRFF))
- {
- printf("PVOMA1KMJRecognizerPlugin::Recognize: AMR\r\n");
- }
- else if(0 == oscl_strcmp(contentType,PVMF_MIME_AACFF))
- {
- printf("PVOMA1KMJRecognizerPlugin::Recognize: AAC\r\n");
- }
- else if(0 == oscl_strcmp(contentType,PVMF_MIME_FORMAT_UNKNOWN))
- {
- printf("PVOMA1KMJRecognizerPlugin::Recognize: UNKNOWN\r\n");
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
- }
-
- // Destroy the ref data stream sync
- OSCL_DELETE(OSCL_STATIC_CAST(PVMIDataStreamSyncInterfaceRefFactory*, iRefDataStreamFactory));
- iRefDataStreamFactory = NULL;
- }
- else
- {
- PVPATB_TEST_IS_TRUE(false);
- }
-}
-
-
-void pvplayer_test_drmcpmplugin_ut::StartTest()
-{
- AddToScheduler();
- RunIfNotReady();
-}
-
-void pvplayer_test_drmcpmplugin_ut::Run()
-{
- //////// test basic plugin interfaces
- test_kmj_plugin_QueryUUID();
- test_kmj_plugin_DoQueryUuid_1();
- test_kmj_plugin_DoQueryUuid_2();
- test_kmj_plugin_DoQueryUuid_3();
- test_kmj_plugin_DoQueryUuid_4();
- test_kmj_plugin_DoQueryUuid_5();
- test_kmj_plugin_DoQueryUuid_6();
- test_kmj_plugin_QueryInterface();
- test_kmj_plugin_DoQueryInterface_1();
- test_kmj_plugin_DoQueryInterface_2();
- test_kmj_plugin_DoQueryInterface_3();
- test_kmj_plugin_DoQueryInterface_4();
- test_kmj_plugin_DoQueryInterface_5();
- test_kmj_plugin_DoQueryInterface_6();
- test_kmj_plugin_DoQueryInterface_7();
- test_kmj_plugin_DoQueryInterface_8();
-
- //////// test authorize license useage
- test_kmj_plugin_AuthorizeUsage();
- test_kmj_plugin_UsageComplete();
- test_kmj_plugin_DoAuthorizeUsage_1();
- test_kmj_plugin_DoAuthorizeUsage_2();
- test_kmj_plugin_DoAuthorizeUsage_3();
- test_kmj_plugin_DoAuthorizeUsage_4();
-
- ///////////test get license
- test_kmj_plugin_ParseUrlHost();
- test_kmj_plugin_ParseUrlIp();
- test_kmj_plugin_GetLicense();
- test_kmj_plugin_GetLicense_w();
- test_kmj_plugin_DoGetLicense();
-
- //////////test get metadata
- test_kmj_plugin_GetNumMetadataKeys_1();
- test_kmj_plugin_GetNumMetadataKeys_2();
- test_kmj_plugin_GetNumMetadataKeys_3();
- test_kmj_plugin_GetNumMetadataValules_1();
- test_kmj_plugin_GetNumMetadataValules_2();
- test_kmj_plugin_GetNumMetadataValules_3();
- test_kmj_plugin_GetNodeMetadataKeys();
- test_kmj_plugin_GetNodeMetadataValues();
- test_kmj_plugin_DoGetMetadataKeys_1();
- test_kmj_plugin_DoGetMetadataKeys_2();
- test_kmj_plugin_DoGetMetadataKeys_3();
- test_kmj_plugin_DoGetMetadataKeys_4();
- test_kmj_plugin_DoGetMetadataKeys_5();
- test_kmj_plugin_DoGetMetadataKeys_6();
- test_kmj_plugin_DoGetMetadataKeys_7();
- test_kmj_plugin_DoGetMetadataKeys_8();
- test_kmj_plugin_DoGetMetadataKeys_9();
- test_kmj_plugin_DoGetMetadataValues_1();
- test_kmj_plugin_DoGetMetadataValues_2();
- test_kmj_plugin_DoGetMetadataValues_3();
- test_kmj_plugin_DoGetMetadataValues_4();
- test_kmj_plugin_DoGetMetadataValues_5();
- test_kmj_plugin_DoGetMetadataValues_6();
- test_kmj_plugin_DoGetMetadataValues_7();
- test_kmj_plugin_DoGetMetadataValues_8();
- test_kmj_plugin_DoGetMetadataValues_9();
- test_kmj_plugin_DoGetMetadataValues_10();
- test_kmj_plugin_DoGetMetadataValues_11();
- test_kmj_plugin_DoGetMetadataValues_12();
- test_kmj_plugin_DoGetMetadataValues_13();
- test_kmj_plugin_DoGetMetadataValues_14();
- test_kmj_plugin_DoGetMetadataValues_15();
- test_kmj_plugin_ReleaseNodeMetadataValues_1();
- test_kmj_plugin_ReleaseNodeMetadataValues_2();
- test_kmj_plugin_ReleaseNodeMetadataValues_3();
- test_kmj_plugin_ReleaseNodeMetadataValues_4();
- test_kmj_plugin_GetIso8601Time_1();
- test_kmj_plugin_GetIso8601Time_2();
- test_kmj_plugin_GetIso8601Time_3();
- test_kmj_plugin_GetIso8601Time_4();
- test_kmj_plugin_GetDuration_1();
- test_kmj_plugin_GetDuration_2();
- test_kmj_plugin_GetDuration_3();
- test_kmj_plugin_GetDuration_4();
-
- // test access data through file
- test_kmj_dataaccess_DrmPluginGetDataLen_file();
- test_kmj_dataaccess_DrmPluginSeekData_file();
- test_kmj_dataaccess_DrmPluginReadData_file();
-
- // test access data through buffer
- test_kmj_dataaccess_DrmPluginGetDataLen_buffer();
- test_kmj_dataaccess_DrmPluginSeekData_buffer();
- test_kmj_dataaccess_DrmPluginReadData_buffer();
-
- // test recognize content type
- test_kmj_recognizer_RecognizeContentType_mp4();
- test_kmj_recognizer_RecognizeContentType_mp3();
- test_kmj_recognizer_RecognizeContentType_amr();
- test_kmj_recognizer_RecognizeContentType_aac();
- test_kmj_recognizer_RecognizeContentType_unknown();
-
- // test recognizer
- test_kmj_recognizer_Recognize();
-
- iObserver->TestCompleted(*iTestCase);
-}
-
diff --git a/android/drm/oma1/test/test_pv_drm_plugin_ut.h b/android/drm/oma1/test/test_pv_drm_plugin_ut.h
deleted file mode 100644
index 61b8381..0000000
--- a/android/drm/oma1/test/test_pv_drm_plugin_ut.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (C) 2007 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 TEST_PV_DRM_PLUGIN_UT_H_
-#define TEST_PV_DRM_PLUGIN_UT_H_
-
-#include "test_pv_player_engine_main.h"
-#include "pvmf_cpmplugin_kmj_oma1_types.h"
-#include "pvmf_cpmplugin_kmj_oma1_factory.h"
-#include "pvmf_cpmplugin_kmj_oma1.h"
-#include "pvmf_cpmplugin_contentmanagement_interface.h"
-#include "pvoma1_kmj_recognizer.h"
-
-class pvplayer_test_drmcpmplugin_ut : public pvplayer_async_test_base
-{
-public:
- pvplayer_test_drmcpmplugin_ut(PVPlayerAsyncTestParam aTestParam);
- ~pvplayer_test_drmcpmplugin_ut();
-
- void StartTest();
- void Run();
-private:
- /// common methods
- bool InitBeforeOneCaseStart();
- void ResetAfterOneCaseComplete();
- void GetAvailableKeys();
-
- ///Query UUID command
- void test_kmj_plugin_QueryUUID();
-
- /// query unsupported UUID
- void test_kmj_plugin_DoQueryUuid_1();
-
- /// query supported UUID
- void test_kmj_plugin_DoQueryUuid_2();
- void test_kmj_plugin_DoQueryUuid_3();
- void test_kmj_plugin_DoQueryUuid_4();
- void test_kmj_plugin_DoQueryUuid_5();
- void test_kmj_plugin_DoQueryUuid_6();
-
- ///Query Interface command
- void test_kmj_plugin_QueryInterface();
-
- /// invalid state to query interface
- void test_kmj_plugin_DoQueryInterface_1();
- void test_kmj_plugin_DoQueryInterface_2();
-
- /// query unsupported interface
- void test_kmj_plugin_DoQueryInterface_3();
-
- /// query supported interface
- void test_kmj_plugin_DoQueryInterface_4();
- void test_kmj_plugin_DoQueryInterface_5();
- void test_kmj_plugin_DoQueryInterface_6();
- void test_kmj_plugin_DoQueryInterface_7();
- void test_kmj_plugin_DoQueryInterface_8();
-
- /// authorize command
- void test_kmj_plugin_AuthorizeUsage();
-
- /// useage complete command
- void test_kmj_plugin_UsageComplete();
-
- /// unsupported license
- void test_kmj_plugin_DoAuthorizeUsage_1(void);
- void test_kmj_plugin_DoAuthorizeUsage_2(void);
- void test_kmj_plugin_DoAuthorizeUsage_3(void);
-
- /// supported license
- void test_kmj_plugin_DoAuthorizeUsage_4(void);
-
- /// get license char command
- void test_kmj_plugin_GetLicense();
-
- /// get license wchar command
- void test_kmj_plugin_GetLicense_w();
-
- /// parse IP format URL
- void test_kmj_plugin_ParseUrlIp(void);
-
- /// parse host format URL
- void test_kmj_plugin_ParseUrlHost(void);
-
- /// do get license
- void test_kmj_plugin_DoGetLicense(void);
-
- // get all available keys num
- void test_kmj_plugin_GetNumMetadataKeys_1();
-
- // get any one valid key num
- void test_kmj_plugin_GetNumMetadataKeys_2();
-
- // get invalid key num
- void test_kmj_plugin_GetNumMetadataKeys_3();
-
- // get all available Values num
- void test_kmj_plugin_GetNumMetadataValules_1();
-
- // get any one valid Value num
- void test_kmj_plugin_GetNumMetadataValules_2();
-
- // get invalid Vaule num
- void test_kmj_plugin_GetNumMetadataValules_3();
-
- /// get metadata keys command
- void test_kmj_plugin_GetNodeMetadataKeys();
-
- /// get metadata values command
- void test_kmj_plugin_GetNodeMetadataValues();
-
- /// invalid arguments
- void test_kmj_plugin_DoGetMetadataKeys_1();
- void test_kmj_plugin_DoGetMetadataKeys_2();
- void test_kmj_plugin_DoGetMetadataKeys_3();
-
- /// get one unavailable key
- void test_kmj_plugin_DoGetMetadataKeys_4();
-
- /// get any one key
- void test_kmj_plugin_DoGetMetadataKeys_5();
- void test_kmj_plugin_DoGetMetadataKeys_6();
- void test_kmj_plugin_DoGetMetadataKeys_7();
-
- /// get all keys
- void test_kmj_plugin_DoGetMetadataKeys_8();
- void test_kmj_plugin_DoGetMetadataKeys_9();
-
- /// invalid arguments
- void test_kmj_plugin_DoGetMetadataValues_1();
- void test_kmj_plugin_DoGetMetadataValues_2();
- void test_kmj_plugin_DoGetMetadataValues_3();
-
- // get is protected
- void test_kmj_plugin_DoGetMetadataValues_4();
-
- // get is license available
- void test_kmj_plugin_DoGetMetadataValues_5();
-
- // get is forward-lock
- void test_kmj_plugin_DoGetMetadataValues_6();
-
- // get can be used as ring-tone
- void test_kmj_plugin_DoGetMetadataValues_7();
-
- // get license type
- void test_kmj_plugin_DoGetMetadataValues_8();
-
- // get license count
- void test_kmj_plugin_DoGetMetadataValues_9();
-
- // get license start time
- void test_kmj_plugin_DoGetMetadataValues_10();
-
- // get license expiration time
- void test_kmj_plugin_DoGetMetadataValues_11();
-
- // get license remain duration
- void test_kmj_plugin_DoGetMetadataValues_12();
-
- // get enveloped content length
- void test_kmj_plugin_DoGetMetadataValues_13();
-
- // get enveloped content
- void test_kmj_plugin_DoGetMetadataValues_14();
-
- // get all available values
- void test_kmj_plugin_DoGetMetadataValues_15();
-
- /// invalid arguments
- void test_kmj_plugin_ReleaseNodeMetadataValues_1();
- void test_kmj_plugin_ReleaseNodeMetadataValues_2();
- void test_kmj_plugin_ReleaseNodeMetadataValues_3();
-
- // release all values newed from memory
- void test_kmj_plugin_ReleaseNodeMetadataValues_4();
-
- /// invalid arguments
- void test_kmj_plugin_GetIso8601Time_1();
- void test_kmj_plugin_GetIso8601Time_2();
- void test_kmj_plugin_GetIso8601Time_3();
-
- // get valid ISO8601 time
- void test_kmj_plugin_GetIso8601Time_4();
-
- /// invalid arguments
- void test_kmj_plugin_GetDuration_1();
- void test_kmj_plugin_GetDuration_2();
-
- // get valid duration
- void test_kmj_plugin_GetDuration_3();
- void test_kmj_plugin_GetDuration_4();
-
- // test access data through file
- void test_kmj_dataaccess_DrmPluginGetDataLen_file();
- void test_kmj_dataaccess_DrmPluginSeekData_file();
- void test_kmj_dataaccess_DrmPluginReadData_file();
-
- // test access data through buffer
- void test_kmj_dataaccess_DrmPluginGetDataLen_buffer();
- void test_kmj_dataaccess_DrmPluginSeekData_buffer();
- void test_kmj_dataaccess_DrmPluginReadData_buffer();
-
- void test_kmj_recognizer_RecognizeContentType_mp4();
- void test_kmj_recognizer_RecognizeContentType_mp3();
- void test_kmj_recognizer_RecognizeContentType_amr();
- void test_kmj_recognizer_RecognizeContentType_aac();
- void test_kmj_recognizer_RecognizeContentType_unknown();
-
- void test_kmj_recognizer_Recognize();
-
- PVMFCPMKmjPlugInOMA1* kmjPlugin;
- PVMFCPMPluginInterface* pluginInterface;
-
- PVMFRecognizerPluginInterface* recognizerInterface;
- PVOMA1KMJRecognizerPlugin* recognizer;
- uint32_t numKeys;
- Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> iAvailableMetadataKeys;
-};
-
-#endif
diff --git a/android/drm/oma1/test/test_pv_player_engine_main.cpp b/android/drm/oma1/test/test_pv_player_engine_main.cpp
deleted file mode 100644
index d861a9e..0000000
--- a/android/drm/oma1/test/test_pv_player_engine_main.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#include "test_pv_player_engine_main.h"
-#include "test_pv_drm_plugin.h"
-#include "test_pv_drm_plugin_ut.h"
-#include "oscl_mem.h"
-#include "oscl_mem_audit.h"
-#include "oscl_error.h"
-#include "oscl_error_panic.h"
-#include "oscl_scheduler.h"
-#include "pvlogger.h"
-#include "pvlogger_file_appender.h"
-#include "unit_test_args.h"
-#include "pvmf_recognizer_registry.h"
-#include "pvoma1_kmj_recognizer.h"
-#include "pvmi_datastreamsyncinterface_ref_factory.h"
-#include "pvmi_data_stream_interface.h"
-#include "oscl_utf8conv.h"
-#include "oscl_string_utils.h"
-#include "unit_test_args.h"
-
-#include "OMX_Core.h"
-#include "pv_omxcore.h"
-
-void FindSourceFile( cmd_line* command_line,
- OSCL_HeapString<OsclMemAllocator> &aFileNameInfo,
- PVMFFormatType &aInputFileFormatType)
-{
- aFileNameInfo = SOURCENAME_PREPEND_STRING;
- aFileNameInfo += DEFAULTSOURCEFILENAME;
- aInputFileFormatType = PVMF_FORMAT_UNKNOWN;
-
- int iFileArgument = 0;
- bool iFileFound = false;
- bool cmdline_iswchar = command_line->is_wchar();
-
- int count = command_line->get_count();
-
- // Search for the "-source" argument
- // Go through each argument
- for(int iFileSearch = 0; iFileSearch < count; iFileSearch++)
- {
- char argstr[128] = {0};
-
- // Convert to UTF8 if necessary
- if(cmdline_iswchar)
- {
- oscl_wchar* argwstr = NULL;
- command_line->get_arg(iFileSearch, argwstr);
- oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128);
- argstr[127] = 0;
- }
- else
- {
- char* tmpstr = NULL;
- command_line->get_arg(iFileSearch, tmpstr);
- int32 tmpstrlen = oscl_strlen(tmpstr)+1;
- if (tmpstrlen > 128)
- {
- tmpstrlen = 128;
- }
-
- oscl_strncpy(argstr, tmpstr, tmpstrlen);
- argstr[tmpstrlen-1] = 0;
- }
-
- // Do the string compare
- if(oscl_strcmp(argstr, "-help") == 0)
- {
- printf("Source specification option. Default is 'test.mp4':\n");
- printf(" -source sourcename\n");
- printf(" Specify the source filename or URL to use for test cases which\n");
- printf(" allow user-specified source name. The unit test determines the\n");
- printf(" source format type using extension or URL header.\n\n");
- }
- else if(oscl_strcmp(argstr, "-source") == 0)
- {
- iFileFound = true;
- iFileArgument = ++iFileSearch;
- break;
- }
- }
-
- if(iFileFound)
- {
- // Convert to UTF8 if necessary
- if (cmdline_iswchar)
- {
- oscl_wchar* cmd;
- command_line->get_arg(iFileArgument, cmd);
-
- char tmpstr[256];
- oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256);
-
- tmpstr[255] = 0;
- aFileNameInfo = tmpstr;
- }
- else
- {
- char* cmdlinefilename = NULL;
- command_line->get_arg(iFileArgument, cmdlinefilename);
- aFileNameInfo = cmdlinefilename;
- }
- }
-}
-
-void FindDrmTestCaseParam(cmd_line* command_line, int32_t& iUseMethod)
-{
- bool cmdline_iswchar = command_line->is_wchar();
- int count = command_line->get_count();
-
- char *iSourceFind = NULL;
-
- if (cmdline_iswchar)
- {
- iSourceFind = new char[256];
- }
-
- /* Go through each argument */
- for (int iDrmSearch = 0; iDrmSearch < count; iDrmSearch++)
- {
- /* Convert to UTF8 if necessary */
- if (cmdline_iswchar)
- {
- OSCL_TCHAR* cmd = NULL;
- command_line->get_arg(iDrmSearch, cmd);
- oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iSourceFind, 256);
- }
- else
- {
- iSourceFind = NULL;
- command_line->get_arg(iDrmSearch, iSourceFind);
- }
-
- /* Do the string compare */
- if (oscl_strcmp(iSourceFind, "-help") == 0)
- {
- printf("Test cases to run drm cases option. Default is ALL:\n");
- printf(" play\n");
- printf(" Specify to play a DRM protected object.\n");
- printf(" download\n");
- printf(" Specify to downlaod rights for a SD DRM 1.0 media.\n");
- printf(" new_cd\n");
- printf(" indicates that this is a new CD DRM 1.0 media.\n");
- }
- else /* set the usemethod according the input command */
- {
- if (oscl_strcmp(iSourceFind, "play") == 0)
- {
- iUseMethod = DRM_PERMISSION_PLAY;
- }
- else if (oscl_strcmp(iSourceFind, "download") == 0)
- {
- iUseMethod = DRM_DOWNLOAD_RIGHTS_AND_PLAY;
- }
- else if (oscl_strcmp(iSourceFind, "new_cd") == 0)
- {
- iUseMethod = DRM_NEW_CD;
- }
- else if (oscl_strcmp(iSourceFind, "unit_test") == 0)
- {
- iUseMethod = DRM_UNIT_TEST;
- }
- else
- {
- iUseMethod = -1; /* unknown use method */
- }
- }
- }
-
- if (cmdline_iswchar)
- {
- delete[] iSourceFind;
- iSourceFind = NULL;
- }
-}
-
-int _local_main(cmd_line* command_line );
-
-
-// Entry point for the unit test program
-int local_main(cmd_line* command_line )
-{
- //Init Oscl
- OsclBase::Init();
- OsclErrorTrap::Init();
- OsclMem::Init();
-
- OMX_MasterInit();
-
- //Run the test under a trap
- int result = 0;
- int32 err = 0;
- TPVErrorPanic panic;
-
- OSCL_PANIC_TRAP(err,panic,result=_local_main(command_line););
-
- //Show any exception.
- if (err!=0)
- {
- printf("Error! Leave %d\n", err);
- }
- if (panic.iReason!=0)
- {
- printf("Error! Panic %s %d\n", panic.iCategory.Str(), panic.iReason);
- }
-
- //Cleanup
- OMX_MasterDeinit();
-
- OsclMem::Cleanup();
- OsclErrorTrap::Cleanup();
- OsclBase::Cleanup();
-
- return result;
-}
-
-int main(int argc, char **argv)
-{
- int n = 1;
-
- cmd_line *command_line_ptr;
- cmd_line_linux command_line;
- command_line_ptr = &command_line;
-
- command_line.setup(argc-n,&argv[n]);
- return local_main(command_line_ptr);
-}
-
-int _local_main(cmd_line *command_line)
-{
- // Print out the extension for help if no argument
- if (command_line->get_count()==0)
- {
- printf(" Specify '-help' first to get help information on options\n\n");
- }
-
- OSCL_HeapString<OsclMemAllocator> filenameinfo;
- PVMFFormatType inputformattype ;
- FindSourceFile(command_line, filenameinfo, inputformattype);
-
- int32_t useMethod;
- FindDrmTestCaseParam(command_line, useMethod);
-
- pvplayer_engine_test_suite *engine_tests = NULL;
- engine_tests = new pvplayer_engine_test_suite( filenameinfo.get_str(),
- inputformattype,
- useMethod);
- if (engine_tests)
- {
- // Run the engine test
- engine_tests->run_test();
-
- // Print out the results
- text_test_interpreter interp;
- _STRING rs = interp.interpretation(engine_tests->last_result());
- printf(rs.c_str());
-
- const test_result the_result = engine_tests->last_result();
- delete engine_tests;
- engine_tests = NULL;
-
- return (the_result.success_count() != the_result.total_test_count());
- }
- else
- {
- printf("ERROR! pvplayer_engine_test_suite could not be instantiated.\n");
- return 1;
- }
-}
-
-pvplayer_engine_test_suite::pvplayer_engine_test_suite( char *aFileName,
- PVMFFormatType aFileType,
- int32_t aUseMethod)
- : test_case()
-{
- adopt_test_case(new pvplayer_engine_test( aFileName,
- aFileType,
- aUseMethod));
-}
-
-pvplayer_engine_test::pvplayer_engine_test( char *aFileName,
- PVMFFormatType aFileType,
- int32_t aUseMethod)
-{
- iFileName = aFileName;
- iFileType = aFileType;
- iUseMethod = aUseMethod;
- iCurrentTest = NULL;
-}
-
-pvplayer_engine_test::~pvplayer_engine_test()
-{
-}
-
-void pvplayer_engine_test::TestCompleted(test_case &tc)
-{
- // Stop the scheduler
- OsclExecScheduler *sched=OsclExecScheduler::Current();
- if (sched)
- {
- sched->StopScheduler();
- }
-}
-
-void pvplayer_engine_test::test()
-{
- if (iCurrentTest)
- {
- delete iCurrentTest;
- iCurrentTest = NULL;
-
- // Shutdown PVLogger and scheduler before checking mem stats
- OsclScheduler::Cleanup();
- PVLogger::Cleanup();
- }
-
- bool setupLoggerScheduler = true;
- printf("\nStarting DRM 1.0 Plugin Test\r\n");
- SetupLoggerScheduler();
-
- // Setup the standard test case parameters based on current unit test settings
- PVPlayerAsyncTestParam testparam;
- testparam.iObserver = this;
- testparam.iTestCase = this;
- testparam.iFileName = iFileName;
- testparam.iFileType = iFileType;
- testparam.iUseMethod = iUseMethod;
-
- switch(iUseMethod)
- {
- case DRM_DOWNLOAD_RIGHTS_AND_PLAY:
- case DRM_PERMISSION_PLAY:
- case DRM_NEW_CD:
- iCurrentTest = new pvplayer_async_test_drmcpmplugin(testparam);
- break;
- case DRM_UNIT_TEST:
- iCurrentTest = new pvplayer_test_drmcpmplugin_ut(testparam);
- break;
- default:
- break;
- }
-
- if (iCurrentTest)
- {
- OsclExecScheduler *sched = OsclExecScheduler::Current();
-
- if (sched)
- {
- // Start the test
- iCurrentTest->StartTest();
-
- // Start the scheduler so the test case would run
- #if USE_NATIVE_SCHEDULER
- // Have PV scheduler use the scheduler native to the system
- sched->StartNativeScheduler();
- #else
- // Have PV scheduler use its own implementation of the scheduler
- sched->StartScheduler();
- #endif
- }
- else
- {
- printf("ERROR! Scheduler is not available. Test could not run.");
- }
- }
- else //no test to run, skip to next test.
- {
- if(setupLoggerScheduler)
- {
- // Shutdown PVLogger and scheduler before continuing on
- OsclScheduler::Cleanup();
- PVLogger::Cleanup();
- setupLoggerScheduler = false;
- }
- }
-}
-
-void pvplayer_engine_test::SetupLoggerScheduler()
-{
- // Enable the following code for logging (on Symbian, RDebug)
- PVLogger::Init();
-
- // Construct and install the active scheduler
- OsclScheduler::Init("PVPlayerEngineTestScheduler");
-}
-
-
diff --git a/android/drm/oma1/test/test_pv_player_engine_main.h b/android/drm/oma1/test/test_pv_player_engine_main.h
deleted file mode 100644
index d38c356..0000000
--- a/android/drm/oma1/test/test_pv_player_engine_main.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2007 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 TEST_PV_PLAYER_ENGINE_MAIN_H_INCLUDED
-#define TEST_PV_PLAYER_ENGINE_MAIN_H_INCLUDED
-
-#include "test_case.h"
-#include "text_test_interpreter.h"
-#include "oscl_scheduler_ao.h"
-#include "oscl_exception.h"
-#include "pv_player_factory.h"
-#include "pv_player_interface.h"
-#include "pv_engine_observer.h"
-#include "pvlogger.h"
-#include "pvlogger_stderr_appender.h"
-#include "pvlogger_time_and_id_layout.h"
-#include "pvmi_media_io_fileoutput.h"
-
-/* added for DRM integration */
-#include "objmng/svc_drm.h"
-
-#define DRM_DOWNLOAD_RIGHTS_AND_PLAY 0x20
-#define DRM_NEW_CD 0x21
-#define DRM_UNIT_TEST 0x22
-
-template<class DestructClass>
-class LogAppenderDestructDealloc : public OsclDestructDealloc
-{
-public:
- virtual void destruct_and_dealloc(OsclAny *ptr)
- {
- delete((DestructClass*)ptr);
- }
-};
-
-class pvplayer_engine_test_suite : public test_case
-{
-public:
- pvplayer_engine_test_suite( char *aFilename,
- PVMFFormatType aFiletype,
- int32_t aUseMethod);
-};
-
-// Observer class for pvPlayer async test to notify completion of test
-class pvplayer_async_test_observer
-{
-public:
- // Signals completion of test. Test instance can be deleted after this callback completes.
- virtual void TestCompleted(test_case &)=0;
-};
-
-typedef struct
-{
- pvplayer_async_test_observer* iObserver;
- test_case* iTestCase;
- FILE* iTestMsgOutputFile;
- char* iFileName;
- PVMFFormatType iFileType;
- int32_t iUseMethod;
-} PVPlayerAsyncTestParam;
-
-#define PVPATB_TEST_IS_TRUE(condition) (iTestCase->test_is_true_stub( (condition),(#condition),__FILE__,__LINE__ ))
-
-typedef enum
-{
- STATE_CREATE,
- STATE_QUERYINTERFACE,
- STATE_ADDDATASOURCE,
- STATE_CONFIGPARAMS,
- STATE_INIT,
- STATE_GETMETADATAKEYLIST,
- STATE_GETMETADATAVALUELIST,
- STATE_ADDDATASINK_VIDEO,
- STATE_ADDDATASINK_AUDIO,
- STATE_PREPARE,
- STATE_WAIT_FOR_DATAREADY,
- STATE_WAIT_FOR_BUFFCOMPLETE,
- STATE_CANCELALL,
- STATE_WAIT_FOR_CANCELALL,
- STATE_START,
- STATE_SETPLAYBACKRANGE,
- STATE_PAUSE,
- STATE_RESUME,
- STATE_EOSNOTREACHED,
- STATE_STOP,
- STATE_REMOVEDATASINK_VIDEO,
- STATE_REMOVEDATASINK_AUDIO,
- STATE_RESET,
- STATE_REMOVEDATASOURCE,
- STATE_WAIT_FOR_ERROR_HANDLING,
- STATE_CLEANUPANDCOMPLETE
-}PVTestState;
-
-// The base class for all pvplayer engine asynchronous tests
-class pvplayer_async_test_base : public OsclTimerObject,
- public PVCommandStatusObserver,
- public PVInformationalEventObserver,
- public PVErrorEventObserver
-{
-public:
- pvplayer_async_test_base(PVPlayerAsyncTestParam aTestParam) :
- OsclTimerObject(OsclActiveObject::EPriorityNominal, "PVPlayerEngineAsyncTestBase")
- {
- OSCL_ASSERT(aTestParam.iObserver!=NULL);
- OSCL_ASSERT(aTestParam.iTestCase!=NULL);
- iObserver=aTestParam.iObserver;
- iTestCase=aTestParam.iTestCase;
- iTestMsgOutputFile=aTestParam.iTestMsgOutputFile;
- iFileName=aTestParam.iFileName;
- iFileType=aTestParam.iFileType;
- iTestCaseName=_STRLIT_CHAR(" ");
- iUseMethod = aTestParam.iUseMethod;
-
- // Initialize the variables to use for context data testing
- iContextObjectRefValue=0x5C7A; // some random number
- iContextObject=iContextObjectRefValue;
- }
-
- virtual ~pvplayer_async_test_base(){}
- virtual void StartTest()=0;
-
- virtual void CommandCompleted(const PVCmdResponse& /*aResponse*/){}
- virtual void HandleErrorEvent(const PVAsyncErrorEvent& /*aEvent*/){}
- virtual void HandleInformationalEvent(const PVAsyncInformationalEvent& /*aEvent*/){}
-
- // Utility function to retrieve the filename from string and replace ',' with '_'
- void RetrieveFilename( const oscl_wchar* aSource,
- OSCL_wHeapString<OsclMemAllocator>& aFilename)
- {
- if (aSource==NULL)
- {
- return;
- }
-
- // Find the last '\' or '/' in the string
- oscl_wchar* lastslash=(oscl_wchar*)aSource;
- bool foundlastslash=false;
- while (!foundlastslash)
- {
- oscl_wchar* tmp1=oscl_strstr(lastslash, _STRLIT_WCHAR("\\"));
- oscl_wchar* tmp2=oscl_strstr(lastslash, _STRLIT_WCHAR("/"));
- if (tmp1!=NULL)
- {
- lastslash=tmp1+1;
- }
- else if (tmp2!=NULL)
- {
- lastslash=tmp2+1;
- }
- else
- {
- foundlastslash=true;
- }
- }
-
- // Now copy the filename
- if (lastslash)
- {
- aFilename=lastslash;
- }
-
- // Replace each '.' in filename with '_'
- bool finishedreplace=false;
- while (!finishedreplace)
- {
- oscl_wchar* tmp=oscl_strstr(aFilename.get_cstr(), _STRLIT_WCHAR("."));
- if (tmp!=NULL)
- {
- oscl_strncpy(tmp, _STRLIT_WCHAR("_"), 1);
- }
- else
- {
- finishedreplace=true;
- }
- }
- }
-
- pvplayer_async_test_observer* iObserver;
- test_case* iTestCase;
- FILE* iTestMsgOutputFile;
- char *iFileName;
- PVMFFormatType iFileType;
- int32_t iUseMethod;
-
- OSCL_HeapString<OsclMemAllocator> iTestCaseName;
-
- uint32 iContextObject;
- uint32 iContextObjectRefValue;
-};
-
-// test_base-based class which will run async tests on pvPlayer engine
-class pvplayer_engine_test : public test_case,
- public pvplayer_async_test_observer
-{
-public:
- pvplayer_engine_test( char *aFileName,
- PVMFFormatType aFileType,
- int32_t aUseMethod);
- ~pvplayer_engine_test();
-
- // From test_case
- virtual void test();
-
- // From pvplayer_async_test_observer
- void TestCompleted(test_case&);
-
- void SetupLoggerScheduler();
-
-private:
- char *iFileName;
- PVMFFormatType iFileType;
- int32_t iUseMethod;
-
- pvplayer_async_test_base* iCurrentTest;
-};
-
-/*!
-** PVPlayerTestMioFactory: MIO Factory functions
-*/
-class PvmiMIOControl;
-class PVPlayerTestMioFactory
-{
-public:
- static PvmiMIOControl* CreateAudioOutput(OsclAny* aParam);
- static PvmiMIOControl* CreateAudioOutput( OsclAny* aParam,
- PVRefFileOutputTestObserver* aObserver,
- bool aActiveTiming,
- uint32 aQueueLimit,
- bool aSimFlowControl,
- bool logStrings=true);
- static void DestroyAudioOutput(PvmiMIOControl* aMio);
- static PvmiMIOControl* CreateVideoOutput(OsclAny* aParam);
- static PvmiMIOControl* CreateVideoOutput( OsclAny* aParam,
- PVRefFileOutputTestObserver* aObserver,
- bool aActiveTiming,
- uint32 aQueueLimit,
- bool aSimFlowControl,
- bool logStrings=true);
- static void DestroyVideoOutput(PvmiMIOControl* aMio);
- static PvmiMIOControl* CreateTextOutput(OsclAny* aParam);
- static void DestroyTextOutput(PvmiMIOControl* aMio);
-};
-
-#endif
diff --git a/android/drm/oma1/test/test_pv_player_engine_testset_mio_file.cpp b/android/drm/oma1/test/test_pv_player_engine_testset_mio_file.cpp
deleted file mode 100644
index af60dad..0000000
--- a/android/drm/oma1/test/test_pv_player_engine_testset_mio_file.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 2008 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-
-#include "test_pv_player_engine_main.h"
-#include "pvmi_media_io_fileoutput.h"
-
-PvmiMIOControl* PVPlayerTestMioFactory::CreateAudioOutput(OsclAny* aParam)
-{
- return new PVRefFileOutput(((OSCL_wString*)aParam)->get_cstr());
-}
-
-PvmiMIOControl* PVPlayerTestMioFactory::CreateAudioOutput(
- OsclAny* aParam,
- PVRefFileOutputTestObserver* aObserver,
- bool aActiveTiming,
- uint32 aQueueLimit,
- bool aSimFlowControl,
- bool logStrings)
-{
- return new PVRefFileOutput(
- *(OSCL_wString*)aParam,
- aObserver,
- aActiveTiming,
- aQueueLimit,
- aSimFlowControl,
- logStrings);
-}
-
-void PVPlayerTestMioFactory::DestroyAudioOutput(PvmiMIOControl* aMio)
-{
- PVRefFileOutput* mio=(PVRefFileOutput*)aMio;
- delete mio;
-}
-
-PvmiMIOControl* PVPlayerTestMioFactory::CreateVideoOutput(OsclAny* aParam)
-{
- return new PVRefFileOutput(((OSCL_wString*)aParam)->get_cstr());
-}
-
-PvmiMIOControl* PVPlayerTestMioFactory::CreateVideoOutput(
- OsclAny* aParam,
- PVRefFileOutputTestObserver* aObserver,
- bool aActiveTiming,
- uint32 aQueueLimit,
- bool aSimFlowControl,
- bool logStrings)
-{
- return new PVRefFileOutput(
- *(OSCL_wString*)aParam,
- aObserver,
- aActiveTiming,
- aQueueLimit,
- aSimFlowControl,
- logStrings);
-}
-
-void PVPlayerTestMioFactory::DestroyVideoOutput(PvmiMIOControl* aMio)
-{
- PVRefFileOutput* mio=(PVRefFileOutput*)aMio;
- delete mio;
-}
-
-PvmiMIOControl* PVPlayerTestMioFactory::CreateTextOutput(OsclAny* aParam)
-{
- return new PVRefFileOutput(((OSCL_wString*)aParam)->get_cstr());
-}
-
-void PVPlayerTestMioFactory::DestroyTextOutput(PvmiMIOControl* aMio)
-{
- PVRefFileOutput* mio=(PVRefFileOutput*)aMio;
- delete mio;
-}
-
-
-
-
diff --git a/android/playerdriver.cpp b/android/playerdriver.cpp
index 64d7b83..aa282da 100644
--- a/android/playerdriver.cpp
+++ b/android/playerdriver.cpp
@@ -76,9 +76,6 @@
//for KMJ DRM Plugin
#include "pvmf_local_data_source.h"
#include "pvmf_recognizer_registry.h"
-#include "pvoma1_kmj_recognizer.h"
-#include "pvmf_cpmplugin_kmj_oma1.h"
-
using namespace android;