BaseRepresentation.h 3.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * Representation.h
 *****************************************************************************
 * Copyright (C) 2010 - 2011 Klagenfurt University
 *
 * Created on: Aug 10, 2010
 * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
 *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef BASEREPRESENTATION_H_
#define BASEREPRESENTATION_H_

#include <string>
29
#include <list>
30 31 32

#include "CommonAttributesElements.h"
#include "SegmentInformation.hpp"
33
#include "../StreamFormat.hpp"
34

35
namespace adaptive
36 37 38 39 40 41 42 43 44 45 46
{
    namespace playlist
    {
        class BaseAdaptationSet;
        class AbstractPlaylist;
        class BaseSegmentTemplate;

        class BaseRepresentation : public CommonAttributesElements,
                                   public SegmentInformation
        {
            public:
47
                BaseRepresentation( BaseAdaptationSet * );
48 49
                virtual ~BaseRepresentation ();

50
                virtual StreamFormat getStreamFormat() const;
51 52 53 54 55 56
                /*
                 *  @return The bitrate required for this representation
                 *          in bits per seconds.
                 *          Will be a valid value, as the parser refuses Representation
                 *          without bandwidth.
                 */
57
                BaseAdaptationSet*  getAdaptationSet        ();
58 59
                uint64_t            getBandwidth            () const;
                void                setBandwidth            ( uint64_t bandwidth );
60 61
                const std::list<std::string> & getCodecs    () const;
                void                addCodec                (const std::string &);
62
                bool                consistentSegmentNumber () const;
63
                virtual void        pruneByPlaybackTime     (mtime_t);
64

65
                virtual mtime_t     getMinAheadTime         (uint64_t) const;
66 67 68
                virtual bool        needsUpdate             () const;
                virtual bool        runLocalUpdates         (mtime_t, uint64_t, bool);
                virtual void        scheduleNextUpdate      (uint64_t);
69

70
                virtual void        debug                   (vlc_object_t *,int = 0) const;
71 72 73 74 75

                /* for segment templates */
                virtual std::string contextualize(size_t, const std::string &,
                                                  const BaseSegmentTemplate *) const;

76 77
                static bool         bwCompare(const BaseRepresentation *a,
                                              const BaseRepresentation *b);
78
            protected:
79
                virtual bool        validateCodec(const std::string &) const;
80 81
                BaseAdaptationSet                  *adaptationSet;
                uint64_t                            bandwidth;
82
                std::list<std::string>              codecs;
83
                bool                                b_consistent;
84 85 86 87 88
        };
    }
}

#endif /* BASEREPRESENTATION_H_ */