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_FILEINPUT_FACTORY_H_INCLUDED 19 #define PVMI_MIO_FILEINPUT_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 34 // Forward declarations 35 class PvmiMIOControl; 36 class OsclMemAllocator; 37 38 /** 39 * Structure containing configuration info for this node 40 */ 41 class PvmiMIOFileInputSettings 42 { 43 public: PvmiMIOFileInputSettings()44 PvmiMIOFileInputSettings() 45 { 46 iMediaFormat = PVMF_MIME_FORMAT_UNKNOWN; 47 iLoopInputFile = true; 48 iSamplingFrequency = 8000; 49 iNumChannels = 1; 50 iNum20msFramesPerChunk = 1; 51 iTimescale = 1000; 52 iFrameHeight = 144; 53 iFrameWidth = 176; 54 iFrameRate = 15; 55 } 56 PvmiMIOFileInputSettings(const PvmiMIOFileInputSettings & aSettings)57 PvmiMIOFileInputSettings(const PvmiMIOFileInputSettings& aSettings) 58 { 59 iMediaFormat = aSettings.iMediaFormat; 60 iLoopInputFile = aSettings.iLoopInputFile; 61 iSamplingFrequency = aSettings.iSamplingFrequency; 62 iNumChannels = aSettings.iNumChannels; 63 iNum20msFramesPerChunk = aSettings.iNum20msFramesPerChunk; 64 iTimescale = aSettings.iTimescale; 65 iFrameHeight = aSettings.iFrameHeight; 66 iFrameWidth = aSettings.iFrameWidth; 67 iFrameRate = aSettings.iFrameRate; 68 iFileName = aSettings.iFileName; 69 iLogFileName = aSettings.iLogFileName; 70 iTextFileName = aSettings.iTextFileName; 71 } 72 ~PvmiMIOFileInputSettings()73 ~PvmiMIOFileInputSettings() 74 { 75 iMediaFormat = PVMF_MIME_FORMAT_UNKNOWN; 76 iLoopInputFile = true; 77 iSamplingFrequency = 8000; 78 iNumChannels = 1; 79 iNum20msFramesPerChunk = 1; 80 iTimescale = 1000; 81 iFrameHeight = 144; 82 iFrameWidth = 176; 83 iFrameRate = 15; 84 } 85 86 // General settings 87 PVMFFormatType iMediaFormat; 88 bool iLoopInputFile; 89 OSCL_wStackString<512> iFileName; 90 OSCL_wStackString<512> iLogFileName; 91 OSCL_wStackString<512> iTextFileName; 92 // Settings for audio files 93 uint32 iSamplingFrequency; 94 uint32 iNumChannels; 95 uint32 iNum20msFramesPerChunk; 96 // Settings for video files 97 uint32 iTimescale; 98 uint32 iFrameHeight; 99 uint32 iFrameWidth; 100 OsclFloat iFrameRate; 101 }; 102 103 104 /** 105 * Factory class for PvmiMIOFileInput 106 */ 107 class PvmiMIOFileInputFactory 108 { 109 public: 110 /** 111 * Creates an instance of PvmiMIOFileInput. If the creation fails, 112 * this function will leave. 113 * 114 * @param aSettings Settings for PvmiMIOFileInput 115 * @returns A pointer to an PvmiMIOControl for the file input media input module 116 * @throw Leaves with OsclErrNoMemory if memory allocation failed. 117 */ 118 OSCL_IMPORT_REF static PvmiMIOControl* Create(const PvmiMIOFileInputSettings& aSettings); 119 120 /** 121 * This function allows the application to delete an instance of file input MIO module 122 * and reclaim all allocated resources. An instance can be deleted only in 123 * the idle state. An attempt to delete in any other state will fail and return false. 124 * 125 * @param aNode The file input MIO module to be deleted. 126 * @returns A status code indicating success or failure. 127 */ 128 OSCL_IMPORT_REF static bool Delete(PvmiMIOControl* aMio); 129 }; 130 131 #endif // PVMI_MIO_FILEINPUT_FACTORY_H_INCLUDED 132