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 /** 65 * This function allows the application to delete an instance of a pvPlayer 66 * and reclaim all allocated resources. A player can be deleted only in 67 * the idle state. An attempt to delete a player in any other state will 68 * fail and return false. 69 * 70 * @param aPlayer The player to be deleted. 71 * 72 * @returns A status code indicating success or failure. 73 **/ 74 OSCL_IMPORT_REF static bool DeletePlayer(PVPlayerInterface* aPlayer); 75 }; 76 77 78 /** 79 * PVPlayerDataSinkFactory class is a singleton class which instantiates and provides 80 * access to player data sink. It returns an PVPlayerDataSink 81 * reference, the interface class of the player data sink. 82 * 83 **/ 84 85 class PVPlayerDataSinkFactory 86 { 87 public: 88 /** 89 * Creates an instance of a pvPlayer engine. If the creation fails, this function will leave. 90 * 91 * @param io_interface_ptr A pointer to a media io interface 92 * 93 * @returns A pointer to a player data sink or leaves if instantiation fails 94 **/ 95 96 OSCL_IMPORT_REF static PVPlayerDataSink* CreateDataSink(PvmiMIOControl* io_interface_ptr); 97 98 /** 99 * This function allows the application to delete an instance of the player data sink 100 * and reclaim all allocated resources. 101 * 102 * @param data_sink_ptr The pointer to the player data sink to be deleted 103 * 104 * @returns A status code indicating success or failure. 105 **/ 106 107 OSCL_IMPORT_REF static bool DeletePVPlayerSink(PVPlayerDataSink* data_sink_ptr); 108 }; 109 110 111 #endif // PV_PLAYER_FACTORY_H_INCLUDED 112