• 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_TESTSET6_H_INCLUDED
19 #define TEST_PV_AUTHOR_ENGINE_TESTSET6_H_INCLUDED
20 
21 #ifndef TEST_PV_MEDIAINPUT_AUTHOR_ENGINE_H
22 #include "test_pv_mediainput_author_engine.h"
23 #endif
24 
25 #define PVPATB_TEST_IS_TRUE( condition ) (iTestCase->test_is_true_stub( (condition), (#condition), __FILE__, __LINE__ ))
26 
27 class pv_mediainput_async_test_errorhandling: public pvauthor_async_test_base
28 {
29     public:
pv_mediainput_async_test_errorhandling(PVAuthorAsyncTestParam aTestParam,PVMediaInputTestParam aMediaParam,bool aPauseResumeEnable,uint32 aTestErrorType)30         pv_mediainput_async_test_errorhandling(PVAuthorAsyncTestParam aTestParam, PVMediaInputTestParam aMediaParam, bool aPauseResumeEnable, uint32 aTestErrorType)
31                 : pvauthor_async_test_base(aTestParam)
32                 , iOutputFileName(NULL)
33                 , iInputFileName(NULL)
34                 , iComposerMimeType(aMediaParam.iComposerInfo)
35                 , iAudioEncoderMimeType(aMediaParam.iAudioEncInfo)
36                 , iVideoEncoderMimeType(aMediaParam.iVideoEncInfo)
37                 , iMediaInputType(aMediaParam.iInputFormat)
38                 , iAuthor(NULL)
39                 , iComposer(NULL)
40                 , iFileParser(NULL)
41                 , iComposerConfig(NULL)
42                 , iAudioEncoderConfig(NULL)
43                 , iVideoEncoderConfig(NULL)
44                 , iPendingCmds(0)
45                 , iPauseResumeEnable(aPauseResumeEnable)
46                 , iRemoveDataSourceDone(0)
47                 , iAddAudioMediaTrack(false)
48                 , iAddVideoMediaTrack(false)
49                 , iTestErrorType(aTestErrorType)
50 
51         {
52             iLogger = PVLogger::GetLoggerObject("pv_mediainput_async_test_errorhandling");
53 
54             iTestDuration = KTestDuration * 1000 * 1000;
55 
56             if (oscl_strlen(aMediaParam.iIPFileInfo.get_cstr()) != 0)
57             {
58                 oscl_wchar output2[ARRAY_SIZE];
59                 oscl_UTF8ToUnicode(aMediaParam.iIPFileInfo.get_cstr(), oscl_strlen(aMediaParam.iIPFileInfo.get_cstr()), output2, ARRAY_SIZE);
60                 iInputFileName.set(output2, oscl_strlen(output2));
61 
62             }
63 
64             if (oscl_strlen(aMediaParam.iOPFileInfo.get_cstr()) != 0)
65             {
66                 oscl_wchar output1[ARRAY_SIZE];
67                 oscl_UTF8ToUnicode(aMediaParam.iOPFileInfo.get_cstr(), oscl_strlen(aMediaParam.iOPFileInfo.get_cstr()), output1, ARRAY_SIZE);
68                 iOutputFileName.set(output1, oscl_strlen(output1));
69             }
70 
71         }
72 
~pv_mediainput_async_test_errorhandling()73         ~pv_mediainput_async_test_errorhandling()
74         {
75             Cleanup();
76         }
77 
78         void Run();
79         void StartTest();
80 
81         // Author engine observer functions
82         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
83         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
84         void CommandCompleted(const PVCmdResponse& aResponse);
85         void ConfigMp4Composer();
86         PVAECmdType iState;
87         // Test output
88         OSCL_wHeapString<OsclMemAllocator> iOutputFileName;
89         OSCL_wHeapString<OsclMemAllocator> iInputFileName;
90 
91         OSCL_HeapString<OsclMemAllocator> iComposerMimeType;
92         OSCL_HeapString<OsclMemAllocator> iAudioEncoderMimeType;
93         OSCL_HeapString<OsclMemAllocator> iVideoEncoderMimeType;
94 
95         //test input type
96         PVMFFormatType  iMediaInputType;
97 
98         typedef struct ts_keytype
99         {
100             uint8 mode;
101             uint32 duration;
102             uint32 track_no;
103         } key_type;
104 
105     private:
106         // Methods to create test input nodes and add to author engine
107         bool CreateTestInputs();
108         bool AddDataSource();
109 
110         // Methods to configure composers
111         bool ConfigComposer();
112         bool ConfigOutputFile();
113         bool ConfigMp43gpComposer();
114 
115         // Methods to add media tracks
116         bool AddMediaTrack();
117 
118         // Methods to configure encoders
119         bool ConfigureVideoEncoder();
120         bool ConfigureAudioEncoder();
121 
122         void ResetAuthorConfig();
123 
124         void Cleanup();
125         void RemoveMIOComp();
126         bool CapConfigSync1();
127 
AddEngineCommand()128         void AddEngineCommand()
129         {
130             iPendingCmds++;
131         }
132 
EngineCmdComplete()133         bool EngineCmdComplete()
134         {
135             if (iPendingCmds > 0)
136             {
137                 --iPendingCmds;
138             }
139 
140             if (iPendingCmds == 0)
141             {
142                 return true;
143             }
144 
145             return false;
146         }
147 
IsEngineCmdPending()148         bool IsEngineCmdPending()
149         {
150             if (iPendingCmds > 0)
151                 return true;
152             else
153                 return false;
154         }
155 
156         // Author engine related variables
157         PVAuthorEngineInterface* iAuthor;
158         OsclAny*                 iComposer;
159         OsclAny*                 iFileParser;
160         PVInterface*             iComposerConfig;
161         PVInterface*             iAudioEncoderConfig;
162         PVInterface*             iVideoEncoderConfig;
163         PVMIOControlComp         iMIOComponent;
164         uint32                   iPendingCmds;
165         PVLogger*                iLogger;
166         bool                     iPauseResumeEnable;
167         uint                     iRemoveDataSourceDone;
168         uint32                   iTestDuration;
169         bool                     iAddAudioMediaTrack;
170         bool                     iAddVideoMediaTrack;
171         Oscl_FileServer          iFileServer;
172         uint32                   iTestErrorType;
173         PvmiCapabilityAndConfig* iAuthorCapConfigIF;
174         PvmiCapabilityAndConfig* iAuthorCapConfigIF1;
175         PvmiMIOControl*          iMediaIOControl;
176         PvmiKvp* iErrorKVP;
177         FILE*                    iFile;
178         PVInterface*             iOutputSizeAndDurationConfig;
179         PVAECmdType              iCheckState;
180 };
181 
182 #endif
183