• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TEST_PV_AUTHOR_ENGINE_TESTSET5_H_INCLUDED
19 #define TEST_PV_AUTHOR_ENGINE_TESTSET5_H_INCLUDED
20 
21 #ifndef TEST_PV_MEDIAINPUT_AUTHOR_ENGINE_H
22 #include "test_pv_mediainput_author_engine.h"
23 #endif
24 #ifndef PVMI_FILEIO_KVP_H_INCLUDED
25 #include "pvmi_fileio_kvp.h"
26 #endif
27 
28 #define PVPATB_TEST_IS_TRUE( condition ) (iTestCase->test_is_true_stub( (condition), (#condition), __FILE__, __LINE__ ))
29 
30 #define TEST_TIMEOUT_FACTOR 8  //take into account AVC encoder and symbian emulator
31 class pv_mediainput_async_test_opencomposestop: public pvauthor_async_test_base,
32         public PvmiConfigAndCapabilityCmdObserver
33 {
34     public:
35         pv_mediainput_async_test_opencomposestop(PVAuthorAsyncTestParam aTestParam, PVMediaInputTestParam aMediaParam, bool aPauseResumeEnable,
36                 bool aUseExtrnFileDesc = false)
pvauthor_async_test_base(aTestParam)37                 : pvauthor_async_test_base(aTestParam)
38                 , iOutputFileName(NULL)
39                 , iInputFileName(NULL)
40                 , iComposerMimeType(aMediaParam.iComposerInfo)
41                 , iAudioEncoderMimeType(aMediaParam.iAudioEncInfo)
42                 , iVideoEncoderMimeType(aMediaParam.iVideoEncInfo)
43                 , iMediaInputType(aMediaParam.iInputFormat)
44                 , iLoopTime(aMediaParam.iLoopTime)
45                 , iAuthor(NULL)
46                 , iComposer(NULL)
47                 , iFileParser(NULL)
48                 , iComposerConfig(NULL)
49                 , iAudioEncoderConfig(NULL)
50                 , iVideoEncoderConfig(NULL)
51                 , iPendingCmds(0)
52                 , iPauseResumeEnable(aPauseResumeEnable)
53                 , iRemoveDataSourceDone(0)
54                 , iAddAudioMediaTrack(false)
55                 , iAddVideoMediaTrack(false)
56                 , iFile(aTestParam.iStdOut)
57                 , iRealTimeAuthoring(aMediaParam.iRealTimeAuthoring)
58                 , iVideoBitrate(aMediaParam.iVideoBitrate)
59                 , iAudioBitrate(aMediaParam.iAudioBitrate)
60                 , iFrameRate(aMediaParam.iFrameRate)
61                 , iSamplingRate(aMediaParam.iSamplingRate)
62                 , iUseExtrnFileDesc(aUseExtrnFileDesc)
63 
64         {
65             OSCL_UNUSED_ARG(iAudioBitrate);
66             OSCL_UNUSED_ARG(iFrameRate);
67             OSCL_UNUSED_ARG(iSamplingRate);
68             iFileHandle = NULL;
69 
70             iLogger = PVLogger::GetLoggerObject("pv_mediainput_async_test_opencomposestop");
71 
72             iTestDuration = KTestDuration * 1000 * 1000;
73             iAuthoringCount = 0;
74             if (oscl_strlen(aMediaParam.iIPFileInfo.get_cstr()) != 0)
75             {
76                 oscl_wchar output2[ARRAY_SIZE];
77                 oscl_UTF8ToUnicode(aMediaParam.iIPFileInfo.get_cstr(), oscl_strlen(aMediaParam.iIPFileInfo.get_cstr()), output2, ARRAY_SIZE);
78                 iInputFileName.set(output2, oscl_strlen(output2));
79 
80             }
81 
82             if (oscl_strlen(aMediaParam.iOPFileInfo.get_cstr()) != 0)
83             {
84                 oscl_wchar output1[ARRAY_SIZE];
85                 oscl_UTF8ToUnicode(aMediaParam.iOPFileInfo.get_cstr(), oscl_strlen(aMediaParam.iOPFileInfo.get_cstr()), output1, ARRAY_SIZE);
86                 iOutputFileName.set(output1, oscl_strlen(output1));
87             }
88         }
89 
~pv_mediainput_async_test_opencomposestop()90         ~pv_mediainput_async_test_opencomposestop()
91         {
92             Cleanup();
93         }
94 
95         void Run();
96         void StartTest();
97 
98         // Author engine observer functions
99         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
100         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
101         void CommandCompleted(const PVCmdResponse& aResponse);
102 
103         PVAECmdType iState;
104         // Test output
105         OSCL_wHeapString<OsclMemAllocator> iOutputFileName;
106         OSCL_wHeapString<OsclMemAllocator> iInputFileName;
107 
108         OSCL_HeapString<OsclMemAllocator> iComposerMimeType;
109         OSCL_HeapString<OsclMemAllocator> iAudioEncoderMimeType;
110         OSCL_HeapString<OsclMemAllocator> iVideoEncoderMimeType;
111 
112         //test input type
113         PVMFFormatType  iMediaInputType;
114         uint32 iLoopTime;
115 
116     private:
117         // Methods to create test input nodes and add to author engine
118         bool CreateTestInputs();
119         bool AddDataSource();
120 
121         // Methods to configure composers
122         bool ConfigComposer();
123         bool ConfigOutputFile();
124         OsclFileHandle *iFileHandle;
125         bool ConfigMp43gpComposer();
126 
127         bool CapConfigSync();
128         bool CapConfigAsync();
129         // From PvmiConfigAndCapabilityCmdObserver
130         void SignalEvent(int32 req_id);
131 
132         // Method to configure max filesize/duration interface
133         bool QueryComposerOutputInterface();
134         bool ConfigComposerOutput();
135         // Methods to add media tracks
136         bool AddMediaTrack();
137 
138         // Methods to configure encoders
139         bool ConfigureVideoEncoder();
140         bool ConfigureAudioEncoder();
141         void ResetAuthorConfig();
142 
143         void Cleanup();
144 
AddEngineCommand()145         void AddEngineCommand()
146         {
147             iPendingCmds++;
148         }
149 
EngineCmdComplete()150         bool EngineCmdComplete()
151         {
152             if (iPendingCmds > 0)
153             {
154                 --iPendingCmds;
155             }
156 
157             if (iPendingCmds == 0)
158             {
159                 return true;
160             }
161 
162             return false;
163         }
164 
IsEngineCmdPending()165         bool IsEngineCmdPending()
166         {
167             if (iPendingCmds > 0)
168                 return true;
169             else
170                 return false;
171         }
172 
173         // Author engine related variables
174         PVAuthorEngineInterface* iAuthor;
175         OsclAny*                 iComposer;
176         OsclAny*                 iFileParser;
177         PVInterface*             iComposerConfig;
178         PVInterface*             iAudioEncoderConfig;
179         PVInterface*             iVideoEncoderConfig;
180         PVInterface*             iOutputSizeAndDurationConfig;
181         PVMIOControlComp         iMIOComponent;
182         uint32                   iPendingCmds;
183         PVLogger*                iLogger;
184         bool                     iPauseResumeEnable;
185         uint                     iRemoveDataSourceDone;
186         uint32                   iTestDuration;
187         bool                     iAddAudioMediaTrack;
188         bool                     iAddVideoMediaTrack;
189         Oscl_FileServer          iFileServer;
190         uint32                   iAuthoringCount;
191         FILE*                    iFile;
192         bool                     iRealTimeAuthoring;
193         PvmiCapabilityAndConfig* iAuthorCapConfigIF;
194         PvmiKvp                  iKVPSetAsync;
195         OSCL_StackString<64>     iKeyStringSetAsync;
196         PvmiKvp*                 iErrorKVP;
197         uint32                   iVideoBitrate;
198         uint32                   iAudioBitrate;
199         OsclFloat                iFrameRate;
200         uint32                   iSamplingRate;
201         bool                     iUseExtrnFileDesc;
202 
203 };
204 
205 #endif
206