EMIPLIB

mipmediamessage.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 MIPMEDIAMESSAGE_H
00030 
00031 #define MIPMEDIAMESSAGE_H
00032 
00033 #include "mipconfig.h"
00034 #include "mipmessage.h"
00035 #include "miptime.h"
00036 
00044 class EMIPLIB_IMPORTEXPORT MIPMediaMessage : public MIPMessage
00045 {
00046 public:
00048         enum MediumType { Audio, Video };
00049 protected:
00058         MIPMediaMessage(MediumType mType, bool isRaw, uint32_t msgSubtype) : MIPMessage(calcType(mType,isRaw),msgSubtype), m_time(0)
00059                                                                                                                 { m_sourceID = 0; }
00060 public:
00061         ~MIPMediaMessage()                                                                                      { }
00062 
00064         uint64_t getSourceID() const                                                                            { return m_sourceID; }
00065 
00067         MIPTime getTime() const                                                                                 { return m_time; }
00068 
00070         void setSourceID(uint64_t id)                                                                           { m_sourceID = id; }
00071 
00073         void setTime(MIPTime t)                                                                                 { m_time = t; }
00074 
00076         void copyMediaInfoFrom(const MIPMediaMessage &msg)                                                      { m_sourceID = msg.m_sourceID; m_time = msg.m_time; }
00077 
00079         virtual MIPMediaMessage *createCopy() const                                                             { return 0; }
00080 private:
00081         static inline uint32_t calcType(MediumType mType, bool isRaw)
00082         {
00083                 if (mType == Audio)
00084                 {
00085                         if (isRaw)
00086                                 return MIPMESSAGE_TYPE_AUDIO_RAW;
00087                         return MIPMESSAGE_TYPE_AUDIO_ENCODED;
00088                 }
00089                 if (isRaw)
00090                         return MIPMESSAGE_TYPE_VIDEO_RAW;
00091                 return MIPMESSAGE_TYPE_VIDEO_ENCODED;
00092         }
00093                         
00094         uint64_t m_sourceID;
00095         MIPTime m_time;
00096 };
00097 
00098 #endif // MIPMEDIAMESSAGE_H
00099