Commit 752a29f3 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Adding a SegmentInfoCommon class.

This holds common property for both SegmentInfo and SegmentInfoDefault.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 580caf11
...@@ -45,6 +45,8 @@ SOURCES_stream_filter_dash = \ ...@@ -45,6 +45,8 @@ SOURCES_stream_filter_dash = \
mpd/Segment.h \ mpd/Segment.h \
mpd/SegmentInfo.cpp \ mpd/SegmentInfo.cpp \
mpd/SegmentInfo.h \ mpd/SegmentInfo.h \
mpd/SegmentInfoCommon.cpp \
mpd/SegmentInfoCommon.h \
mpd/SegmentTimeline.cpp \ mpd/SegmentTimeline.cpp \
mpd/SegmentTimeline.h \ mpd/SegmentTimeline.h \
mpd/TrickModeType.cpp \ mpd/TrickModeType.cpp \
......
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
using namespace dash::mpd; using namespace dash::mpd;
SegmentInfo::SegmentInfo() : SegmentInfo::SegmentInfo() :
initSeg( NULL ), initSeg( NULL )
duration( -1 )
{ {
} }
...@@ -43,16 +42,6 @@ SegmentInfo::~SegmentInfo () ...@@ -43,16 +42,6 @@ SegmentInfo::~SegmentInfo ()
delete(this->initSeg); 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 const std::vector<Segment*>& SegmentInfo::getSegments () const
{ {
return this->segments; return this->segments;
...@@ -63,13 +52,3 @@ void SegmentInfo::addSegment (Segment *seg) ...@@ -63,13 +52,3 @@ void SegmentInfo::addSegment (Segment *seg)
this->segments.push_back(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;
}
...@@ -30,27 +30,23 @@ ...@@ -30,27 +30,23 @@
#include <map> #include <map>
#include "mpd/Segment.h" #include "mpd/Segment.h"
#include "mpd/SegmentInfoCommon.h"
namespace dash namespace dash
{ {
namespace mpd namespace mpd
{ {
class SegmentInfo class SegmentInfo : public SegmentInfoCommon
{ {
public: public:
SegmentInfo (); SegmentInfo ();
virtual ~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; const std::vector<Segment *>& getSegments() const;
void addSegment(Segment *seg); void addSegment(Segment *seg);
private: private:
Segment *initSeg; Segment *initSeg;
time_t duration;
std::vector<Segment *> segments; std::vector<Segment *> segments;
}; };
} }
......
/*****************************************************************************
* 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 <beauze.h@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;
}
/*****************************************************************************
* 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 <beauze.h@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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment