RTP Trace System  1.0
tdtfreader.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 // #### TDTF Reader                                                      ####
00011 // ####                                                                  ####
00012 // #### Version 1.00  --  February 19, 2001                              ####
00013 // ####                                                                  ####
00014 // #### Copyright (C) 2000/2001 Thomas Dreibholz                         ####
00015 // #### University of Bonn, Department of Computer Science IV            ####
00016 // #### EMail: dreibh@iem.uni-due.de                                     ####
00017 // #### WWW:   https://www.uni-due.de/~be0001/diplom/index.html          ####
00018 // ####                                                                  ####
00019 // ##########################################################################
00020 
00021 
00022 #ifndef TDTF_READER
00023 #define TDTF_READER
00024 
00025 
00026 #include "system.h"
00027 #include "tdtf.h"
00028 #include "synchronizable.h"
00029 
00030 
00031 #include <multimap.h>
00032 
00033 
00034 namespace Coral {
00035 
00036 
00045 class TDTFReader
00046 {
00047    // ====== Constructor/Destructor =========================================
00048    public:
00052    TDTFReader();
00053 
00057    virtual ~TDTFReader();
00058 
00059 
00060    // ====== Open/close TDTF trace file =====================================
00068    virtual bool open(const char* name, const bool readWrite = false);
00069 
00073    virtual void close();
00074 
00080    inline bool hasResourceUtilizationLists() const;
00081 
00089    inline card16 getMediaType() const;
00090 
00096    inline card16 getMediaSubtype() const;
00097 
00098 
00099    // ====== Frame rate methods =============================================
00106    bool isValidFrameRate(const double frameRate) const;
00107 
00114    double getNearestValidFrameRate(const double frameRate) const;
00115 
00121    inline double getMinFrameRate() const;
00122 
00128    inline double getMaxFrameRate() const;
00129 
00130 
00137    double getNextFrameRateForRate(const double frameRate) const;
00138 
00145    double getPrevFrameRateForRate(const double frameRate) const;
00146 
00147 
00148    // ====== Frame size methods =============================================
00158     cardinal getMaxByteCountForDelay(const card64   rtpPosition,
00159                                      const cardinal layer,
00160                                      const double   frameRate,
00161                                      const cardinal delay) const;
00162 
00172     cardinal getMaxFrameCountForDelay(const card64   rtpPosition,
00173                                       const cardinal layer,
00174                                       const double   frameRate,
00175                                       const cardinal delay) const;
00176 
00186    inline cardinal getPayloadFrameSizeForDelay(
00187                       const card64   rtpPosition,
00188                       const cardinal layer,
00189                       const double   frameRate,
00190                       const cardinal bufferDelay) const;
00191 
00200    cardinal getTraceFrameSize(const card64   rtpPosition,
00201                               const cardinal layer,
00202                               const double   frameRate) const;
00203 
00212    cardinal getTraceFrameID(const card64   rtpPosition,
00213                             const cardinal layer,
00214                             const double   frameRate) const;
00215 
00224    double getLayerScalability(const card64   rtpPosition,
00225                               const cardinal layer,
00226                               const double   frameRate) const;
00227 
00236    cardinal getLayerFlags(const card64   rtpPosition,
00237                           const cardinal layer,
00238                           const double   frameRate) const;
00239 
00246    cardinal getFrames(const double frameRate) const;
00247 
00254    cardinal getLayers(const double frameRate) const;
00255 
00256 
00257    // ====== Buffer delay methods ===========================================
00265    cardinal getMaxBufferDelay(const card64 rtpPosition,
00266                               const double frameRate) const;
00267 
00268 
00269    // ====== TDTF trace file access =========================================
00278    bool checkAccess(const cardinal position, const cardinal length) const;
00279 
00285    const TDTFPrefix* TDTFReader::getTDTFPrefix() const;
00286 
00292    const TDTFSuffix* TDTFReader::getTDTFSuffix() const;
00293 
00300    const MainIndexEntry* getMainIndexEntry(const double frameRate) const;
00301 
00308    const TraceHeader* getTraceHeader(const double frameRate) const;
00309 
00316    const PositionLengthIntervalIndexHeader* getIPLIHeader(
00317                                                const double frameRate) const;
00318 
00326    const IntervalHeader* getIntervalHeader(const cardinal position,
00327                                            const double   frameRate) const;
00328 
00337    const LayerHeader* getLayerHeader(const cardinal position,
00338                                      const cardinal layer,
00339                                      const double   frameRate) const;
00340 
00351    const EmpiricalEnvelope* getEmpiricalEnvelope(const cardinal position,
00352                                                  const cardinal layer,
00353                                                  const double   frameRate,
00354                                                  const bool     frameCount = false) const;
00355 
00356 
00357    // ====== Resource/utilization methods ===================================
00364    const ResourceUtilizationHeader* getResourceUtilizationHeader(
00365                                        const cardinal position,
00366                                        const double   frameRate) const;
00367 
00377    const UtilizationHeader* getFrameSizeUtilizationHeader(
00378                                const cardinal position,
00379                                const cardinal layer,
00380                                const double   frameRate) const;
00381 
00394    const UtilizationHeader* getFrameRateUtilizationHeader(
00395                                const cardinal position,
00396                                const double   frameRate) const;
00397 
00398 
00399    // ====== RTP position conversion ============================================
00407    inline cardinal positionToFramePosition(const double frameRate,
00408                                            const card64 rtpPosition) const;
00409 
00417    inline card64 framePositionToPosition(const double   frameRate,
00418                                          const cardinal framePosition) const;
00419 
00420 
00421    // ====== Printing methods ===============================================
00432    void printEmpiricalEnvelope(ostream&       os,
00433                                const cardinal position,
00434                                const double   frameRate,
00435                                const bool     frameCount,
00436                                const bool     compact) const;
00437 
00448    void print(ostream&     os,
00449               const double frameRate,
00450               const bool   printEE,
00451               const bool   compactEE,
00452               const bool   printRUL,
00453               const bool   printUC) const;
00454 
00455 
00456    // ====== Protected data =================================================
00457    public:
00458    struct MediaCacheEntry {
00459       int      InputFile;
00460       char*    InputMemory;
00461       cardinal InputLength;
00462       cardinal UserCount;
00463    };
00464 
00465 
00466    int                                 InputFile;
00467    char*                               InputMemory;
00468    cardinal                            InputLength;
00469    MediaCacheEntry*                    InputEntry;
00470 
00471 
00472    // ====== Protected data =================================================
00473    protected:
00474    MainIndexHeader*                    MainIndex;
00475    cardinal                            MainIndexEntries;
00476 
00477    ResourceUtilizationListIndexHeader* RULIndex;
00478    cardinal                            RULIndexEntries;
00479 
00480    double                              MinFrameRate;
00481    double                              MaxFrameRate;
00482    card16                              MediaType;
00483    card16                              MediaSubtype;
00484 
00485 
00486    // ====== Private data ===================================================
00487    private:
00488    static multimap<const String,MediaCacheEntry*> MediaCache;
00489    static Synchronizable                          MediaCacheSync;
00490 };
00491 
00492 
00493 }
00494 
00495 
00496 #include "tdtfreader.icc"
00497 
00498 
00499 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines