• 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_PLAYER_ENGINE_TESTSET8_H_INCLUDED
19 #define TEST_PV_PLAYER_ENGINE_TESTSET8_H_INCLUDED
20 
21 /**
22  *  @file test_pv_player_engine_testset8.h
23  *  @brief This file contains the class definitions for the eighth set of
24  *         test cases for PVPlayerEngine which are not fully automated (requires human verification)
25  *
26  */
27 
28 #ifndef TEST_PV_PLAYER_ENGINE_H_INCLUDED
29 #include "test_pv_player_engine.h"
30 #endif
31 
32 #ifndef PV_PLAYER_DATASOURCEURL_H_INCLUDED
33 #include "pv_player_datasourceurl.h"
34 #endif
35 
36 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
37 #include "pvmf_node_interface.h"
38 #endif
39 
40 #ifndef PV_ENGINE_TYPES_H_INCLUDED
41 #include "pv_engine_types.h"
42 #endif
43 
44 #ifndef TEST_PV_PLAYER_ENGINE_CONFIG_H_INCLUDED
45 #include "test_pv_player_engine_config.h"
46 #endif
47 
48 #ifndef OSCL_FILE_IO_H_INCLUDED
49 #include "oscl_file_io.h"
50 #endif
51 
52 #ifndef OSCL_STRING_UTILS_H_INCLUDED
53 #include "oscl_string_utils.h"
54 #endif
55 
56 #ifndef PVMI_CONFIG_AND_CAPABILITY_OBSERVER_H_INCLUDED
57 #include "pvmi_config_and_capability_observer.h"
58 #endif
59 
60 #ifndef PVMF_SOURCE_CONTEXT_DATA_H_INCLUDED
61 #include "pvmf_source_context_data.h"
62 #endif
63 
64 #define INDEX_CODEC_SPECIFIC_INFO_UNDEFINED -1
65 #define INDEX_CODEC_SPECIFIC_INFO_AUDIO 1
66 #define INDEX_CODEC_SPECIFIC_INFO_VIDEO 2
67 #define MAX_CODEC_SPECIFIC_INFO_SUPPORTED 5
68 #define PVPLAYER_ASYNC_TEST_PLAYUNTILEOS_DELAY_AFTER_PREPARE 5*1000*1000 // microseconds
69 
70 /* Specifically added for ASF file format where we need to get the codec-specific-info which
71    is defined in pvmf_asfffparser_defs.h
72    However, this file can be included but as these are common engine test cases and some
73    other parsernode\parser library may use these test cases and in that case it will give
74    the error "asfparserdefs.h cannot be opened" as it is not in that parsernode\parserlibrary
75    code.
76 */
77 
78 static const char PVMF_ASF_PARSER_NODE_TRACKINFO_CODEC_DATA_KEY[] = "track-info/codec-specific-info";
79 
80 /* For VIDEO MEDIA TYPE Stream the fixed size of Format Data fields
81    listed in a structure is 40 Bytes.*/
82 
83 #define SIZE_FORMATDATA_VIDEO 40
84 
85 class PVPlayerDataSink;
86 class PVPlayerDataSinkFilename;
87 class PvmfFileOutputNodeConfigInterface;
88 class PvmiCapabilityAndConfig;
89 
90 /*!
91  *  A test case to query and print out metadata from specified source file using the player engine
92  *  - Data Source: Specified by user of test case
93  *  - Data Sink(s): Video[File Output MediaIO Interface Node-test_player_printmetadata_video.dat]\n
94  *                  Audio[File Output MediaIO Interface Node-test_player_printmetadata_audio.dat]\n
95  *                  Text[File Output MediaIO Interface Node-test_player_printmetadata_text.dat]
96  *  - Sequence:
97  *             -# CreatePlayer()
98  *             -# AddDataSource()
99  *             -# Init()
100  *             -# GetMetadataKeys()
101  *             -# GetMetadataValues()
102  *             -# Print out the metadata list
103  *             -# ReleaseMetadataValues()
104  *             -# AddDataSink() (video)
105  *             -# AddDataSink() (audio)
106  *             -# AddDataSink() (text)
107  *             -# Prepare()
108  *             -# Start()
109  *             -# WAIT 2 sec
110  *             -# GetMetadataKeys()
111  *             -# GetMetadataValues()
112  *             -# Print out the metadata list
113  *             -# ReleaseMetadataValues()
114  *             -# Stop()
115  *             -# GetMetadataKeys()
116  *             -# GetMetadataValues()
117  *             -# Print out the metadata list
118  *             -# ReleaseMetadataValues()
119  *             -# RemoveDataSink() (video)
120  *             -# RemoveDataSink() (audio)
121  *             -# RemoveDataSink() (text)
122  *             -# Reset()
123  *             -# RemoveDataSource()
124  *             -# DeletePlayer()
125  *
126  */
127 class pvplayer_async_test_printmetadata : public pvplayer_async_test_base
128 {
129     public:
pvplayer_async_test_printmetadata(PVPlayerAsyncTestParam aTestParam,bool aReleaseMetadataByApp)130         pvplayer_async_test_printmetadata(PVPlayerAsyncTestParam aTestParam, bool aReleaseMetadataByApp):
131                 pvplayer_async_test_base(aTestParam)
132                 , iPlayer(NULL)
133                 , iDataSource(NULL)
134                 , iDataSinkVideo(NULL)
135                 , iDataSinkAudio(NULL)
136                 , iDataSinkText(NULL)
137                 , iIONodeVideo(NULL)
138                 , iIONodeAudio(NULL)
139                 , iIONodeText(NULL)
140                 , iMIOFileOutVideo(NULL)
141                 , iMIOFileOutAudio(NULL)
142                 , iMIOFileOutText(NULL)
143                 , iCurrentCmdId(0)
144                 , iReleaseMetadataByApp(aReleaseMetadataByApp)
145                 , iSourceContextData(NULL)
146         {
147             if (iReleaseMetadataByApp)
148             {
149                 iTestCaseName = _STRLIT_CHAR("Release Metadata");
150             }
151             else
152             {
153                 iTestCaseName = _STRLIT_CHAR("Print Metadata");
154             }
155         }
156 
~pvplayer_async_test_printmetadata()157         ~pvplayer_async_test_printmetadata() {}
158 
159         void StartTest();
160         void Run();
161 
162         void CommandCompleted(const PVCmdResponse& aResponse);
163         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
164         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
165 
166         int32 iCodecSpecificInfoAudioIndex, iCodecSpecificInfoVideoIndex;
167         void PrintMetadataInfo();
168         void PrintCodecSpecificInfo(char* aData, uint32 aIndex);
169         PVMFStatus GetIndexParamValues(const char* aString, uint32& aStartIndex, uint32& aEndIndex);
170 
171 
172         enum PVTestState
173         {
174             STATE_CREATE,
175             STATE_ADDDATASOURCE,
176             STATE_INIT,
177             STATE_GETMETADATAKEYLIST1,
178             STATE_GETMETADATAVALUELIST1,
179             STATE_RELEASEMETADATAVALUES1,
180             STATE_ADDDATASINK_VIDEO,
181             STATE_ADDDATASINK_AUDIO,
182             STATE_ADDDATASINK_TEXT,
183             STATE_PREPARE,
184             STATE_START,
185             STATE_GETMETADATAKEYLIST2,
186             STATE_GETMETADATAVALUELIST2,
187             STATE_RELEASEMETADATAVALUES2,
188             STATE_STOP,
189             STATE_GETMETADATAKEYLIST3,
190             STATE_GETMETADATAVALUELIST3,
191             STATE_RELEASEMETADATAVALUES3,
192             STATE_REMOVEDATASINK_VIDEO,
193             STATE_REMOVEDATASINK_AUDIO,
194             STATE_REMOVEDATASINK_TEXT,
195             STATE_RESET,
196             STATE_REMOVEDATASOURCE,
197             STATE_CLEANUPANDCOMPLETE
198         };
199 
200         PVTestState iState;
201 
202         PVPlayerInterface* iPlayer;
203         PVPlayerDataSourceURL* iDataSource;
204         PVPlayerDataSink* iDataSinkVideo;
205         PVPlayerDataSink* iDataSinkAudio;
206         PVPlayerDataSink* iDataSinkText;
207         PVMFNodeInterface* iIONodeVideo;
208         PVMFNodeInterface* iIONodeAudio;
209         PVMFNodeInterface* iIONodeText;
210         PvmiMIOControl* iMIOFileOutVideo;
211         PvmiMIOControl* iMIOFileOutAudio;
212         PvmiMIOControl* iMIOFileOutText;
213         PVCommandId iCurrentCmdId;
214         bool iReleaseMetadataByApp;
215         PVMFSourceContextData* iSourceContextData;
216 
217         OSCL_wHeapString<OsclMemAllocator> iFileNameWStr;
218         oscl_wchar iTmpWCharBuffer[512];
219 
220         PVPMetadataList iMetadataKeyList;
221         Oscl_Vector<PvmiKvp, OsclMemAllocator> iMetadataValueList;
222         int32 iNumValues;
223 
224         int32 iDownloadMaxfilesize;
225         OSCL_wHeapString<OsclMemAllocator> iDownloadFilename;
226         OSCL_HeapString<OsclMemAllocator> iDownloadProxy;
227         OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename;
228 
229 };
230 
231 
232 /*!
233  *  A test case to periodically print out memory usage while playing a specified source file using the player engine
234  *  - Data Source: Specified by user of test case
235  *  - Data Sink(s): Video[File Output MediaIO Interface Node-test_player_printmemstats_video.dat]\n
236  *                  Audio[File Output MediaIO Interface Node-test_player_printmemstats_audio.dat]\n
237  *                  Text[File Output MediaIO Interface Node-test_player_printmemstats_text.dat]
238  *  - Sequence:
239  *             -# CreatePlayer()
240  *             -# AddDataSource()
241  *             -# Init()
242  *             -# GetMetadataKeys()
243  *             -# GetMetadataValues()
244  *             -# AddDataSink() (video)
245  *             -# AddDataSink() (audio)
246  *             -# AddDataSink() (text)
247  *             -# Prepare()
248  *             -# Start()
249  *             -# WAIT 20 sec
250  *             -# Stop()
251  *             -# RemoveDataSink() (video)
252  *             -# RemoveDataSink() (audio)
253  *             -# RemoveDataSink() (text)
254  *             -# Reset()
255  *             -# RemoveDataSource()
256  *             -# DeletePlayer()
257  *
258  */
259 class pvplayer_async_test_printmemstats : public pvplayer_async_test_base
260 {
261     public:
pvplayer_async_test_printmemstats(PVPlayerAsyncTestParam aTestParam)262         pvplayer_async_test_printmemstats(PVPlayerAsyncTestParam aTestParam):
263                 pvplayer_async_test_base(aTestParam)
264                 , iPlayer(NULL)
265                 , iDataSource(NULL)
266                 , iDataSinkVideo(NULL)
267                 , iDataSinkAudio(NULL)
268                 , iDataSinkText(NULL)
269                 , iIONodeVideo(NULL)
270                 , iIONodeAudio(NULL)
271                 , iIONodeText(NULL)
272                 , iMIOFileOutVideo(NULL)
273                 , iMIOFileOutAudio(NULL)
274                 , iMIOFileOutText(NULL)
275                 , iCurrentCmdId(0)
276                 , iSourceContextData(NULL)
277                 , iPlayTimeCtr(0)
278                 , iInitialNumBytes(0)
279                 , iInitialNumAllocs(0)
280         {
281             iTestCaseName = _STRLIT_CHAR("Print Memory Statistics");
282         }
283 
~pvplayer_async_test_printmemstats()284         ~pvplayer_async_test_printmemstats() {}
285 
286         void StartTest();
287         void Run();
288 
289         void CommandCompleted(const PVCmdResponse& aResponse);
290         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
291         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
292 
293         void PrintMemStats();
294 
295         enum PVTestState
296         {
297             STATE_CREATE,
298             STATE_ADDDATASOURCE,
299             STATE_INIT,
300             STATE_GETMETADATAKEYLIST,
301             STATE_GETMETADATAVALUELIST,
302             STATE_ADDDATASINK_VIDEO,
303             STATE_ADDDATASINK_AUDIO,
304             STATE_ADDDATASINK_TEXT,
305             STATE_PREPARE,
306             STATE_START,
307             STATE_PRINTMEMSTATS,
308             STATE_STOP,
309             STATE_REMOVEDATASINK_VIDEO,
310             STATE_REMOVEDATASINK_AUDIO,
311             STATE_REMOVEDATASINK_TEXT,
312             STATE_RESET,
313             STATE_REMOVEDATASOURCE,
314             STATE_CLEANUPANDCOMPLETE
315         };
316 
317         PVTestState iState;
318 
319         PVPlayerInterface* iPlayer;
320         PVPlayerDataSourceURL* iDataSource;
321         PVPlayerDataSink* iDataSinkVideo;
322         PVPlayerDataSink* iDataSinkAudio;
323         PVPlayerDataSink* iDataSinkText;
324         PVMFNodeInterface* iIONodeVideo;
325         PVMFNodeInterface* iIONodeAudio;
326         PVMFNodeInterface* iIONodeText;
327         PvmiMIOControl* iMIOFileOutVideo;
328         PvmiMIOControl* iMIOFileOutAudio;
329         PvmiMIOControl* iMIOFileOutText;
330         PVCommandId iCurrentCmdId;
331         PVMFSourceContextData* iSourceContextData;
332 
333         OSCL_wHeapString<OsclMemAllocator> iFileNameWStr;
334         oscl_wchar iTmpWCharBuffer[512];
335 
336         PVPMetadataList iMetadataKeyList;
337         Oscl_Vector<PvmiKvp, OsclMemAllocator> iMetadataValueList;
338         int32 iNumValues;
339 
340         uint32 iPlayTimeCtr;
341 
342         uint32 iInitialNumBytes;
343         uint32 iInitialNumAllocs;
344 
345         int32 iDownloadMaxfilesize;
346         OSCL_wHeapString<OsclMemAllocator> iDownloadFilename;
347         OSCL_HeapString<OsclMemAllocator> iDownloadProxy;
348         OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename;
349 };
350 
351 
352 /*!
353  *  A test case to test playback of specified source with file output media IO node till EOS. Prints out the playback position
354  *  player engine sends playback status events
355  *  - Data Source: Specified by user of test case
356  *  - Data Sink(s): Video[File Output MediaIO Interface Node-test_player_playuntileos_%SOURCEFILENAME%_video.dat]\n
357  *                  Audio[File Output MediaIO Interface Node-test_player_playuntileos_%SOURCEFILENAME%_audio.dat]\n
358  *                  Text[File Output MediaIO Interface Node-test_player_playuntileos_%SOURCEFILENAME%_text.dat]
359  *  - Sequence:
360  *             -# CreatePlayer()
361  *             -# AddDataSource()
362  *             -# Init()
363  *             -# AddDataSink() (video)
364  *             -# AddDataSink() (audio)
365  *             -# AddDataSink() (text)
366  *             -# Prepare()
367  *             -# Start()
368  *             -# WAIT FOR EOS EVENT
369  *             -# Stop()
370  *             -# RemoveDataSink() (video)
371  *             -# RemoveDataSink() (audio)
372  *             -# RemoveDataSink() (text)
373  *             -# Reset()
374  *             -# RemoveDataSource()
375  *             -# DeletePlayer()
376  *
377  */
378 class pvplayer_async_test_playuntileos : public pvplayer_async_test_base
379 {
380     public:
pvplayer_async_test_playuntileos(PVPlayerAsyncTestParam aTestParam)381         pvplayer_async_test_playuntileos(PVPlayerAsyncTestParam aTestParam):
382                 pvplayer_async_test_base(aTestParam)
383                 , iPlayer(NULL)
384                 , iDataSource(NULL)
385                 , iDataSinkVideo(NULL)
386                 , iDataSinkAudio(NULL)
387                 , iDataSinkText(NULL)
388                 , iIONodeVideo(NULL)
389                 , iIONodeAudio(NULL)
390                 , iIONodeText(NULL)
391                 , iMIOFileOutVideo(NULL)
392                 , iMIOFileOutAudio(NULL)
393                 , iMIOFileOutText(NULL)
394                 , iCurrentCmdId(0)
395                 , iSourceContextData(NULL)
396         {
397             iTestCaseName = _STRLIT_CHAR("Play Until EOS");
398         }
399 
~pvplayer_async_test_playuntileos()400         ~pvplayer_async_test_playuntileos() {}
401 
402         void StartTest();
403         void Run();
404 
405         void CommandCompleted(const PVCmdResponse& aResponse);
406         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
407         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
408 
409         enum PVTestState
410         {
411             STATE_CREATE,
412             STATE_ADDDATASOURCE,
413             STATE_INIT,
414             STATE_ADDDATASINK_VIDEO,
415             STATE_ADDDATASINK_AUDIO,
416             STATE_ADDDATASINK_TEXT,
417             STATE_PREPARE,
418             STATE_START,
419             STATE_EOSNOTREACHED,
420             STATE_STOP,
421             STATE_REMOVEDATASINK_VIDEO,
422             STATE_REMOVEDATASINK_AUDIO,
423             STATE_REMOVEDATASINK_TEXT,
424             STATE_RESET,
425             STATE_REMOVEDATASOURCE,
426             STATE_CLEANUPANDCOMPLETE
427         };
428 
429         PVTestState iState;
430 
431         PVPlayerInterface* iPlayer;
432         PVPlayerDataSourceURL* iDataSource;
433         PVPlayerDataSink* iDataSinkVideo;
434         PVPlayerDataSink* iDataSinkAudio;
435         PVPlayerDataSink* iDataSinkText;
436         PVMFNodeInterface* iIONodeVideo;
437         PVMFNodeInterface* iIONodeAudio;
438         PVMFNodeInterface* iIONodeText;
439         PvmiMIOControl* iMIOFileOutVideo;
440         PvmiMIOControl* iMIOFileOutAudio;
441         PvmiMIOControl* iMIOFileOutText;
442         PVCommandId iCurrentCmdId;
443         PVMFSourceContextData* iSourceContextData;
444 
445         OSCL_wHeapString<OsclMemAllocator> iFileNameWStr;
446         oscl_wchar iTmpWCharBuffer[512];
447 
448         int32 iDownloadMaxfilesize;
449         OSCL_wHeapString<OsclMemAllocator> iDownloadFilename;
450         OSCL_HeapString<OsclMemAllocator> iDownloadProxy;
451         OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename;
452 };
453 
454 // Structure CodecSpecificInfo stores the codecSpecificInfoIndex,
455 // metadatakeyIndex and the valueIndex and then the information is printed
456 // when track-info/type matches with codec-specific-info.
457 struct CodecSpecificInfo
458 {
459     int32 CodecSpecificInfoIndex;
460     int32 MetadataKeyIndex;
461     int32 ValueIndex;
462 };
463 
464 #endif
465 
466 
467