OSDN Git Service

56fa653dd7547c84587677bbc86e5836b98c19d6
[android-x86/external-opencore.git] / pvmi / media_io / pvmi_mio_fileinput / include / pvmi_mio_fileinput_factory.h
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:
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             iTotalSamples = 0;
56             iAverageBitRate = 0;
57         }
58
59         PvmiMIOFileInputSettings(const PvmiMIOFileInputSettings& aSettings)
60         {
61             iMediaFormat = aSettings.iMediaFormat;
62             iLoopInputFile = aSettings.iLoopInputFile;
63             iSamplingFrequency = aSettings.iSamplingFrequency;
64             iNumChannels = aSettings.iNumChannels;
65             iNum20msFramesPerChunk = aSettings.iNum20msFramesPerChunk;
66             iTimescale = aSettings.iTimescale;
67             iFrameHeight = aSettings.iFrameHeight;
68             iFrameWidth = aSettings.iFrameWidth;
69             iFrameRate = aSettings.iFrameRate;
70             iFileName = aSettings.iFileName;
71             iLogFileName = aSettings.iLogFileName;
72             iTextFileName = aSettings.iTextFileName;
73             iAudioLogFileName = aSettings.iAudioLogFileName;
74             iVideoLogFileName = aSettings.iVideoLogFileName;
75             iTotalSamples = aSettings.iTotalSamples;
76             iAverageBitRate = aSettings.iAverageBitRate;
77         }
78
79         ~PvmiMIOFileInputSettings()
80         {
81             iMediaFormat = PVMF_MIME_FORMAT_UNKNOWN;
82             iLoopInputFile = true;
83             iSamplingFrequency = 8000;
84             iNumChannels = 1;
85             iNum20msFramesPerChunk = 1;
86             iTimescale = 1000;
87             iFrameHeight = 144;
88             iFrameWidth = 176;
89             iFrameRate = 15;
90             iTotalSamples = 0;
91             iAverageBitRate = 0;
92         }
93
94         // General settings
95         PVMFFormatType iMediaFormat;
96         bool iLoopInputFile;
97         OSCL_wStackString<512> iFileName;
98         OSCL_wStackString<512> iLogFileName;
99         OSCL_wStackString<512> iTextFileName;
100         OSCL_wStackString<512> iAudioLogFileName;
101         OSCL_wStackString<512> iVideoLogFileName;
102         // Settings for audio files
103         uint32 iSamplingFrequency;
104         uint32 iNumChannels;
105         uint32 iNum20msFramesPerChunk;
106         // Settings for video files
107         uint32 iTimescale;
108         uint32 iFrameHeight;
109         uint32 iFrameWidth;
110         OsclFloat iFrameRate;
111         uint32 iTotalSamples;
112         uint32 iAverageBitRate;
113 };
114
115
116 /**
117  * Factory class for PvmiMIOFileInput
118  */
119 class PvmiMIOFileInputFactory
120 {
121     public:
122         /**
123          * Creates an instance of PvmiMIOFileInput. If the creation fails,
124          * this function will leave.
125          *
126          * @param aSettings Settings for PvmiMIOFileInput
127          * @returns A pointer to an PvmiMIOControl for the file input media input module
128          * @throw Leaves with OsclErrNoMemory if memory allocation failed.
129          */
130         OSCL_IMPORT_REF static PvmiMIOControl* Create(const PvmiMIOFileInputSettings& aSettings);
131
132         /**
133          * This function allows the application to delete an instance of file input MIO module
134          * and reclaim all allocated resources.  An instance can be deleted only in
135          * the idle state. An attempt to delete in any other state will fail and return false.
136          *
137          * @param aNode The file input MIO module to be deleted.
138          * @returns A status code indicating success or failure.
139          */
140         OSCL_IMPORT_REF static bool Delete(PvmiMIOControl* aMio);
141 };
142
143 #endif // PVMI_MIO_FILEINPUT_FACTORY_H_INCLUDED