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 SRP_PORTS_H_INCLUDED 19 #define SRP_PORTS_H_INCLUDED 20 21 #ifndef OSCL_MEM_H_INCLUDED 22 #include "oscl_mem.h" 23 #endif 24 25 #ifndef PVMF_PORT_BASE_IMPL_H_INCLUDED 26 #include "pvmf_port_base_impl.h" 27 #endif 28 29 #ifndef SRP_H 30 #include "srp.h" 31 #endif 32 33 #include "media_packet.h" 34 35 class SRPLowerLayerPortOut : public PvmfPortBaseImpl 36 { 37 // All requests are synchronous 38 public: SRPLowerLayerPortOut()39 SRPLowerLayerPortOut() : PvmfPortBaseImpl(SRP_OUTPUT_PORT_TAG, NULL) {}; 40 ~SRPLowerLayerPortOut()41 ~SRPLowerLayerPortOut() {} 42 }; 43 44 class SRPLowerLayerPortIn : public PvmfPortBaseImpl 45 { 46 // All requests are synchronous 47 public: SRPLowerLayerPortIn(SRP * aSrp)48 SRPLowerLayerPortIn(SRP *aSrp) : PvmfPortBaseImpl(SRP_INPUT_PORT_TAG, NULL), 49 iSrp(aSrp) 50 {}; 51 ~SRPLowerLayerPortIn()52 ~SRPLowerLayerPortIn() {}; 53 Receive(PVMFSharedMediaMsgPtr aMsg)54 virtual PVMFStatus Receive(PVMFSharedMediaMsgPtr aMsg) 55 { 56 PVMFSharedMediaDataPtr mediaData; 57 convertToPVMFMediaData(mediaData, aMsg); 58 59 // send packet to SRP 60 iSrp->LowerLayerRx(mediaData); 61 62 return PVMFSuccess; 63 } 64 65 private: 66 SRP *iSrp; 67 }; 68 69 class SRPUpperLayerPortOut : public PvmfPortBaseImpl 70 { 71 // All requests are synchronous 72 public: SRPUpperLayerPortOut()73 SRPUpperLayerPortOut() : PvmfPortBaseImpl(SRP_OUTPUT_PORT_TAG, NULL) {}; 74 ~SRPUpperLayerPortOut()75 ~SRPUpperLayerPortOut() {} 76 }; 77 78 class SRPUpperLayerPortIn : public PvmfPortBaseImpl 79 { 80 // All requests are synchronous 81 public: SRPUpperLayerPortIn(SRP * aSrp)82 SRPUpperLayerPortIn(SRP *aSrp) : PvmfPortBaseImpl(SRP_INPUT_PORT_TAG, NULL), 83 iSrp(aSrp) 84 {}; 85 ~SRPUpperLayerPortIn()86 ~SRPUpperLayerPortIn() {}; 87 Receive(PVMFSharedMediaMsgPtr aMsg)88 virtual PVMFStatus Receive(PVMFSharedMediaMsgPtr aMsg) 89 { 90 PVMFSharedMediaDataPtr mediaData; 91 convertToPVMFMediaData(mediaData, aMsg); 92 93 // send packet to SRP 94 iSrp->UpperLayerRx(mediaData); 95 96 return PVMFSuccess; 97 } 98 99 private: 100 SRP *iSrp; 101 }; 102 103 #endif 104