1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #ifndef PVMI_MIO_COMM_LOOPBACK_FACTORY_H_INCLUDED 19 #define PVMI_MIO_COMM_LOOPBACK_FACTORY_H_INCLUDED 20 21 #ifndef OSCL_BASE_H_INCLUDED 22 #include "oscl_base.h" 23 #endif 24 #ifndef OSCL_MEM_H_INCLUDED 25 #include "oscl_mem.h" 26 #endif 27 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED 28 #include "oscl_string_containers.h" 29 #endif 30 #ifndef PVMF_FORMAT_TYPE_H_INCLUDED 31 #include "pvmf_format_type.h" 32 #endif 33 #ifndef PVMF_TIMESTAMP_H_INCLUDED 34 #include "pvmf_timestamp.h" 35 #endif 36 37 // Forward declarations 38 class PvmiMIOControl; 39 class OsclMemAllocator; 40 class PvmiMIOCommLoopbackTestObserver; 41 42 /** 43 * Structure containing configuration info for this node 44 */ 45 class PvmiMIOCommLoopbackSettings 46 { 47 public: PvmiMIOCommLoopbackSettings()48 PvmiMIOCommLoopbackSettings() 49 { 50 iMediaFormat = PVMF_MIME_FORMAT_UNKNOWN; 51 iTestObserver = NULL; 52 } 53 PvmiMIOCommLoopbackSettings(const PvmiMIOCommLoopbackSettings & aSettings)54 PvmiMIOCommLoopbackSettings(const PvmiMIOCommLoopbackSettings& aSettings) 55 { 56 iMediaFormat = aSettings.iMediaFormat; 57 iTestObserver = aSettings.iTestObserver; 58 } ~PvmiMIOCommLoopbackSettings()59 ~PvmiMIOCommLoopbackSettings() {} 60 61 // General settings 62 PVMFFormatType iMediaFormat; 63 PvmiMIOCommLoopbackTestObserver *iTestObserver; 64 }; 65 66 67 /** 68 * Factory class for PvmiMIOCommLoopback 69 */ 70 class PvmiMIOCommLoopbackFactory 71 { 72 public: 73 /** 74 * Creates an instance of PvmiMIOCommLoopback. If the creation fails, 75 * this function will leave. 76 * 77 * @param aSettings Settings for PvmiMIOCommLoopback 78 * @returns A pointer to an PvmiMIOControl for the file input media input module 79 * @throw Leaves with OsclErrNoMemory if memory allocation failed. 80 */ 81 OSCL_IMPORT_REF static PvmiMIOControl* Create(const PvmiMIOCommLoopbackSettings& aSettings); 82 83 /** 84 * This function allows the application to delete an instance of file input MIO module 85 * and reclaim all allocated resources. An instance can be deleted only in 86 * the idle state. An attempt to delete in any other state will fail and return false. 87 * 88 * @param aNode The file input MIO module to be deleted. 89 * @returns A status code indicating success or failure. 90 */ 91 OSCL_IMPORT_REF static bool Delete(PvmiMIOControl* aMio); 92 }; 93 94 //An observer class for test support. 95 class PvmiMIOCommLoopbackTestObserver 96 { 97 public: 98 OSCL_IMPORT_REF virtual void LoopbackPos(PVMFTimestamp& aTimestamp) = 0; 99 }; 100 101 #endif // PVMIO_COMM_LOOPBACK_FACTORY_H_INCLUDED 102