--- /dev/null
+/* ------------------------------------------------------------------
+ * 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.
+ * -------------------------------------------------------------------
+ */
+/**
+ * @file pvaetest_node_config.h
+ * @brief Utility to perform build configuration specific node configuration. This file
+ * is for tye single core build configurations.
+ */
+
+#ifndef PVAETEST_NODE_CONFIG_H_INCLUDED
+#define PVAETEST_NODE_CONFIG_H_INCLUDED
+
+#ifndef OSCL_BASE_H_INCLUDED
+#include "oscl_base.h"
+#endif
+#ifndef PVAETESTINPUT_H_INCLUDED
+#include "pvaetestinput.h"
+#endif
+#ifndef PVMFAMRENCNODE_EXTENSION_H_INCLUDED
+#include "pvmfamrencnode_extension.h"
+#endif
+
+#ifndef TEST_PV_AUTHOR_ENGINE_TYPEDEFS_H
+#include "test_pv_author_engine_typedefs.h"
+#endif
+
+extern const uint32 KNum20msFramesPerChunk;
+extern const uint32 KAudioBitrate;
+
+
+class PVAETestNodeConfig
+{
+ public:
+ static bool ConfigureAudioEncoder(PVInterface* aInterface)
+ {
+ if (!aInterface)
+ return true;
+
+ PVInterface* myInterface;
+ if (!aInterface->queryInterface(PVAMREncExtensionUUID, myInterface))
+ return false;
+
+ PVAMREncExtensionInterface* config = OSCL_STATIC_CAST(PVAMREncExtensionInterface*, aInterface);
+ config->SetMaxNumOutputFramesPerBuffer(KNum20msFramesPerChunk);
+
+ switch (KAudioBitrate)
+ {
+ case 4750:
+ config->SetOutputBitRate(GSM_AMR_4_75);
+ break;
+ case 5150:
+ config->SetOutputBitRate(GSM_AMR_5_15);
+ break;
+ case 5900:
+ config->SetOutputBitRate(GSM_AMR_5_90);
+ break;
+ case 6700:
+ config->SetOutputBitRate(GSM_AMR_6_70);
+ break;
+ case 7400:
+ config->SetOutputBitRate(GSM_AMR_7_40);
+ break;
+ case 7950:
+ config->SetOutputBitRate(GSM_AMR_7_95);
+ break;
+ case 10200:
+ config->SetOutputBitRate(GSM_AMR_10_2);
+ break;
+ case 12200:
+ config->SetOutputBitRate(GSM_AMR_12_2);
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+};
+
+#endif // PVAETEST_NODE_CONFIG_H_INCLUDED
+
+
+
--- /dev/null
+/* ------------------------------------------------------------------
+ * 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.
+ * -------------------------------------------------------------------
+ */
+/**
+ * @file pvaetestinput.cpp
+ * @brief Test input to PVAuthorEngine unit test, using single core encoders
+ */
+
+#ifndef PVAETESTINPUT_H_INCLUDED
+#include "pvaetestinput.h"
+#endif
+#ifndef PVMF_NODE_INTERFACE_H_INCLUDED
+#include "pvmf_node_interface.h"
+#endif
+#ifndef PVMF_MEDIA_INPUT_NODE_FACTORY_H_INCLUDED
+#include "pvmf_media_input_node_factory.h"
+#endif
+#ifndef PVMI_MIO_FILEINPUT_FACTORY_H_INCLUDED
+#include "pvmi_mio_fileinput_factory.h"
+#endif
+#ifndef TEST_PV_AUTHOR_ENGINE_CONFIG_H_INCLUDED
+#include "test_pv_author_engine_config.h"
+#endif
+#ifndef OSCL_UTF8CONV_H
+#include "oscl_utf8conv.h"
+#endif
+
+extern const uint32 KVideoTimescale;
+extern const uint32 KNum20msFramesPerChunk;
+extern const uint32 KTextTimescale;
+extern const uint32 KTextFrameWidth;
+extern const uint32 KTextFrameHeight;
+
+
+////////////////////////////////////////////////////////////////////////////
+PVAETestInput::PVAETestInput(const PVAETestInput& aInput)
+{
+ Copy(aInput);
+}
+
+////////////////////////////////////////////////////////////////////////////
+PVAETestInput& PVAETestInput::operator=(const PVAETestInput & aInput)
+{
+ Copy(aInput);
+ return (*this);
+}
+
+////////////////////////////////////////////////////////////////////////////
+bool PVAETestInput::IsTestInputTypeSupported(PVAETestInputType aType)
+{
+ switch (aType)
+ {
+ case YUV_FILE:
+ case H263_FILE:
+ case H264_FILE:
+ case AMR_IETF_FILE:
+ case AAC_ADIF_FILE:
+ case AAC_ADTS_FILE:
+ case PCM16_FILE:
+ case YUV_WRONG_FILE:
+ case TEXT_FILE:
+ return true;
+
+ case M4V_FILE:
+ return false;
+
+ default:
+ return false;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+int PVAETestInput::CreateInputNode(PVAETestInputType aType, const OSCL_wString& aFileName, AVTConfig iAVTConfig)
+{
+ int status = false;
+ switch (aType)
+ {
+ case YUV_FILE:
+ case H263_FILE:
+ case H264_FILE:
+ case AMR_IETF_FILE:
+ case AAC_ADIF_FILE:
+ case AAC_ADTS_FILE:
+ case PCM16_FILE:
+ case YUV_WRONG_FILE:
+ case TEXT_FILE:
+ status = CreateMIOInputNode(aType, aFileName, iAVTConfig);
+ break;
+
+ case M4V_FILE:
+ default:
+ status = -1;
+ break;
+ }
+
+ return status;
+}
+
+////////////////////////////////////////////////////////////////////////////
+bool PVAETestInput::DeleteInputNode()
+{
+ for (uint32 i = 0; i < iExtensions.size(); i++)
+ iExtensions[i]->removeRef();
+ iExtensions.clear();
+
+ switch (iType)
+ {
+ case YUV_FILE:
+ case H263_FILE:
+ case H264_FILE:
+ case AMR_IETF_FILE:
+ case AAC_ADIF_FILE:
+ case AAC_ADTS_FILE:
+ case PCM16_FILE:
+ case YUV_WRONG_FILE:
+ case TEXT_FILE:
+ if (iNode)
+ PvmfMediaInputNodeFactory::Delete(iNode);
+ if (iMediaInput)
+ PvmiMIOFileInputFactory::Delete(iMediaInput);
+ case M4V_FILE:
+ default:
+ break;
+ }
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////
+PVAETestInput::PVAETestInput()
+{
+ iLogger = PVLogger::GetLoggerObject("PVAETestInput");
+ iNode = NULL;
+ iType = INVALID_INPUT_TYPE;
+ iMediaInput = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////
+void PVAETestInput::Copy(const PVAETestInput& aInput)
+{
+ iNode = aInput.iNode;
+ iType = aInput.iType;
+ iSettings = aInput.iSettings;
+ iExtensions = aInput.iExtensions;
+ iMediaInput = aInput.iMediaInput;
+}
+
+////////////////////////////////////////////////////////////////////////////
+bool PVAETestInput::CreateMIOInputNode(PVAETestInputType aType, const OSCL_wString& aFileName, AVTConfig iAVTConfig)
+{
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE,
+ (0, "PVAETestInput::CreateMIOInputNode: aType=%d", aType));
+
+ iType = aType;
+
+ if (aFileName.get_size() != 0)
+ {
+ iSettings.iFileName = aFileName;
+ }
+ switch (aType)
+ {
+ case YUV_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KYUVTestInput;
+ }
+ iSettings.iMediaFormat = PVMF_YUV420;//PVMF_RGB16;//PVMF_YUV420;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iTimescale = KVideoTimescale;
+ iSettings.iFrameHeight = iAVTConfig.iHeight; //KVideoFrameHeight;
+ iSettings.iFrameWidth = iAVTConfig.iWidth;//KVideoFrameWidth;
+ iSettings.iFrameRate = iAVTConfig.iFps;//KVideoFrameRate;
+ break;
+
+ /*
+ case M4V_FILE:
+ iSettings.iFileName = KM4VTestInput;
+ iSettings.iMediaFormat = PVMF_M4V;
+ iSettings.iLoopInputFile = true;
+ iSettings.iTimescale = KVideoTimescale;
+ iSettings.iFrameHeight = iAVTConfig.iHeight; //KVideoFrameHeight;
+ iSettings.iFrameWidth = iAVTConfig.iWidth;//KVideoFrameWidth;
+ iSettings.iFrameRate = iAVTConfig.iFps;//KVideoFrameRate;
+ break;
+ */
+
+ case H263_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KH263TestInput;
+ }
+ iSettings.iMediaFormat = PVMF_H263;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iTimescale = KVideoTimescale;
+ iSettings.iFrameHeight = iAVTConfig.iHeight; //KVideoFrameHeight;
+ iSettings.iFrameWidth = iAVTConfig.iWidth;//KVideoFrameWidth;
+ iSettings.iFrameRate = iAVTConfig.iFps;//KVideoFrameRate;
+ break;
+
+ case H264_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KH264TestInput;
+ }
+ iSettings.iMediaFormat = PVMF_YUV420;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iTimescale = KVideoTimescale;
+ iSettings.iFrameHeight = iAVTConfig.iHeight; //KVideoFrameHeight;
+ iSettings.iFrameWidth = iAVTConfig.iWidth;//KVideoFrameWidth;
+ iSettings.iFrameRate = iAVTConfig.iFps;//KVideoFrameRate;
+ break;
+
+ case AMR_IETF_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KAMRTestInput;
+ }
+ iSettings.iMediaFormat = PVMF_AMR_IETF;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iSamplingFrequency = iAVTConfig.iSamplingRate; //KAudioTimescale;
+ iSettings.iNumChannels = iAVTConfig.iNumChannels;// KAudioNumChannels;
+ iSettings.iNum20msFramesPerChunk = KNum20msFramesPerChunk;
+ break;
+
+ case AAC_ADIF_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KAACADIFTestInput;
+ }
+ iSettings.iMediaFormat = PVMF_ADIF;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iSamplingFrequency = iAVTConfig.iSamplingRate; //KAudioTimescale;
+ iSettings.iNumChannels = iAVTConfig.iNumChannels;// KAudioNumChannels;
+ iSettings.iNum20msFramesPerChunk = KNum20msFramesPerChunk;
+ break;
+ case AAC_ADTS_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KAACADTSTestInput;
+ }
+ iSettings.iMediaFormat = PVMF_ADTS;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iSamplingFrequency = iAVTConfig.iSamplingRate; //KAudioTimescale;
+ iSettings.iNumChannels = iAVTConfig.iNumChannels;// KAudioNumChannels;
+ iSettings.iNum20msFramesPerChunk = KNum20msFramesPerChunk;
+ break;
+ case PCM16_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KPCM16TestInput;
+ }
+ iSettings.iMediaFormat = PVMF_PCM16;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iSamplingFrequency = iAVTConfig.iSamplingRate; //KAudioTimescale;
+ iSettings.iNumChannels = iAVTConfig.iNumChannels;// KAudioNumChannels;
+ iSettings.iNum20msFramesPerChunk = KNum20msFramesPerChunk;
+ break;
+
+ case YUV_WRONG_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KYUVTestInput;
+ }
+ iSettings.iMediaFormat = PVMF_RGB16;//PVMF_RGB16;//PVMF_YUV420;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iTimescale = KVideoTimescale;
+ iSettings.iFrameHeight = iAVTConfig.iHeight; //KVideoFrameHeight;
+ iSettings.iFrameWidth = iAVTConfig.iWidth;//KVideoFrameWidth;
+ iSettings.iFrameRate = iAVTConfig.iFps;//KVideoFrameRate;
+ break;
+ case TEXT_FILE:
+ if (aFileName.get_size() == 0)
+ {
+ iSettings.iFileName = KTEXTTestInput;
+ iSettings.iLogFileName = KTEXTLogTestInput;
+ iSettings.iTextFileName = KTEXTTxtFileTestInput;
+ }
+ else
+ {
+ if (iAVTConfig.iTextLogFile.get_size() == 0)
+ {
+ iSettings.iLogFileName = KTEXTLogTestInput;
+ }
+ else
+ {
+ oscl_wchar output1[ARRAY_SIZE];
+ oscl_UTF8ToUnicode(iAVTConfig.iTextLogFile.get_cstr(), iAVTConfig.iTextLogFile.get_size(), output1, ARRAY_SIZE);
+ iSettings.iLogFileName.set(output1, oscl_strlen(output1));
+ }
+
+ if (iAVTConfig.iTextConfigFile.get_size() == 0)
+ {
+ iSettings.iTextFileName = KTEXTTxtFileTestInput;
+ }
+ else
+ {
+ oscl_wchar output2[ARRAY_SIZE];
+ oscl_UTF8ToUnicode(iAVTConfig.iTextConfigFile.get_cstr(), iAVTConfig.iTextConfigFile.get_size(), output2, ARRAY_SIZE);
+ iSettings.iTextFileName.set(output2, oscl_strlen(output2));
+ }
+ }
+ iSettings.iMediaFormat = PVMF_3GPP_TIMEDTEXT;
+ iSettings.iLoopInputFile = iAVTConfig.iLoopingEnable;
+ iSettings.iSamplingFrequency = 0;
+ iSettings.iNumChannels = 0;
+ iSettings.iNum20msFramesPerChunk = 0;
+ iSettings.iTimescale = KTextTimescale;
+ iSettings.iFrameHeight = KTextFrameWidth;
+ iSettings.iFrameWidth = KTextFrameHeight;
+ break;
+ default:
+ return false;
+ }
+
+ iMediaInput = PvmiMIOFileInputFactory::Create(iSettings);
+ if (!iMediaInput)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
+ (0, "PVAETestInput::CreateMIOInputNode: Error - PvmiMIOFileInputFactory::Create failed"));
+ return false;
+ }
+
+ iNode = PvmfMediaInputNodeFactory::Create(iMediaInput);
+ if (!iNode)
+ {
+ PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
+ (0, "PVAETestInput::CreateMIOInputNode: Error - PvmfMediaInputNodeFactory::Create failed"));
+ return false;
+ }
+
+ return true;
+}
+
+
+
--- /dev/null
+/* ------------------------------------------------------------------
+ * 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.
+ * -------------------------------------------------------------------
+ */
+/**
+ * @file pvaetestinput.h
+ * @brief Test input to PVAuthorEngine unit test, using single core encoders
+ */
+
+#ifndef PVAETESTINPUT_H_INCLUDED
+#define PVAETESTINPUT_H_INCLUDED
+
+#ifndef OSCL_BASE_H_INCLUDED
+#include "oscl_base.h"
+#endif
+#ifndef PVLOGGER_H_INCLUDED
+#include "pvlogger.h"
+#endif
+#ifndef PVMI_MIO_CONTROL_H_INCLUDED
+#include "pvmi_mio_control.h"
+#endif
+#ifndef OSCL_STRING_H_INCLUDED
+#include "oscl_string.h"
+#endif
+#ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
+#include "oscl_string_containers.h"
+#endif
+#ifndef PVMI_MIO_FILEINPUT_FACTORY_H_INCLUDED
+#include "pvmi_mio_fileinput_factory.h"
+#endif
+
+// Forward declarations
+class PVMFNodeInterface;
+class PVInterface;
+
+
+class AVTConfig
+{
+ public:
+ AVTConfig()
+ {
+ iWidth = 0;
+ iHeight = 0;
+ iFps = 0;
+ iFrameInterval = 0;
+ iSamplingRate = 0;
+ iNumChannels = 0;
+ iLoopingEnable = false;
+
+ };
+
+ ~AVTConfig()
+ {
+ iWidth = 0;
+ iHeight = 0;
+ iFps = 0;
+ iFrameInterval = 0;
+ iSamplingRate = 0;
+ iNumChannels = 0;
+ iLoopingEnable = false;
+
+ };
+
+ AVTConfig(AVTConfig& arATVConfig)
+ {
+ iWidth = arATVConfig.iWidth;
+ iHeight = arATVConfig.iHeight;
+ iFps = arATVConfig.iFps;
+ iFrameInterval = arATVConfig.iFrameInterval;
+ iSamplingRate = arATVConfig.iSamplingRate;
+ iNumChannels = arATVConfig.iNumChannels;
+ iTextLogFile = arATVConfig.iTextLogFile;
+ iTextConfigFile = arATVConfig.iTextConfigFile;
+ iLoopingEnable = arATVConfig.iLoopingEnable;
+
+ }
+
+ int iWidth;
+ int iHeight;
+ OsclFloat iFps;
+ int iFrameInterval;
+ int iSamplingRate;
+ int iNumChannels;
+ OSCL_HeapString<OsclMemAllocator> iTextLogFile;
+ OSCL_HeapString<OsclMemAllocator> iTextConfigFile;
+ bool iLoopingEnable;
+};
+
+/** Enumerated list of test input types */
+typedef enum
+{
+ INVALID_INPUT_TYPE = 0
+ , YUV_FILE
+ , M4V_FILE
+ , H263_FILE
+ , H264_FILE
+ , AMR_IETF_FILE
+ , AAC_ADIF_FILE
+ , AAC_ADTS_FILE
+ , PCM16_FILE
+ , SYMBIAN_DEV_SOUND
+ , YUV_WRONG_FILE //just introduced for error handling scenarios
+ , TEXT_FILE
+} PVAETestInputType;
+
+#define ARRAY_SIZE 512
+
+////////////////////////////////////////////////////////////////////////////
+class PVAETestInput
+{
+ public:
+ /** Default contructor */
+ PVAETestInput();
+
+ /** Default destructor */
+ ~PVAETestInput() {};
+
+ /**
+ * Copy constructor
+ * @param aInput Source object
+ */
+ PVAETestInput(const PVAETestInput& aInput);
+
+ /**
+ * Overloaded = operator
+ * @param aInput Source object
+ * @return Reference to this object with values copied from the source object
+ */
+ PVAETestInput& operator=(const PVAETestInput& aInput);
+
+ /**
+ * Query whether the specified input type is supported
+ *
+ * @param aType Input type to be supported
+ * @return True if input type is supported, else false
+ */
+ bool IsTestInputTypeSupported(PVAETestInputType aType);
+
+ /**
+ * Creates an input node of the specified type. DeleteInputNode() will need to
+ * be called to deallocate the input node. The default contructor will not
+ * delete the input node created by this method.
+ *
+ * @param aType Type of input node to create
+ * @return True for success, else false
+ */
+ int CreateInputNode(PVAETestInputType aType, const OSCL_wString& aFileName, AVTConfig iAVTConfig);
+
+ /**
+ * Deletes the input node contained by this object
+ * @return True for success, else false
+ */
+ bool DeleteInputNode();
+
+ PVMFNodeInterface* iNode; /** Input node */
+ PVAETestInputType iType; /** Input type */
+ PvmiMIOFileInputSettings iSettings; /** settings data */
+ Oscl_Vector<PVInterface*, OsclMemAllocator> iExtensions; /** Vector of extensions to the input node */
+ // Media input module
+ PvmiMIOControl* iMediaInput;
+ uint32 iDuration;
+
+ private:
+ /**
+ * Copy data from source object to this object
+ * @param aInput Source object
+ */
+ void Copy(const PVAETestInput& aInput);
+
+ /**
+ * Creates PVMFFileInputNode of the specified type
+ *
+ * @param aType Type of test input
+ * @return True for success, else false
+ */
+ bool CreateFileInputNode(PVAETestInputType aType);
+
+ /**
+ * Creates the MediaIO module object using its factory::create call and
+ * also creates PVMediaIONode for it
+ *
+ * @param aType Type of test input
+ * @return True for success, else false
+ */
+ bool CreateMIOInputNode(PVAETestInputType aType, const OSCL_wString& aFileName, AVTConfig iAVTConfig);
+
+ PVLogger* iLogger; /** Logger object */
+};
+
+#endif // PVAETESTINPUT_H_INCLUDED
+
+
+