[vlc-commits] demux: adaptive: force representation in segmentchunks
Francois Cartegnie
git at videolan.org
Fri Jun 10 17:16:13 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 1 11:22:48 2016 +0200| [de1cde08da71c6fa1f8f1dff75eeccf9dcc2b232] | committer: Francois Cartegnie
demux: adaptive: force representation in segmentchunks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de1cde08da71c6fa1f8f1dff75eeccf9dcc2b232
---
modules/demux/adaptive/playlist/Segment.cpp | 8 +++-----
modules/demux/adaptive/playlist/Segment.h | 2 +-
modules/demux/adaptive/playlist/SegmentChunk.cpp | 10 +++-------
modules/demux/adaptive/playlist/SegmentChunk.hpp | 3 +--
modules/demux/smooth/playlist/ForgedInitSegment.cpp | 4 ++--
modules/demux/smooth/playlist/ForgedInitSegment.hpp | 2 +-
6 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp
index f8ecfab..d9e77f4 100644
--- a/modules/demux/adaptive/playlist/Segment.cpp
+++ b/modules/demux/adaptive/playlist/Segment.cpp
@@ -61,13 +61,13 @@ ISegment::~ISegment()
assert(chunksuse.Get() == 0);
}
-SegmentChunk * ISegment::getChunk(const std::string &url, HTTPConnectionManager *connManager)
+SegmentChunk * ISegment::getChunk(const std::string &url, BaseRepresentation *rep, HTTPConnectionManager *connManager)
{
HTTPChunkBufferedSource *source = new HTTPChunkBufferedSource(url, connManager);
if(startByte != endByte)
source->setBytesRange(BytesRange(startByte, endByte));
connManager->downloader->schedule(source);
- return new (std::nothrow) SegmentChunk(this, source);
+ return new (std::nothrow) SegmentChunk(this, source, rep);
}
void ISegment::onChunkDownload(block_t **, SegmentChunk *, BaseRepresentation *)
@@ -80,7 +80,7 @@ SegmentChunk* ISegment::toChunk(size_t index, BaseRepresentation *ctxrep, HTTPCo
SegmentChunk *chunk;
try
{
- chunk = getChunk(getUrlSegment().toString(index, ctxrep), connManager);
+ chunk = getChunk(getUrlSegment().toString(index, ctxrep), ctxrep, connManager);
if (!chunk)
return NULL;
}
@@ -89,8 +89,6 @@ SegmentChunk* ISegment::toChunk(size_t index, BaseRepresentation *ctxrep, HTTPCo
return NULL;
};
- chunk->setRepresentation(ctxrep);
-
return chunk;
}
diff --git a/modules/demux/adaptive/playlist/Segment.h b/modules/demux/adaptive/playlist/Segment.h
index 7e28578..7d0b0da 100644
--- a/modules/demux/adaptive/playlist/Segment.h
+++ b/modules/demux/adaptive/playlist/Segment.h
@@ -89,7 +89,7 @@ namespace adaptive
static const int SEQUENCE_INVALID;
static const int SEQUENCE_FIRST;
- virtual SegmentChunk * getChunk(const std::string &, HTTPConnectionManager *);
+ virtual SegmentChunk * getChunk(const std::string &, BaseRepresentation *, HTTPConnectionManager *);
};
class Segment : public ISegment
diff --git a/modules/demux/adaptive/playlist/SegmentChunk.cpp b/modules/demux/adaptive/playlist/SegmentChunk.cpp
index b3989d0..4616e86 100644
--- a/modules/demux/adaptive/playlist/SegmentChunk.cpp
+++ b/modules/demux/adaptive/playlist/SegmentChunk.cpp
@@ -29,12 +29,13 @@
using namespace adaptive::playlist;
using namespace adaptive;
-SegmentChunk::SegmentChunk(ISegment *segment_, AbstractChunkSource *source) :
+SegmentChunk::SegmentChunk(ISegment *segment_, AbstractChunkSource *source,
+ BaseRepresentation *rep_) :
AbstractChunk(source)
{
segment = segment_;
segment->chunksuse.Set(segment->chunksuse.Get() + 1);
- rep = NULL;
+ rep = rep_;
discontinuity = segment_->discontinuity;
}
@@ -44,11 +45,6 @@ SegmentChunk::~SegmentChunk()
segment->chunksuse.Set(segment->chunksuse.Get() - 1);
}
-void SegmentChunk::setRepresentation(BaseRepresentation *rep_)
-{
- rep = rep_;
-}
-
void SegmentChunk::onDownload(block_t **pp_block)
{
segment->onChunkDownload(pp_block, this, rep);
diff --git a/modules/demux/adaptive/playlist/SegmentChunk.hpp b/modules/demux/adaptive/playlist/SegmentChunk.hpp
index 81afb13..0d8906e 100644
--- a/modules/demux/adaptive/playlist/SegmentChunk.hpp
+++ b/modules/demux/adaptive/playlist/SegmentChunk.hpp
@@ -38,9 +38,8 @@ namespace adaptive
class SegmentChunk : public AbstractChunk
{
public:
- SegmentChunk(ISegment *segment, AbstractChunkSource *);
+ SegmentChunk(ISegment *segment, AbstractChunkSource *, BaseRepresentation *);
virtual ~SegmentChunk();
- void setRepresentation(BaseRepresentation *);
virtual void onDownload(block_t **); // reimpl
StreamFormat getStreamFormat() const;
bool discontinuity;
diff --git a/modules/demux/smooth/playlist/ForgedInitSegment.cpp b/modules/demux/smooth/playlist/ForgedInitSegment.cpp
index f1a8283..0f12ede 100644
--- a/modules/demux/smooth/playlist/ForgedInitSegment.cpp
+++ b/modules/demux/smooth/playlist/ForgedInitSegment.cpp
@@ -299,13 +299,13 @@ block_t * ForgedInitSegment::buildMoovBox()
return moov;
}
-SegmentChunk * ForgedInitSegment::getChunk(const std::string &, HTTPConnectionManager *)
+SegmentChunk * ForgedInitSegment::getChunk(const std::string &, BaseRepresentation *rep, HTTPConnectionManager *)
{
block_t *moov = buildMoovBox();
if(moov)
{
MemoryChunkSource *source = new (std::nothrow) MemoryChunkSource(moov);
- return new (std::nothrow) SegmentChunk(this, source);
+ return new (std::nothrow) SegmentChunk(this, source, rep);
}
return NULL;
diff --git a/modules/demux/smooth/playlist/ForgedInitSegment.hpp b/modules/demux/smooth/playlist/ForgedInitSegment.hpp
index 63ecca3..4590ed1 100644
--- a/modules/demux/smooth/playlist/ForgedInitSegment.hpp
+++ b/modules/demux/smooth/playlist/ForgedInitSegment.hpp
@@ -52,7 +52,7 @@ namespace smooth
void setLanguage(const std::string &);
protected:
- virtual SegmentChunk * getChunk(const std::string &, HTTPConnectionManager *); /* reimpl */
+ virtual SegmentChunk * getChunk(const std::string &, BaseRepresentation *, HTTPConnectionManager *); /* reimpl */
private:
void fromWaveFormatEx(const uint8_t *p_data, size_t i_data);
More information about the vlc-commits
mailing list