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 PV_PLAYER_DATASOURCEURL_H_INCLUDED 19 #define PV_PLAYER_DATASOURCEURL_H_INCLUDED 20 21 #ifndef PV_PLAYER_DATASOURCE_H_INCLUDED 22 #include "pv_player_datasource.h" 23 #endif 24 25 #ifndef OSCL_MEM_H_INCLUDED 26 #include "oscl_mem.h" 27 #endif 28 29 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED 30 #include "oscl_string_containers.h" 31 #endif 32 33 #ifndef OSCL_VECTOR_H_INCLUDED 34 #include "oscl_vector.h" 35 #endif 36 37 class PVPlayerDataSourceURL : public PVPlayerDataSource 38 { 39 public: 40 PVPlayerDataSourceURL() : iFormatType(PVMF_MIME_FORMAT_UNKNOWN), iURL(NULL), iContext(NULL) {}; 41 ~PVPlayerDataSourceURL() {}; 42 43 PVPDataSourceType GetDataSourceType() 44 { 45 return PVP_DATASRCTYPE_URL; 46 } 47 48 PVMFFormatType GetDataSourceFormatType() 49 { 50 return iFormatType; 51 } 52 53 OSCL_wString& GetDataSourceURL() 54 { 55 return iURL; 56 } 57 58 OsclAny* GetDataSourceContextData() 59 { 60 return iContext; 61 } 62 63 PVMFNodeInterface* GetDataSourceNodeInterface() 64 { 65 return NULL; 66 } 67 68 void SetDataSourceFormatType(PVMFFormatType aFormatType) 69 { 70 iFormatType = aFormatType; 71 } 72 73 void SetDataSourceURL(const OSCL_wString& aURL) 74 { 75 iURL = aURL; 76 } 77 78 void SetDataSourceContextData(const OsclAny* aContext) 79 { 80 iContext = (OsclAny*)aContext; 81 } 82 83 bool SetAlternateSourceFormatType(PVMFFormatType aFormatType) 84 { 85 int32 err; 86 OSCL_TRY(err, iAlternateFormatTypeVec.push_back(aFormatType);); 87 if (err != OsclErrNone) 88 { 89 return false; 90 } 91 return true; 92 } 93 94 uint32 GetNumAlternateSourceFormatTypes() 95 { 96 return (iAlternateFormatTypeVec.size()); 97 } 98 99 bool GetAlternateSourceFormatType(PVMFFormatType& aFormatType, 100 uint32 aIndex) 101 { 102 if (aIndex < iAlternateFormatTypeVec.size()) 103 { 104 aFormatType = iAlternateFormatTypeVec[aIndex]; 105 return true; 106 } 107 return false; 108 } 109 110 private: 111 PVMFFormatType iFormatType; 112 OSCL_wHeapString<OsclMemAllocator> iURL; 113 OsclAny* iContext; 114 Oscl_Vector<PVMFFormatType, OsclMemAllocator> iAlternateFormatTypeVec; 115 }; 116 117 #endif // PV_PLAYER_DATASOURCEURL_H_INCLUDED 118 119