Home | History | Annotate | Download | only in src
      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  * @file pvmf_protocol_engine_port.h
     20  */
     21 
     22 #ifndef PVMF_PROTOCOLENGINE_PORT_H_INCLUDED
     23 #define PVMF_PROTOCOLENGINE_PORT_H_INCLUDED
     24 
     25 #ifndef OSCL_BASE_H_INCLUDED
     26 #include "oscl_base.h"
     27 #endif
     28 #ifndef PVLOGGER_H_INCLUDED
     29 #include "pvlogger.h"
     30 #endif
     31 #ifndef PVMF_PORT_BASE_IMPL_H_INCLUDED
     32 #include "pvmf_port_base_impl.h"
     33 #endif
     34 #ifndef PVMI_CONFIG_AND_CAPABILITY_UTILS_H_INCLUDED
     35 #include "pvmi_config_and_capability_utils.h"
     36 #endif
     37 
     38 
     39 //Default vector reserve size
     40 #define PVMF_PROTOCOLENGINE_NODE_PORT_VECTOR_RESERVE 10
     41 
     42 const PVMFStatus PVMFSuccessOutgoingMsgSent = 10;
     43 
     44 
     45 class PVMFProtocolEnginePort : public PvmfPortBaseImpl,
     46         public PvmiCapabilityAndConfigPortFormatImpl
     47 {
     48     public:
     49         PVMFProtocolEnginePort(int32 aTag,
     50                                PVMFNodeInterface* aNode, const char*);
     51 
     52         PVMFProtocolEnginePort(int32 aTag,
     53                                PVMFNodeInterface* aNode,
     54                                uint32 aInCapacity,
     55                                uint32 aInReserve,
     56                                uint32 aInThreshold,
     57                                uint32 aOutCapacity,
     58                                uint32 aOutReserve,
     59                                uint32 aOutThreshold, const char*);
     60 
     61         virtual ~PVMFProtocolEnginePort();
     62 
     63         // Implement pure virtuals from PvmiCapabilityAndConfigPortFormatImpl interface
     64         bool IsFormatSupported(PVMFFormatType);
     65         void FormatUpdated();
     66 
     67         // this port supports config interface
     68         void QueryInterface(const PVUuid &aUuid, OsclAny*&aPtr)
     69         {
     70             if (aUuid == PVMI_CAPABILITY_AND_CONFIG_PVUUID)
     71             {
     72                 aPtr = (PvmiCapabilityAndConfig*)this;
     73             }
     74             else
     75             {
     76                 aPtr = NULL;
     77             }
     78         }
     79 
     80         // override the base implementation
     81         PVMFStatus QueueOutgoingMsg(PVMFSharedMediaMsgPtr aMsg);
     82 
     83         bool PeekOutgoingMsg(PVMFSharedMediaMsgPtr& aMsg);
     84 
     85     private:
     86         void Construct();
     87 
     88         PVLogger *iLogger;
     89         uint32 iNumFramesGenerated; //number of source frames generated.
     90         uint32 iNumFramesConsumed; //number of frames consumed & discarded.
     91         friend class PVMFProtocolEngineNode;
     92 };
     93 
     94 #endif // PVMF_PROTOCOLENGINE_PORT_H_INCLUDED
     95 
     96 
     97 
     98