vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauz...@gmail.com> | Fri Dec 30 13:08:33 2011 +0100| [bc62979e9c7148cb4391ff0c2c406103662c18a4] | committer: Jean-Baptiste Kempf
dash: Adding a SegmentInfoCommon class. This holds common property for both SegmentInfo and SegmentInfoDefault. Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> (cherry picked from commit 752a29f300592e6ebc32f7b659d2f42ea15554fb) Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> > http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=bc62979e9c7148cb4391ff0c2c406103662c18a4 --- modules/stream_filter/dash/Modules.am | 2 + modules/stream_filter/dash/mpd/SegmentInfo.cpp | 23 +----- modules/stream_filter/dash/mpd/SegmentInfo.h | 8 +-- .../stream_filter/dash/mpd/SegmentInfoCommon.cpp | 86 ++++++++++++++++++++ modules/stream_filter/dash/mpd/SegmentInfoCommon.h | 63 ++++++++++++++ 5 files changed, 154 insertions(+), 28 deletions(-) diff --git a/modules/stream_filter/dash/Modules.am b/modules/stream_filter/dash/Modules.am index cdf7feb..eea53ed 100644 --- a/modules/stream_filter/dash/Modules.am +++ b/modules/stream_filter/dash/Modules.am @@ -45,6 +45,8 @@ SOURCES_stream_filter_dash = \ mpd/Segment.h \ mpd/SegmentInfo.cpp \ mpd/SegmentInfo.h \ + mpd/SegmentInfoCommon.cpp \ + mpd/SegmentInfoCommon.h \ mpd/SegmentTimeline.cpp \ mpd/SegmentTimeline.h \ mpd/TrickModeType.cpp \ diff --git a/modules/stream_filter/dash/mpd/SegmentInfo.cpp b/modules/stream_filter/dash/mpd/SegmentInfo.cpp index 1b6ec9c..1bfec26 100644 --- a/modules/stream_filter/dash/mpd/SegmentInfo.cpp +++ b/modules/stream_filter/dash/mpd/SegmentInfo.cpp @@ -30,8 +30,7 @@ using namespace dash::mpd; SegmentInfo::SegmentInfo() : - initSeg( NULL ), - duration( -1 ) + initSeg( NULL ) { } @@ -43,16 +42,6 @@ SegmentInfo::~SegmentInfo () delete(this->initSeg); } -Segment* SegmentInfo::getInitSegment() const -{ - return this->initSeg; -} - -void SegmentInfo::setInitSegment( Segment *initSeg ) -{ - this->initSeg = initSeg; -} - const std::vector<Segment*>& SegmentInfo::getSegments () const { return this->segments; @@ -63,13 +52,3 @@ void SegmentInfo::addSegment (Segment *seg) this->segments.push_back(seg); } -time_t SegmentInfo::getDuration() const -{ - return this->duration; -} - -void SegmentInfo::setDuration( time_t duration ) -{ - if ( duration >= 0 ) - this->duration = duration; -} diff --git a/modules/stream_filter/dash/mpd/SegmentInfo.h b/modules/stream_filter/dash/mpd/SegmentInfo.h index fd778b7..c208add 100644 --- a/modules/stream_filter/dash/mpd/SegmentInfo.h +++ b/modules/stream_filter/dash/mpd/SegmentInfo.h @@ -30,27 +30,23 @@ #include <map> #include "mpd/Segment.h" +#include "mpd/SegmentInfoCommon.h" namespace dash { namespace mpd { - class SegmentInfo + class SegmentInfo : public SegmentInfoCommon { public: SegmentInfo (); virtual ~SegmentInfo (); - Segment* getInitSegment() const; - void setInitSegment( Segment *seg ); - time_t getDuration() const; - void setDuration( time_t duration ); const std::vector<Segment *>& getSegments() const; void addSegment(Segment *seg); private: Segment *initSeg; - time_t duration; std::vector<Segment *> segments; }; } diff --git a/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp b/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp new file mode 100644 index 0000000..0d7c26b --- /dev/null +++ b/modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp @@ -0,0 +1,86 @@ +/***************************************************************************** + * SegmentInfoCommon.cpp: Implement the common part for both SegmentInfoDefault + * and SegmentInfo + ***************************************************************************** + * Copyright (C) 1998-2007 VLC authors and VideoLAN + * $Id$ + * + * Authors: Hugo Beauzée-Luyssen <beauz...@gmail.com> + * + * 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. + *****************************************************************************/ + +#include "SegmentInfoCommon.h" + +using namespace dash::mpd; + +SegmentInfoCommon::SegmentInfoCommon() : + duration( -1 ) +{ +} + +time_t SegmentInfoCommon::getDuration() const +{ + return this->duration; +} + +void SegmentInfoCommon::setDuration( time_t duration ) +{ + if ( duration >= 0 ) + this->duration = duration; +} + +int SegmentInfoCommon::getStartIndex() const +{ + return this->startIndex; +} + +void SegmentInfoCommon::setStartIndex(int startIndex) +{ + if ( startIndex >= 0 ) + this->startIndex = startIndex; +} + +const Segment* SegmentInfoCommon::getInitialisationSegment() const +{ + return this->initialisationSegment; +} + +void SegmentInfoCommon::setInitialisationSegment(const Segment *seg) +{ + if ( seg != NULL ) + this->initialisationSegment = seg; +} + +const std::list<std::string>& SegmentInfoCommon::getBaseURL() const +{ + return this->baseURLs; +} + +void SegmentInfoCommon::appendBaseURL(const std::string &url) +{ + this->baseURLs.push_back( url ); +} + +const SegmentTimeline *SegmentInfoCommon::getSegmentTimeline() const +{ + return this->segmentTimeline; +} + +void SegmentInfoCommon::setSegmentTimeline( const SegmentTimeline *segTl ) +{ + if ( segTl != NULL ) + this->segmentTimeline = segTl; +} diff --git a/modules/stream_filter/dash/mpd/SegmentInfoCommon.h b/modules/stream_filter/dash/mpd/SegmentInfoCommon.h new file mode 100644 index 0000000..654ebfc --- /dev/null +++ b/modules/stream_filter/dash/mpd/SegmentInfoCommon.h @@ -0,0 +1,63 @@ +/***************************************************************************** + * SegmentInfoCommon.h: Implement the common part for both SegmentInfoDefault + * and SegmentInfo + ***************************************************************************** + * Copyright (C) 1998-2007 VLC authors and VideoLAN + * $Id$ + * + * Authors: Hugo Beauzée-Luyssen <beauz...@gmail.com> + * + * 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 SEGMENTINFOCOMMON_H +#define SEGMENTINFOCOMMON_H + +#include <string> +#include <list> + +namespace dash +{ + namespace mpd + { + class Segment; + class SegmentTimeline; + + class SegmentInfoCommon + { + public: + SegmentInfoCommon(); + time_t getDuration() const; + void setDuration( time_t duration ); + int getStartIndex() const; + void setStartIndex( int startIndex ); + const Segment* getInitialisationSegment() const; + void setInitialisationSegment( const Segment* seg ); + const std::list<std::string>& getBaseURL() const; + void appendBaseURL( const std::string& url ); + const SegmentTimeline* getSegmentTimeline() const; + void setSegmentTimeline( const SegmentTimeline *segTl ); + + private: + time_t duration; + int startIndex; + const Segment* initialisationSegment; + std::list<std::string> baseURLs; + const SegmentTimeline* segmentTimeline; + }; + } +} + +#endif // SEGMENTINFOCOMMON_H _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org http://mailman.videolan.org/listinfo/vlc-commits