[vlc-commits] demux: adaptative: allow altering block after download
Francois Cartegnie
git at videolan.org
Wed Jun 10 18:58:02 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 22 15:10:38 2015 +0200| [be6bf7796f0753fa497179e38f518bfb0b69ddf7] | committer: Francois Cartegnie
demux: adaptative: allow altering block after download
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be6bf7796f0753fa497179e38f518bfb0b69ddf7
---
modules/demux/adaptative/Streams.cpp | 2 +-
modules/demux/adaptative/http/Chunk.h | 4 +++-
modules/demux/adaptative/playlist/Segment.cpp | 6 +++---
modules/demux/adaptative/playlist/Segment.h | 4 ++--
modules/demux/dash/mp4/AtomsReader.cpp | 6 +++---
modules/demux/dash/mp4/AtomsReader.hpp | 2 +-
modules/demux/dash/mpd/DASHSegment.cpp | 4 ++--
modules/demux/dash/mpd/DASHSegment.h | 2 +-
8 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index 633cc3b..1c7ff1d 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -221,7 +221,7 @@ size_t Stream::read(HTTPConnectionManager *connManager)
if (chunk->getBytesToRead() == 0)
{
- chunk->onDownload(block->p_buffer, block->i_buffer);
+ chunk->onDownload(&block);
chunk->getConnection()->releaseChunk();
currentChunk = NULL;
delete chunk;
diff --git a/modules/demux/adaptative/http/Chunk.h b/modules/demux/adaptative/http/Chunk.h
index 4f4b120..22d5315 100644
--- a/modules/demux/adaptative/http/Chunk.h
+++ b/modules/demux/adaptative/http/Chunk.h
@@ -29,6 +29,8 @@
#include <string>
#include <stdint.h>
+typedef struct block_t block_t;
+
namespace adaptative
{
namespace http
@@ -65,7 +67,7 @@ namespace adaptative
void setBitrate (uint64_t bitrate);
int getBitrate ();
- virtual void onDownload (void *, size_t) {}
+ virtual void onDownload (block_t **) {}
private:
std::string url;
diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
index 4dcb1c5..3ac04f0 100644
--- a/modules/demux/adaptative/playlist/Segment.cpp
+++ b/modules/demux/adaptative/playlist/Segment.cpp
@@ -49,7 +49,7 @@ Chunk * ISegment::getChunk(const std::string &url)
return new (std::nothrow) SegmentChunk(this, url);
}
-void ISegment::onChunkDownload(void *, size_t, Chunk *, BaseRepresentation *)
+void ISegment::onChunkDownload(block_t **, Chunk *, BaseRepresentation *)
{
}
@@ -121,9 +121,9 @@ void ISegment::SegmentChunk::setRepresentation(BaseRepresentation *rep_)
rep = rep_;
}
-void ISegment::SegmentChunk::onDownload(void *data, size_t size)
+void ISegment::SegmentChunk::onDownload(block_t **pp_block)
{
- segment->onChunkDownload(data, size, this, rep);
+ segment->onChunkDownload(pp_block, this, rep);
}
Segment::Segment(ICanonicalUrl *parent) :
diff --git a/modules/demux/adaptative/playlist/Segment.h b/modules/demux/adaptative/playlist/Segment.h
index 57426f9..9a672be 100644
--- a/modules/demux/adaptative/playlist/Segment.h
+++ b/modules/demux/adaptative/playlist/Segment.h
@@ -75,7 +75,7 @@ namespace adaptative
public:
SegmentChunk(ISegment *segment, const std::string &url);
void setRepresentation(BaseRepresentation *);
- virtual void onDownload(void *, size_t); // reimpl
+ virtual void onDownload(block_t **); // reimpl
protected:
ISegment *segment;
@@ -83,7 +83,7 @@ namespace adaptative
};
virtual Chunk * getChunk(const std::string &);
- virtual void onChunkDownload(void *, size_t, Chunk *, BaseRepresentation *);
+ virtual void onChunkDownload(block_t **, Chunk *, BaseRepresentation *);
};
class Segment : public ISegment
diff --git a/modules/demux/dash/mp4/AtomsReader.cpp b/modules/demux/dash/mp4/AtomsReader.cpp
index c7e42d3..173d85f 100644
--- a/modules/demux/dash/mp4/AtomsReader.cpp
+++ b/modules/demux/dash/mp4/AtomsReader.cpp
@@ -41,12 +41,12 @@ AtomsReader::~AtomsReader()
delete rootbox;
}
-bool AtomsReader::parseBlock(void *buffer, size_t size, BaseRepresentation *rep)
+bool AtomsReader::parseBlock(block_t *p_block, BaseRepresentation *rep)
{
if(!rep)
return false;
- stream_t *stream = stream_MemoryNew( object, (uint8_t *)buffer, size, true);
+ stream_t *stream = stream_MemoryNew( object, p_block->p_buffer, p_block->i_buffer, true);
if (stream)
{
rootbox = new MP4_Box_t;
@@ -57,7 +57,7 @@ bool AtomsReader::parseBlock(void *buffer, size_t size, BaseRepresentation *rep)
}
memset(rootbox, 0, sizeof(*rootbox));
rootbox->i_type = ATOM_root;
- rootbox->i_size = size;
+ rootbox->i_size = p_block->i_buffer;
if ( MP4_ReadBoxContainerChildren( stream, rootbox, 0 ) == 1 )
{
#ifndef NDEBUG
diff --git a/modules/demux/dash/mp4/AtomsReader.hpp b/modules/demux/dash/mp4/AtomsReader.hpp
index 285aadf..ed04ffb 100644
--- a/modules/demux/dash/mp4/AtomsReader.hpp
+++ b/modules/demux/dash/mp4/AtomsReader.hpp
@@ -49,7 +49,7 @@ namespace dash
public:
AtomsReader(vlc_object_t *);
~AtomsReader();
- bool parseBlock(void *, size_t, adaptative::playlist::BaseRepresentation *);
+ bool parseBlock(block_t *, adaptative::playlist::BaseRepresentation *);
protected:
vlc_object_t *object;
diff --git a/modules/demux/dash/mpd/DASHSegment.cpp b/modules/demux/dash/mpd/DASHSegment.cpp
index 6422fb4..71f517b 100644
--- a/modules/demux/dash/mpd/DASHSegment.cpp
+++ b/modules/demux/dash/mpd/DASHSegment.cpp
@@ -49,11 +49,11 @@ Chunk* DashIndexSegment::toChunk(size_t index, BaseRepresentation *ctxrep)
return chunk;
}
-void DashIndexSegment::onChunkDownload(void *data, size_t size, Chunk *, BaseRepresentation *rep)
+void DashIndexSegment::onChunkDownload(block_t **pp_block, Chunk *, BaseRepresentation *rep)
{
if(!rep)
return;
AtomsReader br(rep->getPlaylist()->getVLCObject());
- br.parseBlock(data, size, rep);
+ br.parseBlock(*pp_block, rep);
}
diff --git a/modules/demux/dash/mpd/DASHSegment.h b/modules/demux/dash/mpd/DASHSegment.h
index 4d106e1..4edeb36 100644
--- a/modules/demux/dash/mpd/DASHSegment.h
+++ b/modules/demux/dash/mpd/DASHSegment.h
@@ -41,7 +41,7 @@ namespace dash
virtual Chunk* toChunk(size_t, BaseRepresentation * = NULL); //reimpl
protected:
- virtual void onChunkDownload(void *, size_t, Chunk *, BaseRepresentation *); //reimpl
+ virtual void onChunkDownload(block_t **, Chunk *, BaseRepresentation *); //reimpl
};
}
More information about the vlc-commits
mailing list