1 /***************************************************************************** 2 * SegmentTemplate.cpp: Implement the UrlTemplate element. 3 ***************************************************************************** 4 * Copyright (C) 1998-2007 VLC authors and VideoLAN 5 * $Id: 8c808c7a854b9f8ec1be337e0bc0905ab8cc8db1 $ 6 * 7 * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr> 8 * 9 * This program is free software; you can redistribute it and/or modify it 10 * under the terms of the GNU Lesser General Public License as published by 11 * the Free Software Foundation; either version 2.1 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public License 20 * along with this program; if not, write to the Free Software Foundation, 21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 22 *****************************************************************************/ 23 24 #ifndef SEGMENTTEMPLATE_H 25 #define SEGMENTTEMPLATE_H 26 27 #include "Segment.h" 28 #include "../tools/Properties.hpp" 29 #include "SegmentInfoCommon.h" 30 31 namespace adaptive 32 { 33 namespace playlist 34 { 35 class ICanonicalUrl; 36 class InitSegmentTemplate; 37 class SegmentInformation; 38 class SegmentTimeline; 39 40 class BaseSegmentTemplate : public Segment 41 { 42 public: 43 BaseSegmentTemplate( ICanonicalUrl * = NULL ); 44 virtual ~BaseSegmentTemplate(); 45 virtual void setSourceUrl( const std::string &url ); /* reimpl */ 46 }; 47 48 class MediaSegmentTemplate : public BaseSegmentTemplate, 49 public Initializable<InitSegmentTemplate>, 50 public TimescaleAble 51 { 52 public: 53 MediaSegmentTemplate( SegmentInformation * = NULL ); 54 virtual ~MediaSegmentTemplate(); 55 void setStartNumber( uint64_t ); 56 void setSegmentTimeline( SegmentTimeline * ); 57 void updateWith( MediaSegmentTemplate * ); 58 virtual uint64_t getSequenceNumber() const; /* reimpl */ 59 uint64_t getLiveTemplateNumber(mtime_t, bool = true) const; 60 stime_t getMinAheadScaledTime(uint64_t) const; 61 void pruneByPlaybackTime(mtime_t); 62 size_t pruneBySequenceNumber(uint64_t); 63 virtual Timescale inheritTimescale() const; /* reimpl */ 64 virtual uint64_t inheritStartNumber() const; 65 stime_t inheritDuration() const; 66 SegmentTimeline * inheritSegmentTimeline() const; 67 virtual void debug(vlc_object_t *, int = 0) const; /* reimpl */ 68 69 protected: 70 uint64_t startNumber; 71 SegmentTimeline *segmentTimeline; 72 SegmentInformation *parentSegmentInformation; 73 }; 74 75 class InitSegmentTemplate : public BaseSegmentTemplate 76 { 77 public: 78 InitSegmentTemplate( ICanonicalUrl * = NULL ); 79 }; 80 } 81 } 82 #endif // SEGMENTTEMPLATE_H 83