demux: adaptive: rework profile specific types for global timeline
[vlc.git] / modules / demux / adaptive / playlist / SegmentTimeline.h
blob668f7d53897cfd306c35afb9e5bf61af07dfef09
1 /*****************************************************************************
2 * SegmentTimeline.cpp: Implement the SegmentTimeline tag.
3 *****************************************************************************
4 * Copyright (C) 1998-2007 VLC authors and VideoLAN
6 * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef SEGMENTTIMELINE_H
24 #define SEGMENTTIMELINE_H
26 #include "Inheritables.hpp"
28 #include <vlc_common.h>
29 #include <list>
31 namespace adaptive
33 namespace playlist
35 class AbstractMultipleSegmentBaseType;
37 class SegmentTimeline : public TimescaleAble
39 class Element;
41 public:
42 SegmentTimeline(AbstractMultipleSegmentBaseType *);
43 SegmentTimeline(uint64_t);
44 virtual ~SegmentTimeline();
45 void addElement(uint64_t, stime_t d, uint64_t r = 0, stime_t t = 0);
46 uint64_t getElementNumberByScaledPlaybackTime(stime_t) const;
47 bool getScaledPlaybackTimeDurationBySegmentNumber(uint64_t, stime_t *, stime_t *) const;
48 stime_t getScaledPlaybackTimeByElementNumber(uint64_t) const;
49 stime_t getMinAheadScaledTime(uint64_t) const;
50 Timescale inheritTimescale() const; /* reimpl */
51 stime_t getTotalLength() const;
52 uint64_t maxElementNumber() const;
53 uint64_t minElementNumber() const;
54 uint64_t getElementIndexBySequence(uint64_t) const;
55 void pruneByPlaybackTime(vlc_tick_t);
56 size_t pruneBySequenceNumber(uint64_t);
57 void updateWith(SegmentTimeline &);
58 void debug(vlc_object_t *, int = 0) const;
60 private:
61 std::list<Element *> elements;
62 stime_t totalLength;
63 AbstractMultipleSegmentBaseType *parent;
65 class Element
67 public:
68 Element(uint64_t, stime_t, uint64_t, stime_t);
69 void debug(vlc_object_t *, int = 0) const;
70 bool contains(stime_t) const;
71 stime_t t;
72 stime_t d;
73 uint64_t r;
74 uint64_t number;
80 #endif // SEGMENTTIMELINE_H