RTP Audio System  2.0.0
abstractlayerdescription.h
Go to the documentation of this file.
00001 // ##########################################################################
00002 // ####                                                                  ####
00003 // ####                   Master Thesis Implementation                   ####
00004 // ####  Management of Layered Variable Bitrate Multimedia Streams over  ####
00005 // ####                 DiffServ with A Priori Knowledge                 ####
00006 // ####                                                                  ####
00007 // #### ================================================================ ####
00008 // ####                                                                  ####
00009 // ####                                                                  ####
00010 // #### Abstract Layer Description Inlines                               ####
00011 // ####                                                                  ####
00012 // ####           Copyright (C) 1999-2012 by Thomas Dreibholz            ####
00013 // ####                                                                  ####
00014 // #### Contact:                                                         ####
00015 // ####    EMail: dreibh@iem.uni-due.de                                  ####
00016 // ####    WWW:   https://www.nntb.no/~dreibh/rtpaudio                ####
00017 // ####                                                                  ####
00018 // #### ---------------------------------------------------------------- ####
00019 // ####                                                                  ####
00020 // #### This program is free software: you can redistribute it and/or    ####
00021 // #### modify it under the terms of the GNU General Public License as   ####
00022 // #### published by the Free Software Foundation, either version 3 of   ####
00023 // #### the License, or (at your option) any later version.              ####
00024 // ####                                                                  ####
00025 // #### This program is distributed in the hope that it will be useful,  ####
00026 // #### but WITHOUT ANY WARRANTY; without even the implied warranty of   ####
00027 // #### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    ####
00028 // #### GNU General Public License for more details.                     ####
00029 // ####                                                                  ####
00030 // #### You should have received a copy of the GNU General Public        ####
00031 // #### License along with this program.  If not, see                    ####
00032 // #### <http://www.gnu.org/licenses/>.                                  ####
00033 // ####                                                                  ####
00034 // ##########################################################################
00035 // $Id: abstractlayerdescription.h 1308 2011-12-22 07:43:26Z dreibh $
00036 
00037 
00038 #ifndef ABSTRACTLAYERDESCRIPTION_H
00039 #define ABSTRACTLAYERDESCRIPTION_H
00040 
00041 
00042 #include "tdsystem.h"
00043 #include "framesizescalabilityinterface.h"
00044 #include "internetflow.h"
00045 
00046 
00057 class AbstractLayerDescription : virtual public FrameSizeScalabilityInterface
00058 {
00059    // ====== Constructor/Destructor =========================================
00060    public:
00064    AbstractLayerDescription();
00065 
00069    virtual ~AbstractLayerDescription();
00070 
00081    inline void initLayer(const cardinal pktHeaderSize,
00082                          const cardinal pktMaxSize,
00083                          const double   maxTransferDelay,
00084                          const cardinal maxBufferDelay,
00085                          const double   maxLossRate,
00086                          const double   maxJitter,
00087                          const cardinal flags);
00088 
00089 
00090    // ====== Bandwidth and bandwidth quality methods ========================
00096    inline card64 getBandwidth() const;
00097 
00105    inline bool setBandwidth(const double frameRate,
00106                             const card64 bandwidth);
00107 
00114    virtual cardinal getPacketRate(const double frameRate) const;
00115 
00123    static inline card64 frameSizeToBandwidth(const double   frameRate,
00124                                              const cardinal frameSize);
00125 
00133    static inline cardinal bandwidthToFrameSize(const double frameRate,
00134                                                const card64 bandwidth);
00135 
00136 
00146    inline card64 bandwidthToBandwidth(const card64   bandwidth,
00147                                       const double   frameRate,
00148                                       const cardinal bufferDelay,
00149                                       const cardinal newBufferDelay) const;
00150 
00151 
00161    card64 payloadBandwidthToBandwidth(const card64   bandwidth,
00162                                       const double   frameRate,
00163                                       const cardinal bufferDelay,
00164                                       const cardinal newBufferDelay) const;
00165 
00166 
00174    virtual cardinal frameSizeToPacketRate(const double   frameRate,
00175                                           const cardinal frameSize) const;
00176 
00182    inline double getMaxTransferDelay() const;
00183 
00189    inline void setMaxTransferDelay(const double maxDelay);
00190 
00196    inline double getMaxLossRate() const;
00197 
00203    inline void setMaxLossRate(const double maxLossRate);
00204 
00210    inline double getMaxJitter() const;
00211 
00217    inline void setMaxJitter(const double maxJitter);
00218 
00219 
00220    // ====== Frame size methods =============================================
00229    inline bool isValidFrameSize(const double   frameRate,
00230                                 const cardinal bufferDelay,
00231                                 const cardinal size) const;
00232 
00241    inline cardinal getNearestValidFrameSize(const double   frameRate,
00242                                             const cardinal bufferDelay,
00243                                             const cardinal size) const;
00244 
00253    virtual cardinal payloadToRaw(const double   frameRate,
00254                                  const cardinal payload,
00255                                  const cardinal bufferDelay) const;
00256 
00265    virtual cardinal rawToPayload(const double   frameRate,
00266                                  const cardinal raw,
00267                                  const cardinal bufferDelay) const;
00268 
00269 
00270    // ====== Scaling and utilization methods, for current buffer delay ======
00277    inline cardinal getMinFrameSize(const double frameRate) const;
00278 
00285    inline cardinal getMaxFrameSize(const double frameRate) const;
00286 
00293    inline cardinal getPeakFrameSizeForSize(const double   frameRate,
00294                                            const cardinal frameSize) const;
00295 
00302    inline cardinal getPacketCountForSize(const double   frameRate,
00303                                          const cardinal frameSize) const;
00304 
00312    inline double getPrevFrameSizeForSize(const double   frameRate,
00313                                          const cardinal frameSize) const;
00314 
00322    inline double getNextFrameSizeForSize(const double   frameRate,
00323                                          const cardinal frameSize) const;
00324 
00333    inline double getFrameSizeScaleFactorForSize(const double   frameRate,
00334                                                 const cardinal frameSize) const;
00335 
00343    inline double getFrameSizeUtilizationForSize(const double   frameRate,
00344                                                 const cardinal frameSize) const;
00345 
00346 
00347    // ====== Scaling and utilization methods, for given buffer delay ========
00354    inline cardinal getMinFrameSizeForDelay(const double   frameRate,
00355                                            const cardinal bufferDelay) const;
00356 
00363    inline cardinal getMaxFrameSizeForDelay(const double   frameRate,
00364                                            const cardinal bufferDelay) const;
00365 
00372    inline cardinal getPeakFrameSizeForDelayAndSize(const double   frameRate,
00373                                                    const cardinal bufferDelay,
00374                                                    const cardinal frameSize) const;
00375 
00382    inline cardinal getPacketCountForDelayAndSize(const double   frameRate,
00383                                                  const cardinal bufferDelay,
00384                                                  const cardinal frameSize) const;
00385 
00393    inline double getPrevFrameSizeForDelayAndSize(const double   frameRate,
00394                                                  const cardinal bufferDelay,
00395                                                  const cardinal frameSize) const;
00403    inline double getNextFrameSizeForDelayAndSize(const double   frameRate,
00404                                                  const cardinal bufferDelay,
00405                                                  const cardinal frameSize) const;
00406 
00415    inline double getFrameSizeScaleFactorForDelayAndSize(const double   frameRate,
00416                                                         const cardinal bufferDelay,
00417                                                         const cardinal frameSize) const;
00418 
00426    inline double getFrameSizeUtilizationForDelayAndSize(const double   frameRate,
00427                                                         const cardinal bufferDelay,
00428                                                         const cardinal frameSize) const;
00429 
00430 
00431    // ====== Buffer delay methods ===========================================
00437    inline cardinal getBufferDelay() const;
00438 
00445    cardinal setBufferDelay(const cardinal bufferDelay);
00446 
00453    inline cardinal getPrevBufferDelay(const double frameRate) const;
00454 
00461    inline cardinal getNextBufferDelay(const double frameRate) const;
00462 
00463 
00464    // ====== Source and destination address methods =========================
00470    inline InternetAddress getSource() const;
00471 
00477    inline InternetFlow getDestination() const;
00478 
00484    inline void setSource(const InternetAddress& source);
00485 
00491    inline void setDestination(const InternetFlow& destination);
00492 
00493 
00494    // ====== Flags ==========================================================
00498    inline cardinal getFlags() const;
00499 
00503    inline void setFlags(const cardinal flags);
00504 
00508    enum LayerFlags {
00509       LF_BaseLayer      = 0,
00510       LF_ExtensionLayer = (1 << 0)
00511    };
00512 
00513 
00514    // ====== Protected data =================================================
00515    protected:
00516    cardinal        PktHeaderSize;
00517    cardinal        PktMaxSize;
00518 
00519    card64          Bandwidth;
00520 
00521    double          MaxTransferDelay;
00522    double          MaxLossRate;
00523    double          MaxJitter;
00524 
00525    cardinal        BufferDelay;
00526    cardinal        MaxBufferDelay;
00527    cardinal        Flags;
00528 
00529    InternetAddress Source;
00530    InternetFlow    Destination;
00531 };
00532 
00533 
00534 #include "abstractlayerdescription.icc"
00535 
00536 
00537 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines