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 /* 19 * ============================================================================== 20 * Name : pv_player_factory.h 21 * Part of : 22 * Interface : 23 * Description : Factory classes to create pvPlayer engine 24 * Version : (see RELEASE field in copyright header above) 25 * 26 * ============================================================================== 27 */ 28 29 #ifndef PV_PLAYER_FACTORY_H_INCLUDED 30 #define PV_PLAYER_FACTORY_H_INCLUDED 31 32 // Forward declaration 33 class PVPlayerInterface; 34 class PVCommandStatusObserver; 35 class PVInformationalEventObserver; 36 class PVErrorEventObserver; 37 class PVPlayerDataSink; 38 class PvmiMIOControl; 39 40 /** 41 * PVPlayerFactory class is a singleton class which instantiates and provides 42 * access to pvPlayer engine. It returns an PVPlayerInterface 43 * reference, the interface class of the pvPlayer SDK. 44 * 45 * The application is expected to contain and maintain a pointer to the 46 * PVPlayerInterface instance at all time that pvPlayer engine is active. 47 **/ 48 class PVPlayerFactory 49 { 50 public: 51 52 /** 53 * Creates an instance of a pvPlayer engine. If the creation fails, this function will leave. 54 * 55 * @param aCmdStatusObserver The observer for command status 56 * @param aErrorEventObserver The observer for unsolicited error events 57 * @param aInfoEventObserver The observer for unsolicited informational events 58 * 59 * @returns A pointer to a player or leaves if instantiation fails 60 **/ 61 OSCL_IMPORT_REF static PVPlayerInterface* CreatePlayer(PVCommandStatusObserver* aCmdStatusObserver, 62 PVErrorEventObserver *aErrorEventObserver, 63 PVInformationalEventObserver *aInfoEventObserver, 64 bool aHwAccelerated = true); 65 /** 66 * This function allows the application to delete an instance of a pvPlayer 67 * and reclaim all allocated resources. A player can be deleted only in 68 * the idle state. An attempt to delete a player in any other state will 69 * fail and return false. 70 * 71 * @param aPlayer The player to be deleted. 72 * 73 * @returns A status code indicating success or failure. 74 **/ 75 OSCL_IMPORT_REF static bool DeletePlayer(PVPlayerInterface* aPlayer); 76 }; 77 78 79 /** 80 * PVPlayerDataSinkFactory class is a singleton class which instantiates and provides 81 * access to player data sink. It returns an PVPlayerDataSink 82 * reference, the interface class of the player data sink. 83 * 84 **/ 85 86 class PVPlayerDataSinkFactory 87 { 88 public: 89 /** 90 * Creates an instance of a pvPlayer engine. If the creation fails, this function will leave. 91 * 92 * @param io_interface_ptr A pointer to a media io interface 93 * 94 * @returns A pointer to a player data sink or leaves if instantiation fails 95 **/ 96 97 OSCL_IMPORT_REF static PVPlayerDataSink* CreateDataSink(PvmiMIOControl* io_interface_ptr); 98 99 /** 100 * This function allows the application to delete an instance of the player data sink 101 * and reclaim all allocated resources. 102 * 103 * @param data_sink_ptr The pointer to the player data sink to be deleted 104 * 105 * @returns A status code indicating success or failure. 106 **/ 107 108 OSCL_IMPORT_REF static bool DeletePVPlayerSink(PVPlayerDataSink* data_sink_ptr); 109 }; 110 111 112 #endif // PV_PLAYER_FACTORY_H_INCLUDED 113