Commit be6bf779 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: allow altering block after download

parent 4603cb4a
......@@ -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;
......
......@@ -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;
......
......@@ -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) :
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......@@ -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
};
}
......
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