[vlc-commits] dash: Adding an helper to compute a segment size
Hugo Beauzée-Luyssen
git at videolan.org
Thu Feb 2 14:40:24 CET 2012
vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Jan 26 18:21:41 2012 +0100| [52e96be7d65ba037af9d10ed3c3d8e9789869e12] | committer: Hugo Beauzée-Luyssen
dash: Adding an helper to compute a segment size
Conflicts:
modules/stream_filter/dash/mpd/Segment.h
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=52e96be7d65ba037af9d10ed3c3d8e9789869e12
---
modules/stream_filter/dash/mpd/Segment.cpp | 13 +++++++++++++
modules/stream_filter/dash/mpd/Segment.h | 2 ++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
index 25a3493..bc77d67 100644
--- a/modules/stream_filter/dash/mpd/Segment.cpp
+++ b/modules/stream_filter/dash/mpd/Segment.cpp
@@ -26,6 +26,9 @@
#endif
#include "Segment.h"
+#include "Representation.h"
+
+#include <cassert>
using namespace dash::mpd;
using namespace dash::http;
@@ -35,6 +38,11 @@ Segment::Segment(const Representation *parent) :
endByte (-1),
parentRepresentation( parent )
{
+ assert( parent != NULL );
+ if ( parent->getSegmentInfo() != NULL && parent->getSegmentInfo()->getDuration() >= 0 )
+ this->size = parent->getBandwidth() * parent->getSegmentInfo()->getDuration();
+ else
+ this->size = -1;
}
std::string Segment::getSourceUrl () const
@@ -112,3 +120,8 @@ const Representation *Segment::getParentRepresentation() const
{
return this->parentRepresentation;
}
+
+int Segment::getSize() const
+{
+ return this->size;
+}
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
index c79c6fb..bc47941 100644
--- a/modules/stream_filter/dash/mpd/Segment.h
+++ b/modules/stream_filter/dash/mpd/Segment.h
@@ -57,6 +57,7 @@ namespace dash
virtual int getEndByte () const;
virtual dash::http::Chunk* toChunk ();
const Representation* getParentRepresentation() const;
+ virtual int getSize() const;
protected:
std::string sourceUrl;
@@ -64,6 +65,7 @@ namespace dash
int startByte;
int endByte;
const Representation* parentRepresentation;
+ int size;
};
}
}
More information about the vlc-commits
mailing list