1 /*****************************************************************************
2 * SegmentInfoCommon.cpp: Implement the common part for both SegmentInfoDefault
4 *****************************************************************************
5 * Copyright (C) 1998-2007 VLC authors and VideoLAN
8 * Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
29 #include "SegmentInfoCommon.h"
32 #include "SegmentTimeline.h"
34 using namespace dash::mpd;
36 Timelineable::Timelineable()
38 segmentTimeline.Set(NULL);
41 Timelineable::~Timelineable()
43 delete segmentTimeline.Get();
46 SegmentInfoCommon::SegmentInfoCommon( ICanonicalUrl *parent ) :
47 ICanonicalUrl( parent ), Initializable(),
53 SegmentInfoCommon::~SegmentInfoCommon()
57 time_t SegmentInfoCommon::getDuration() const
59 return this->duration;
62 void SegmentInfoCommon::setDuration( time_t duration )
65 this->duration = duration;
68 int SegmentInfoCommon::getStartIndex() const
70 return this->startIndex;
73 void SegmentInfoCommon::setStartIndex(int startIndex)
75 if ( startIndex >= 0 )
76 this->startIndex = startIndex;
79 void SegmentInfoCommon::appendBaseURL(const std::string &url)
81 this->baseURLs.push_back( url );
84 Url SegmentInfoCommon::getUrlSegment() const
86 Url ret = getParentUrlSegment();
87 if (!baseURLs.empty())
88 ret.append(baseURLs.front());