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 PVMI_DATASTREAMSYNCINTERFACE_REF_IMPL_H_INCLUDED 19 #define PVMI_DATASTREAMSYNCINTERFACE_REF_IMPL_H_INCLUDED 20 21 #ifndef OSCL_TYPES_H_INCLUDED 22 #include "oscl_types.h" 23 #endif 24 #ifndef OSCL_FILE_IO_H_INCLUDED 25 #include "oscl_file_io.h" 26 #endif 27 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED 28 #include "oscl_string_containers.h" 29 #endif 30 #ifndef PVLOGGER_H_INCLUDED 31 #include "pvlogger.h" 32 #endif 33 #ifndef PVMI_DATA_STREAM_INTERFACE_H_INCLUDED 34 #include "pvmi_data_stream_interface.h" 35 #endif 36 37 class PVMIDataStreamSyncInterfaceRefImpl : public PVMIDataStreamSyncInterface 38 { 39 public: 40 OSCL_IMPORT_REF static PVMIDataStreamSyncInterface* CreateDataStreamSyncInterfaceRefImpl(OSCL_wString& aFileName); 41 OSCL_IMPORT_REF static PVMIDataStreamSyncInterface* CreateDataStreamSyncInterfaceRefImpl(OsclFileHandle* aFileHandle); 42 OSCL_IMPORT_REF static void DestroyDataStreamSyncInterfaceRefImpl(PVMIDataStreamSyncInterface* aInterface); 43 44 // From PVInterface 45 void addRef() {}; 46 47 void removeRef() {}; 48 49 OSCL_IMPORT_REF bool queryInterface(const PVUuid& uuid, 50 PVInterface*& iface); 51 52 OSCL_IMPORT_REF 53 PvmiDataStreamStatus OpenSession(PvmiDataStreamSession& aSessionID, 54 PvmiDataStreamMode aMode, 55 bool nonblocking = false); 56 57 OSCL_IMPORT_REF 58 PvmiDataStreamStatus CloseSession(PvmiDataStreamSession aSessionID); 59 60 OSCL_IMPORT_REF 61 PvmiDataStreamRandomAccessType QueryRandomAccessCapability(); 62 63 OSCL_IMPORT_REF 64 PvmiDataStreamStatus QueryReadCapacity(PvmiDataStreamSession aSessionID, 65 uint32& capacity); 66 67 OSCL_IMPORT_REF 68 PvmiDataStreamCommandId RequestReadCapacityNotification(PvmiDataStreamSession aSessionID, 69 PvmiDataStreamObserver& observer, 70 uint32 capacity, 71 OsclAny* aContextData = NULL); 72 73 OSCL_IMPORT_REF 74 PvmiDataStreamStatus QueryWriteCapacity(PvmiDataStreamSession aSessionID, 75 uint32& capacity); 76 77 OSCL_IMPORT_REF 78 PvmiDataStreamCommandId RequestWriteCapacityNotification(PvmiDataStreamSession aSessionID, 79 PvmiDataStreamObserver& observer, 80 uint32 capacity, 81 OsclAny* aContextData = NULL); 82 83 OSCL_IMPORT_REF 84 PvmiDataStreamCommandId CancelNotification(PvmiDataStreamSession aSessionID, 85 PvmiDataStreamObserver& observer, 86 PvmiDataStreamCommandId aID, 87 OsclAny* aContextData = NULL); 88 89 PvmiDataStreamStatus CancelNotificationSync(PvmiDataStreamSession aSessionID) 90 { 91 OSCL_UNUSED_ARG(aSessionID); 92 return PVDS_NOT_SUPPORTED; 93 } 94 95 OSCL_IMPORT_REF 96 PvmiDataStreamStatus Read(PvmiDataStreamSession aSessionID, 97 uint8* buffer, 98 uint32 size, 99 uint32& numelements); 100 101 OSCL_IMPORT_REF 102 PvmiDataStreamStatus Write(PvmiDataStreamSession aSessionID, 103 uint8* buffer, 104 uint32 size, 105 uint32& numelements); 106 PvmiDataStreamStatus Write(PvmiDataStreamSession aSessionID, 107 OsclRefCounterMemFrag* aFrag, 108 uint32& numelements) 109 { 110 OSCL_UNUSED_ARG(aSessionID); 111 OSCL_UNUSED_ARG(aFrag); 112 OSCL_UNUSED_ARG(numelements); 113 return PVDS_NOT_SUPPORTED; 114 } 115 116 OSCL_IMPORT_REF 117 PvmiDataStreamStatus Seek(PvmiDataStreamSession aSessionID, 118 int32 offset, 119 PvmiDataStreamSeekType origin); 120 121 OSCL_IMPORT_REF 122 uint32 GetCurrentPointerPosition(PvmiDataStreamSession aSessionID) ; 123 124 OSCL_IMPORT_REF 125 PvmiDataStreamStatus Flush(PvmiDataStreamSession aSessionID); 126 127 void SetContentLength(uint32 aContentLength) 128 { 129 OSCL_UNUSED_ARG(aContentLength); 130 } 131 132 uint32 GetContentLength() 133 { 134 return (uint32)iFileNumBytes; 135 } 136 137 uint32 QueryBufferingCapacity() 138 { 139 return 0; 140 } 141 142 PvmiDataStreamStatus SetSourceRequestObserver(PvmiDataStreamRequestObserver& aObserver) 143 { 144 OSCL_UNUSED_ARG(aObserver); 145 return PVDS_NOT_SUPPORTED; 146 } 147 148 void SourceRequestCompleted(const PVMFCmdResp& aResponse) 149 { 150 OSCL_UNUSED_ARG(aResponse); 151 } 152 153 PvmiDataStreamStatus MakePersistent(int32 aOffset, uint32 aSize) 154 { 155 OSCL_UNUSED_ARG(aOffset); 156 OSCL_UNUSED_ARG(aSize); 157 return PVDS_NOT_SUPPORTED; 158 } 159 160 161 private: 162 PVMIDataStreamSyncInterfaceRefImpl(OSCL_wString& aFileName); 163 PVMIDataStreamSyncInterfaceRefImpl(OsclFileHandle* aFileHandle); 164 virtual ~PVMIDataStreamSyncInterfaceRefImpl(); 165 166 PvmiDataStreamSession iSessionID; 167 OsclFileHandle* iFileHandle; 168 OSCL_wHeapString<OsclMemAllocator> iFileName; 169 Oscl_File *iFileObject; 170 int32 iFileNumBytes; 171 Oscl_FileServer iFs; 172 PVLogger* iLogger; 173 }; 174 175 #endif //PVMI_DATASTREAMSYNCINTERFACE_REF_IMPL_H_INCLUDED 176 177 178