Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (11)
Showing
with 146 additions and 60 deletions
......@@ -108,6 +108,20 @@ static int ID3Callback(uint32_t, const uint8_t *, size_t, void *)
return VLC_EGENERIC;
}
static bool IsWebVTT(const char *p, size_t sz)
{
/* match optional U+FEFF BOM */
const uint8_t webvtt[] = { 0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54 };
for(int i=3; i>=0; i-=3)
{
if(sz > (size_t)(10 - i) &&
!memcmp(webvtt + i, p, 9 - i) &&
(p[9 - i] == '\n' || p[9 - i] == '\r' || p[9 - i] == ' ' || p[9 - i] == '\t'))
return true;
}
return false;
}
StreamFormat::StreamFormat(const void *data_, size_t sz)
{
const uint8_t *data = reinterpret_cast<const uint8_t *>(data_);
......@@ -120,8 +134,7 @@ StreamFormat::StreamFormat(const void *data_, size_t sz)
!memcmp(&moov[4], &data[4], 4) ||
!memcmp(&moov[8], &data[4], 4)))
type = StreamFormat::Type::MP4;
else if(sz > 7 && !memcmp("WEBVTT", data, 6) &&
std::isspace(static_cast<unsigned char>(data[7])))
else if(IsWebVTT((const char *)data, sz))
type = StreamFormat::Type::WebVTT;
else if(sz > 4 && !memcmp("\x1A\x45\xDF\xA3", data, 4))
type = StreamFormat::Type::WebM;
......
......@@ -250,14 +250,15 @@ bool AbstractStream::startDemux()
{
currentChunk = getNextChunk();
needrestart = false;
discontinuity = false;
}
demuxersource->Reset();
demuxfirstchunk = true;
demuxer = createDemux(format);
if(!demuxer && format != StreamFormat())
msg_Err(p_realdemux, "Failed to create demuxer %p %s", (void *)demuxer,
format.str().c_str());
demuxfirstchunk = true;
return !!demuxer;
}
......@@ -506,13 +507,13 @@ block_t * AbstractStream::readNextBlock()
if (currentChunk == nullptr && !eof)
currentChunk = getNextChunk();
if(discontinuity && demuxfirstchunk)
if(demuxfirstchunk)
{
/* clear up discontinuity on demux start (discontinuity on start segment bug) */
discontinuity = false;
needrestart = false;
}
if(discontinuity || needrestart)
else if(discontinuity || needrestart)
{
msg_Info(p_realdemux, "Ending demuxer stream. %s%s",
discontinuity ? "[discontinuity]" : "",
......
......@@ -81,7 +81,7 @@ AbstractChunk::AbstractChunk(AbstractChunkSource *source_)
AbstractChunk::~AbstractChunk()
{
delete source;
source->recycle();
}
std::string AbstractChunk::getContentType() const
......@@ -247,6 +247,11 @@ block_t * HTTPChunkSource::read(size_t readsize)
return p_block;
}
void HTTPChunkSource::recycle()
{
connManager->recycleSource(this);
}
std::string HTTPChunkSource::getContentType() const
{
mutex_locker locker {lock};
......@@ -518,6 +523,7 @@ HTTPChunk::HTTPChunk(const std::string &url, AbstractConnectionManager *manager,
const adaptive::ID &id, ChunkType type, const BytesRange &range):
AbstractChunk(manager->makeSource(url, id, type, range))
{
manager->start(source);
}
HTTPChunk::~HTTPChunk()
......
......@@ -67,15 +67,18 @@ namespace adaptive
class AbstractChunkSource : public ChunkInterface
{
friend class AbstractConnectionManager;
public:
AbstractChunkSource(ChunkType, const BytesRange & = BytesRange());
virtual ~AbstractChunkSource();
const BytesRange & getBytesRange () const;
ChunkType getChunkType () const;
virtual std::string getContentType () const override;
virtual RequestStatus getRequestStatus() const override;
virtual void recycle() = 0;
protected:
AbstractChunkSource(ChunkType, const BytesRange & = BytesRange());
virtual ~AbstractChunkSource();
ChunkType type;
RequestStatus requeststatus;
size_t contentLength;
......@@ -119,6 +122,7 @@ namespace adaptive
virtual bool hasMoreData () const override;
virtual size_t getBytesRead () const override;
virtual std::string getContentType () const override;
virtual void recycle() override;
static const size_t CHUNK_SIZE = 32768;
......
......@@ -65,19 +65,26 @@ void AbstractConnectionManager::setDownloadRateObserver(IDownloadRateObserver *o
rateObserver = obs;
}
void AbstractConnectionManager::deleteSource(AbstractChunkSource *source)
{
delete source;
}
HTTPConnectionManager::HTTPConnectionManager (vlc_object_t *p_object_)
: AbstractConnectionManager( p_object_ ),
localAllowed(false)
{
vlc_mutex_init(&lock);
downloader = new (std::nothrow) Downloader();
downloader = new Downloader();
downloaderhp = new Downloader();
downloader->start();
downloaderhp->start();
}
HTTPConnectionManager::~HTTPConnectionManager ()
{
delete downloader;
delete downloaderhp;
this->closeAllConnections();
while(!factories.empty())
{
......@@ -115,7 +122,7 @@ AbstractConnection * HTTPConnectionManager::reuseConnection(ConnectionParams &pa
AbstractConnection * HTTPConnectionManager::getConnection(ConnectionParams &params)
{
if(unlikely(factories.empty() || !downloader))
if(unlikely(factories.empty() || !downloader || !downloaderhp))
return nullptr;
if(params.isLocal())
......@@ -160,26 +167,46 @@ AbstractChunkSource *HTTPConnectionManager::makeSource(const std::string &url,
case ChunkType::Init:
case ChunkType::Index:
case ChunkType::Segment:
case ChunkType::Key:
case ChunkType::Playlist:
default:
return new HTTPChunkBufferedSource(url, this, id, type, range);
}
}
void HTTPConnectionManager::recycleSource(AbstractChunkSource *source)
{
deleteSource(source);
}
Downloader * HTTPConnectionManager::getDownloadQueue(const AbstractChunkSource *source) const
{
switch(source->getChunkType())
{
case ChunkType::Init:
case ChunkType::Index:
case ChunkType::Segment:
return downloader;
case ChunkType::Key:
case ChunkType::Playlist:
default:
return new HTTPChunkSource(url, this, id, type, range, true);
return downloaderhp;
}
}
void HTTPConnectionManager::start(AbstractChunkSource *source)
{
HTTPChunkBufferedSource *src = dynamic_cast<HTTPChunkBufferedSource *>(source);
if(src)
downloader->schedule(src);
if(src && !src->isDone())
getDownloadQueue(src)->schedule(src);
}
void HTTPConnectionManager::cancel(AbstractChunkSource *source)
{
HTTPChunkBufferedSource *src = dynamic_cast<HTTPChunkBufferedSource *>(source);
if(src)
downloader->cancel(src);
getDownloadQueue(src)->cancel(src);
}
void HTTPConnectionManager::setLocalConnectionsAllowed()
......
......@@ -55,6 +55,7 @@ namespace adaptive
virtual AbstractChunkSource *makeSource(const std::string &,
const ID &, ChunkType,
const BytesRange &) = 0;
virtual void recycleSource(AbstractChunkSource *) = 0;
virtual void start(AbstractChunkSource *) = 0;
virtual void cancel(AbstractChunkSource *) = 0;
......@@ -64,6 +65,7 @@ namespace adaptive
void setDownloadRateObserver(IDownloadRateObserver *);
protected:
void deleteSource(AbstractChunkSource *);
vlc_object_t *p_object;
private:
......@@ -81,6 +83,7 @@ namespace adaptive
virtual AbstractChunkSource *makeSource(const std::string &,
const ID &, ChunkType,
const BytesRange &) override;
virtual void recycleSource(AbstractChunkSource *) override;
virtual void start(AbstractChunkSource *) override;
virtual void cancel(AbstractChunkSource *) override;
......@@ -90,11 +93,13 @@ namespace adaptive
private:
void releaseAllConnections ();
Downloader *downloader;
Downloader *downloaderhp;
vlc_mutex_t lock;
std::vector<AbstractConnection *> connectionPool;
std::list<AbstractConnectionFactory *> factories;
bool localAllowed;
AbstractConnection * reuseConnection(ConnectionParams &);
Downloader * getDownloadQueue(const AbstractChunkSource *) const;
};
}
}
......
......@@ -33,6 +33,7 @@
#include <vlc_common.h>
#include <vlc_arrays.h>
#include <algorithm>
#include <cassert>
using namespace adaptive::playlist;
......@@ -63,16 +64,11 @@ const std::vector<BaseAdaptationSet*>& BasePeriod::getAdaptationSets() const
void BasePeriod::addAdaptationSet(BaseAdaptationSet *adaptationSet)
{
if ( adaptationSet != nullptr )
{
if(adaptationSet->getRepresentations().empty())
{
assert(!adaptationSet->getRepresentations().empty());
return; /* will leak */
}
adaptationSets.push_back(adaptationSet);
childs.push_back(adaptationSet);
}
auto p = std::find_if(adaptationSets.begin(), adaptationSets.end(),
[adaptationSet](BaseAdaptationSet *s){
return adaptationSet->getRole() < s->getRole(); });
adaptationSets.insert(p, adaptationSet);
childs.push_back(adaptationSet);
}
BaseAdaptationSet *BasePeriod::getAdaptationSetByID(const adaptive::ID &id) const
......
......@@ -26,11 +26,16 @@
using namespace adaptive;
using namespace adaptive::playlist;
Role::Role(unsigned r)
Role::Role(Value r)
{
value = r;
}
bool Role::operator <(const Role &other) const
{
return value > other.value;
}
bool Role::operator ==(const Role &other) const
{
return value == other.value;
......@@ -38,13 +43,13 @@ bool Role::operator ==(const Role &other) const
bool Role::isDefault() const
{
return value == ROLE_MAIN;
return value == Value::Main;
}
bool Role::autoSelectable() const
{
return value == ROLE_MAIN ||
value == ROLE_ALTERNATE ||
value == ROLE_SUBTITLE ||
value == ROLE_CAPTION;
return value == Value::Main ||
value == Value::Alternate ||
value == Value::Subtitle ||
value == Value::Caption;
}
......@@ -27,20 +27,24 @@ namespace adaptive
class Role
{
public:
static const unsigned ROLE_MAIN = 0;
static const unsigned ROLE_ALTERNATE = 1;
static const unsigned ROLE_SUPPLEMENTARY = 2;
static const unsigned ROLE_COMMENTARY = 3;
static const unsigned ROLE_DUB = 4;
static const unsigned ROLE_CAPTION = 5;
static const unsigned ROLE_SUBTITLE = 6;
Role(unsigned = ROLE_ALTERNATE);
enum class Value
{
Main,
Alternate,
Supplementary,
Commentary,
Dub,
Caption,
Subtitle,
};
Role(Value = Value::Main);
bool operator<(const Role &) const;
bool operator==(const Role &) const;
bool isDefault() const;
bool autoSelectable() const;
private:
unsigned value;
Value value;
};
}
}
......
......@@ -82,9 +82,16 @@ SegmentChunk* ISegment::toChunk(SharedResources *res, AbstractConnectionManager
BytesRange range;
if(startByte != endByte)
range = BytesRange(startByte, endByte);
ChunkType chunkType;
if(dynamic_cast<InitSegment *>(this))
chunkType = ChunkType::Init;
else if(dynamic_cast<IndexSegment *>(this))
chunkType = ChunkType::Index;
else
chunkType = ChunkType::Segment;
AbstractChunkSource *source = connManager->makeSource(url,
rep->getAdaptationSet()->getID(),
ChunkType::Segment,
chunkType,
range);
if(source)
{
......@@ -103,7 +110,7 @@ SegmentChunk* ISegment::toChunk(SharedResources *res, AbstractConnectionManager
}
else
{
delete source;
connManager->recycleSource(source);
}
}
return nullptr;
......
......@@ -29,6 +29,8 @@
#include "../http/Chunk.h"
#include "../SharedResources.hpp"
#include <vlc_block.h>
using namespace adaptive;
using namespace adaptive::http;
......@@ -44,7 +46,16 @@ block_t * Retrieve::HTTP(SharedResources *resources, ChunkType type,
return nullptr;
}
block_t *block = datachunk->read(1<<25);
block_t *p_head = nullptr;
block_t **pp_tail = &p_head;
for(;;)
{
block_t *p_block = datachunk->readBlock();
if(!p_block)
break;
block_ChainLastAppend(&pp_tail, p_block);
}
delete datachunk;
return block;
return p_head ? block_ChainGather(p_head) : nullptr;
}
......@@ -322,19 +322,19 @@ void IsoffMainParser::parseAdaptationSets (MPD *mpd, Node *periodNode, BaseP
const std::string &rolevalue = role->getAttributeValue("value");
adaptationSet->description.Set(rolevalue);
if(rolevalue == "main")
adaptationSet->setRole(Role::ROLE_MAIN);
adaptationSet->setRole(Role::Value::Main);
else if(rolevalue == "alternate")
adaptationSet->setRole(Role::ROLE_ALTERNATE);
adaptationSet->setRole(Role::Value::Alternate);
else if(rolevalue == "supplementary")
adaptationSet->setRole(Role::ROLE_SUPPLEMENTARY);
adaptationSet->setRole(Role::Value::Supplementary);
else if(rolevalue == "commentary")
adaptationSet->setRole(Role::ROLE_COMMENTARY);
adaptationSet->setRole(Role::Value::Commentary);
else if(rolevalue == "dub")
adaptationSet->setRole(Role::ROLE_DUB);
adaptationSet->setRole(Role::Value::Dub);
else if(rolevalue == "caption")
adaptationSet->setRole(Role::ROLE_CAPTION);
adaptationSet->setRole(Role::Value::Caption);
else if(rolevalue == "subtitle")
adaptationSet->setRole(Role::ROLE_SUBTITLE);
adaptationSet->setRole(Role::Value::Subtitle);
}
}
......
......@@ -515,17 +515,19 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
desc += pair.second->getAttributeByName("NAME")->quotedString();
}
const Attribute *typeattr = pair.second->getAttributeByName("TYPE");
if(pair.second->getAttributeByName("CODECS"))
{
rep->addCodecs(pair.second->getAttributeByName("CODECS")->quotedString());
}
else
else if(typeattr)
{
if(pair.second->getAttributeByName("TYPE")->value == "AUDIO")
if(typeattr->value == "AUDIO")
rep->addCodecs("mp4a");
else if(pair.second->getAttributeByName("TYPE")->value == "VIDEO")
else if(typeattr->value == "VIDEO")
rep->addCodecs("avc1");
else if(pair.second->getAttributeByName("TYPE")->value == "SUBTITLES")
else if(typeattr->value == "SUBTITLES")
rep->addCodecs("wvtt");
}
......@@ -539,23 +541,22 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
if(pair.second->getAttributeByName("DEFAULT"))
{
if(pair.second->getAttributeByName("DEFAULT")->value == "YES")
altAdaptSet->setRole(Role(Role::ROLE_MAIN));
altAdaptSet->setRole(Role(Role::Value::Main));
else
altAdaptSet->setRole(Role(Role::ROLE_ALTERNATE));
altAdaptSet->setRole(Role(Role::Value::Alternate));
}
if(pair.second->getAttributeByName("AUTOSELECT"))
{
if(pair.second->getAttributeByName("AUTOSELECT")->value == "NO" &&
!pair.second->getAttributeByName("DEFAULT"))
altAdaptSet->setRole(Role(Role::ROLE_SUPPLEMENTARY));
altAdaptSet->setRole(Role(Role::Value::Supplementary));
}
/* Subtitles unsupported for now */
const Attribute *typeattr = pair.second->getAttributeByName("TYPE");
if(typeattr->value == "SUBTITLES")
{
altAdaptSet->setRole(Role(Role::ROLE_SUBTITLE));
altAdaptSet->setRole(Role(Role::Value::Subtitle));
rep->streamFormat = StreamFormat(StreamFormat::Type::Unsupported);
}
else if(typeattr->value != "AUDIO" && typeattr->value != "VIDEO")
......
......@@ -51,6 +51,11 @@ size_t MemoryChunkSource::getBytesRead() const
return i_read;
}
void MemoryChunkSource::recycle()
{
delete this;
}
block_t * MemoryChunkSource::readBlock()
{
block_t *p_block = nullptr;
......
......@@ -38,6 +38,7 @@ namespace smooth
virtual block_t * read(size_t) override;
virtual bool hasMoreData() const override;
virtual size_t getBytesRead() const override;
virtual void recycle() override;
private:
block_t *data;
......