EMIPLIB

miprtpcomponent.h

Go to the documentation of this file.
00001 /*
00002     
00003   This file is a part of EMIPLIB, the EDM Media over IP Library.
00004   
00005   Copyright (C) 2006-2011  Hasselt University - Expertise Centre for
00006                       Digital Media (EDM) (http://www.edm.uhasselt.be)
00007 
00008   This library is free software; you can redistribute it and/or
00009   modify it under the terms of the GNU Lesser General Public
00010   License as published by the Free Software Foundation; either
00011   version 2.1 of the License, or (at your option) any later version.
00012 
00013   This library is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016   Lesser General Public License for more details.
00017 
00018   You should have received a copy of the GNU Lesser General Public
00019   License along with this library; if not, write to the Free Software
00020   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
00021   USA
00022 
00023 */
00024 
00029 #ifndef MIPRTPCOMPONENT_H
00030 
00031 #define MIPRTPCOMPONENT_H
00032 
00033 #include "mipconfig.h"
00034 #include "mipcomponent.h"
00035 #include <list>
00036 
00037 class MIPRTPReceiveMessage;
00038 
00039 namespace jrtplib
00040 {
00041         class RTPSession;
00042         class RTPSourceData;
00043         class RTPPacket;
00044 }
00045 
00053 class EMIPLIB_IMPORTEXPORT MIPRTPComponent : public MIPComponent
00054 {
00055 public:
00056         MIPRTPComponent();
00057         ~MIPRTPComponent();
00058 
00068         bool init(jrtplib::RTPSession *pSess, uint32_t silentTimestampIncrement = 0);
00069 
00071         bool destroy();
00072 
00074         void setSilentSampleIncrement(uint32_t silentTimestampIncrement)                                        { m_silentTimestampIncrease = silentTimestampIncrement; }
00075 
00077         void setEnableSending(bool f)                                                                           { m_enableSending = f; }
00078 
00079         bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg);
00080         bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg);
00081 protected:
00088         virtual uint64_t getSourceID(const jrtplib::RTPPacket *pPack, const jrtplib::RTPSourceData *pSourceData) const;
00089 private:
00090         bool processNewPackets(int64_t iteration);      
00091         void clearMessages();
00092         
00093         std::list<MIPRTPReceiveMessage *> m_messages;
00094         std::list<MIPRTPReceiveMessage *>::const_iterator m_msgIt;
00095         int64_t m_prevIteration;
00096         int64_t m_prevSendIteration;
00097         jrtplib::RTPSession *m_pRTPSession;
00098         uint32_t m_silentTimestampIncrease;
00099         bool m_enableSending;
00100 };
00101 
00102 #endif // MIPRTPCOMPONENT_H