Browse Source

demux: adaptive: use nullptr

pull/119/head
Francois Cartegnie 6 years ago
parent
commit
fdb307387e
  1. 14
      modules/demux/adaptive/PlaylistManager.cpp
  2. 30
      modules/demux/adaptive/SegmentTracker.cpp
  3. 38
      modules/demux/adaptive/Streams.cpp
  4. 28
      modules/demux/adaptive/adaptive.cpp
  5. 8
      modules/demux/adaptive/encryption/CommonEncryption.cpp
  6. 2
      modules/demux/adaptive/http/AuthStorage.cpp
  7. 34
      modules/demux/adaptive/http/Chunk.cpp
  8. 8
      modules/demux/adaptive/http/Downloader.cpp
  9. 10
      modules/demux/adaptive/http/HTTPConnection.cpp
  10. 12
      modules/demux/adaptive/http/HTTPConnectionManager.cpp
  11. 18
      modules/demux/adaptive/http/Transport.cpp
  12. 4
      modules/demux/adaptive/logic/BufferingLogic.cpp
  13. 12
      modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
  14. 20
      modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
  15. 8
      modules/demux/adaptive/logic/Representationselectors.cpp
  16. 6
      modules/demux/adaptive/mp4/AtomsReader.cpp
  17. 2
      modules/demux/adaptive/playlist/BaseAdaptationSet.cpp
  18. 4
      modules/demux/adaptive/playlist/BasePeriod.cpp
  19. 4
      modules/demux/adaptive/playlist/BasePlaylist.cpp
  20. 2
      modules/demux/adaptive/playlist/ICanonicalUrl.hpp
  21. 20
      modules/demux/adaptive/playlist/Inheritables.cpp
  22. 2
      modules/demux/adaptive/playlist/Inheritables.hpp
  23. 4
      modules/demux/adaptive/playlist/Segment.cpp
  24. 2
      modules/demux/adaptive/playlist/SegmentBase.h
  25. 6
      modules/demux/adaptive/playlist/SegmentBaseType.cpp
  26. 2
      modules/demux/adaptive/playlist/SegmentChunk.cpp
  27. 20
      modules/demux/adaptive/playlist/SegmentInformation.cpp
  28. 10
      modules/demux/adaptive/playlist/SegmentList.cpp
  29. 2
      modules/demux/adaptive/playlist/SegmentList.h
  30. 14
      modules/demux/adaptive/playlist/SegmentTemplate.cpp
  31. 6
      modules/demux/adaptive/playlist/SegmentTemplate.h
  32. 2
      modules/demux/adaptive/playlist/SegmentTimeline.cpp
  33. 4
      modules/demux/adaptive/playlist/Templates.hpp
  34. 2
      modules/demux/adaptive/playlist/Url.cpp
  35. 2
      modules/demux/adaptive/playlist/Url.hpp
  36. 4
      modules/demux/adaptive/plumbing/CommandsQueue.cpp
  37. 8
      modules/demux/adaptive/plumbing/Demuxer.cpp
  38. 10
      modules/demux/adaptive/plumbing/FakeESOut.cpp
  39. 2
      modules/demux/adaptive/plumbing/FakeESOutID.cpp
  40. 14
      modules/demux/adaptive/plumbing/SourceStream.cpp
  41. 4
      modules/demux/adaptive/tools/Conversions.cpp
  42. 2
      modules/demux/adaptive/tools/FormatNamespace.cpp
  43. 2
      modules/demux/adaptive/tools/Retrieve.cpp
  44. 2
      modules/demux/adaptive/xml/DOMHelper.cpp
  45. 24
      modules/demux/adaptive/xml/DOMParser.cpp
  46. 6
      modules/demux/dash/DASHManager.cpp
  47. 4
      modules/demux/dash/DASHStream.cpp
  48. 2
      modules/demux/dash/mpd/DASHCommonAttributesElements.cpp
  49. 6
      modules/demux/dash/mpd/IsoffMainParser.cpp
  50. 2
      modules/demux/dash/mpd/MPD.cpp
  51. 4
      modules/demux/hls/HLSStreams.cpp
  52. 24
      modules/demux/hls/playlist/Parser.cpp
  53. 6
      modules/demux/hls/playlist/Tags.cpp
  54. 12
      modules/demux/smooth/SmoothManager.cpp
  55. 4
      modules/demux/smooth/SmoothStream.cpp
  56. 2
      modules/demux/smooth/mp4/IndexReader.cpp
  57. 22
      modules/demux/smooth/playlist/ForgedInitSegment.cpp
  58. 8
      modules/demux/smooth/playlist/MemoryChunk.cpp
  59. 4
      modules/demux/smooth/playlist/Parser.cpp
  60. 2
      modules/demux/smooth/playlist/SmoothSegment.hpp
  61. 16
      test/modules/demux/dashuri.cpp

14
modules/demux/adaptive/PlaylistManager.cpp

@ -59,14 +59,14 @@ PlaylistManager::PlaylistManager( demux_t *p_demux_,
AbstractStreamFactory *factory,
AbstractAdaptationLogic::LogicType type ) :
logicType ( type ),
logic ( NULL ),
logic ( nullptr ),
playlist ( pl ),
streamFactory ( factory ),
p_demux ( p_demux_ )
{
currentPeriod = playlist->getFirstPeriod();
resources = res;
bufferingLogic = NULL;
bufferingLogic = nullptr;
failedupdates = 0;
b_thread = false;
b_buffering = false;
@ -151,7 +151,7 @@ bool PlaylistManager::init()
if(!setupPeriod())
return false;
playlist->playbackStart.Set(time(NULL));
playlist->playbackStart.Set(time(nullptr));
nextPlaylistupdate = playlist->playbackStart.Get();
updateControlsPosition();
@ -190,7 +190,7 @@ void PlaylistManager::stop()
waitcond.signal();
}
vlc_join(thread, NULL);
vlc_join(thread, nullptr);
b_thread = false;
}
@ -673,14 +673,14 @@ void PlaylistManager::Run()
void * PlaylistManager::managerThread(void *opaque)
{
static_cast<PlaylistManager *>(opaque)->Run();
return NULL;
return nullptr;
}
void PlaylistManager::updateControlsPosition()
{
vlc_mutex_locker locker(&cached.lock);
time_t now = time(NULL);
time_t now = time(nullptr);
if(now - cached.lastupdate < 1)
return;
cached.lastupdate = now;
@ -772,7 +772,7 @@ void PlaylistManager::updateControlsPosition()
AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::LogicType type, AbstractConnectionManager *conn)
{
vlc_object_t *obj = VLC_OBJECT(p_demux);
AbstractAdaptationLogic *logic = NULL;
AbstractAdaptationLogic *logic = nullptr;
switch(type)
{
case AbstractAdaptationLogic::LogicType::FixedRate:

30
modules/demux/adaptive/SegmentTracker.cpp

@ -102,7 +102,7 @@ SegmentTracker::~SegmentTracker()
SegmentTracker::Position::Position()
{
number = std::numeric_limits<uint64_t>::max();
rep = NULL;
rep = nullptr;
init_sent = false;
index_sent = false;
}
@ -118,7 +118,7 @@ SegmentTracker::Position::Position(BaseRepresentation *rep, uint64_t number)
bool SegmentTracker::Position::isValid() const
{
return number != std::numeric_limits<uint64_t>::max() &&
rep != NULL;
rep != nullptr;
}
std::string SegmentTracker::Position::toString() const
@ -160,7 +160,7 @@ StreamFormat SegmentTracker::getCurrentFormat() const
{
BaseRepresentation *rep = current.rep;
if(!rep)
rep = logic->getNextRepresentation(adaptationSet, NULL);
rep = logic->getNextRepresentation(adaptationSet, nullptr);
if(rep)
{
/* Ensure ephemere content is updated/loaded */
@ -175,7 +175,7 @@ std::list<std::string> SegmentTracker::getCurrentCodecs() const
{
BaseRepresentation *rep = current.rep;
if(!rep)
rep = logic->getNextRepresentation(adaptationSet, NULL);
rep = logic->getNextRepresentation(adaptationSet, nullptr);
if(rep)
return rep->getCodecs();
return std::list<std::string>();
@ -198,7 +198,7 @@ const Role & SegmentTracker::getStreamRole() const
void SegmentTracker::reset()
{
notify(SegmentTrackerEvent(current.rep, NULL));
notify(SegmentTrackerEvent(current.rep, nullptr));
current = Position();
next = Position();
initializing = true;
@ -211,7 +211,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
ISegment *segment;
if(!adaptationSet)
return NULL;
return nullptr;
bool b_updated = false;
bool b_switched = false;
@ -253,7 +253,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
}
if(!next.isValid())
return NULL;
return nullptr;
if(b_switched)
{
@ -277,7 +277,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
{
format = current.rep->getStreamFormat();
notify(SegmentTrackerEvent(&format)); /* Notify new demux format */
return NULL; /* Force current demux to end */
return nullptr; /* Force current demux to end */
}
}
else if(format == StreamFormat(StreamFormat::UNKNOWN) && b_switched)
@ -285,12 +285,12 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
/* Handle the corner case when only the demuxer can know the format and
* demuxer starts after the format change (Probe != buffering) */
notify(SegmentTrackerEvent(&format)); /* Notify new demux format */
return NULL; /* Force current demux to end */
return nullptr; /* Force current demux to end */
}
if(format == StreamFormat(StreamFormat::UNSUPPORTED))
{
return NULL; /* Can't return chunk because no demux will be created */
return nullptr; /* Can't return chunk because no demux will be created */
}
if(!current.init_sent)
@ -317,7 +317,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
bool b_gap = false;
segment = current.rep->getNextMediaSegment(current.number, &current.number, &b_gap);
if(!segment)
return NULL;
return nullptr;
if(b_gap)
next = current;
@ -361,7 +361,7 @@ bool SegmentTracker::setPositionByTime(vlc_tick_t time, bool restarted, bool try
{
Position pos = Position(current.rep, current.number);
if(!pos.isValid())
pos.rep = logic->getNextRepresentation(adaptationSet, NULL);
pos.rep = logic->getNextRepresentation(adaptationSet, nullptr);
if(!pos.rep)
return false;
@ -395,7 +395,7 @@ void SegmentTracker::setPosition(const Position &pos, bool restarted)
SegmentTracker::Position SegmentTracker::getStartPosition()
{
Position pos;
pos.rep = logic->getNextRepresentation(adaptationSet, NULL);
pos.rep = logic->getNextRepresentation(adaptationSet, nullptr);
if(pos.rep)
{
/* Ensure ephemere content is updated/loaded */
@ -425,7 +425,7 @@ vlc_tick_t SegmentTracker::getPlaybackTime(bool b_next) const
BaseRepresentation *rep = current.rep;
if(!rep)
rep = logic->getNextRepresentation(adaptationSet, NULL);
rep = logic->getNextRepresentation(adaptationSet, nullptr);
if(rep &&
rep->getPlaybackTimeDurationBySegmentNumber(b_next ? next.number : current.number, &time, &duration))
@ -447,7 +447,7 @@ vlc_tick_t SegmentTracker::getMinAheadTime() const
{
BaseRepresentation *rep = current.rep;
if(!rep)
rep = logic->getNextRepresentation(adaptationSet, NULL);
rep = logic->getNextRepresentation(adaptationSet, nullptr);
if(rep)
{
/* Ensure ephemere content is updated/loaded */

38
modules/demux/adaptive/Streams.cpp

@ -44,7 +44,7 @@ AbstractStream::AbstractStream(demux_t * demux_)
{
p_realdemux = demux_;
format = StreamFormat::UNKNOWN;
currentChunk = NULL;
currentChunk = nullptr;
eof = false;
valid = true;
disabled = false;
@ -52,10 +52,10 @@ AbstractStream::AbstractStream(demux_t * demux_)
needrestart = false;
inrestart = false;
demuxfirstchunk = false;
segmentTracker = NULL;
demuxersource = NULL;
demuxer = NULL;
fakeesout = NULL;
segmentTracker = nullptr;
demuxersource = nullptr;
demuxer = nullptr;
fakeesout = nullptr;
notfound_sequence = 0;
last_buffer_status = BufferingStatus::Lessthanmin;
vlc_mutex_init(&lock);
@ -96,7 +96,7 @@ bool AbstractStream::init(const StreamFormat &format_, SegmentTracker *tracker,
return true;
}
delete commandsqueue;
commandsqueue = NULL;
commandsqueue = nullptr;
}
else
{
@ -137,7 +137,7 @@ void AbstractStream::prepareRestart(bool b_discontinuity)
fakeEsOut()->commandsQueue()->setDrop(true);
delete demuxer;
fakeEsOut()->commandsQueue()->setDrop(false);
demuxer = NULL;
demuxer = nullptr;
}
}
@ -469,7 +469,7 @@ AbstractStream::Status AbstractStream::dequeue(vlc_tick_t nz_deadline, vlc_tick_
std::string AbstractStream::getContentType()
{
if (currentChunk == NULL && !eof)
if (currentChunk == nullptr && !eof)
{
const bool b_restarting = fakeEsOut()->restarting();
currentChunk = segmentTracker->getNextChunk(!b_restarting, connManager);
@ -482,7 +482,7 @@ std::string AbstractStream::getContentType()
block_t * AbstractStream::readNextBlock()
{
if (currentChunk == NULL && !eof)
if (currentChunk == nullptr && !eof)
{
const bool b_restarting = fakeEsOut()->restarting();
currentChunk = segmentTracker->getNextChunk(!b_restarting, connManager);
@ -498,19 +498,19 @@ block_t * AbstractStream::readNextBlock()
{
msg_Info(p_realdemux, "Encountered discontinuity");
/* Force stream/demuxer to end for this call */
return NULL;
return nullptr;
}
if(currentChunk == NULL)
if(currentChunk == nullptr)
{
eof = true;
return NULL;
return nullptr;
}
const bool b_segment_head_chunk = (currentChunk->getBytesRead() == 0);
block_t *block = currentChunk->readBlock();
if(block == NULL)
if(block == nullptr)
{
if(currentChunk->getRequestStatus() == RequestStatus::NotFound &&
++notfound_sequence < 3)
@ -518,8 +518,8 @@ block_t * AbstractStream::readNextBlock()
discontinuity = true;
}
delete currentChunk;
currentChunk = NULL;
return NULL;
currentChunk = nullptr;
return nullptr;
}
else notfound_sequence = 0;
@ -528,7 +528,7 @@ block_t * AbstractStream::readNextBlock()
if (currentChunk->isEmpty())
{
delete currentChunk;
currentChunk = NULL;
currentChunk = nullptr;
}
block = checkBlock(block, b_segment_head_chunk);
@ -553,7 +553,7 @@ bool AbstractStream::setPosition(vlc_tick_t time, bool tryonly)
{
if(currentChunk)
delete currentChunk;
currentChunk = NULL;
currentChunk = nullptr;
needrestart = false;
fakeEsOut()->resetTimestamps();
@ -611,7 +611,7 @@ AbstractDemuxer * AbstractStream::createDemux(const StreamFormat &format)
if(ret && !ret->create())
{
delete ret;
ret = NULL;
ret = nullptr;
}
else fakeEsOut()->commandsQueue()->Commit();
@ -621,7 +621,7 @@ AbstractDemuxer * AbstractStream::createDemux(const StreamFormat &format)
AbstractDemuxer *AbstractStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
es_out_t *out, AbstractSourceStream *source) const
{
AbstractDemuxer *ret = NULL;
AbstractDemuxer *ret = nullptr;
switch((unsigned)format)
{
case StreamFormat::MP4:

28
modules/demux/adaptive/adaptive.cpp

@ -129,7 +129,7 @@ vlc_module_begin ()
set_capability( "demux", 12 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
add_string( "adaptive-logic", "", ADAPT_LOGIC_TEXT, NULL, false )
add_string( "adaptive-logic", "", ADAPT_LOGIC_TEXT, nullptr, false )
change_string_list( ppsz_logics_values, ppsz_logics )
add_integer( "adaptive-maxwidth", 0,
ADAPT_WIDTH_TEXT, ADAPT_WIDTH_TEXT, false )
@ -142,7 +142,7 @@ vlc_module_begin ()
ADAPT_BUFFER_TEXT, ADAPT_BUFFER_LONGTEXT, true );
add_integer( "adaptive-maxbuffer",
MS_FROM_VLC_TICK(AbstractBufferingLogic::DEFAULT_MAX_BUFFERING),
ADAPT_MAXBUFFER_TEXT, NULL, true );
ADAPT_MAXBUFFER_TEXT, nullptr, true );
add_integer( "adaptive-lowlatency", -1, ADAPT_LOWLATENCY_TEXT, ADAPT_LOWLATENCY_LONGTEXT, true );
change_integer_list(rgi_latency, ppsz_latency)
set_callbacks( Open, Close )
@ -177,7 +177,7 @@ static int Open(vlc_object_t *p_obj)
free(psz_mime);
}
PlaylistManager *p_manager = NULL;
PlaylistManager *p_manager = nullptr;
char *psz_logic = var_InheritString(p_obj, "adaptive-logic");
AbstractAdaptationLogic::LogicType logic = AbstractAdaptationLogic::LogicType::Default;
@ -287,21 +287,21 @@ static PlaylistManager * HandleDash(demux_t *p_demux, DOMParser &xmlParser,
if(!xmlParser.reset(p_demux->s) || !xmlParser.parse(true))
{
msg_Err(p_demux, "Cannot parse MPD");
return NULL;
return nullptr;
}
IsoffMainParser mpdparser(xmlParser.getRootNode(), VLC_OBJECT(p_demux),
p_demux->s, playlisturl);
MPD *p_playlist = mpdparser.parse();
if(p_playlist == NULL)
if(p_playlist == nullptr)
{
msg_Err( p_demux, "Cannot create/unknown MPD for profile");
return NULL;
return nullptr;
}
SharedResources *resources =
SharedResources::createDefault(VLC_OBJECT(p_demux), playlisturl);
DASHStreamFactory *factory = new (std::nothrow) DASHStreamFactory;
DASHManager *manager = NULL;
DASHManager *manager = nullptr;
if(!resources || !factory ||
!(manager = new (std::nothrow) DASHManager(p_demux, resources,
p_playlist, factory, logic)))
@ -320,21 +320,21 @@ static PlaylistManager * HandleSmooth(demux_t *p_demux, DOMParser &xmlParser,
if(!xmlParser.reset(p_demux->s) || !xmlParser.parse(true))
{
msg_Err(p_demux, "Cannot parse Manifest");
return NULL;
return nullptr;
}
ManifestParser mparser(xmlParser.getRootNode(), VLC_OBJECT(p_demux),
p_demux->s, playlisturl);
Manifest *p_playlist = mparser.parse();
if(p_playlist == NULL)
if(p_playlist == nullptr)
{
msg_Err( p_demux, "Cannot create Manifest");
return NULL;
return nullptr;
}
SharedResources *resources =
SharedResources::createDefault(VLC_OBJECT(p_demux), playlisturl);
SmoothStreamFactory *factory = new (std::nothrow) SmoothStreamFactory;
SmoothManager *manager = NULL;
SmoothManager *manager = nullptr;
if(!resources || !factory ||
!(manager = new (std::nothrow) SmoothManager(p_demux, resources,
p_playlist, factory, logic)))
@ -353,7 +353,7 @@ static PlaylistManager * HandleHLS(demux_t *p_demux,
SharedResources *resources =
SharedResources::createDefault(VLC_OBJECT(p_demux), playlisturl);
if(!resources)
return NULL;
return nullptr;
M3U8Parser parser(resources);
M3U8 *p_playlist = parser.parse(VLC_OBJECT(p_demux),p_demux->s, playlisturl);
@ -361,11 +361,11 @@ static PlaylistManager * HandleHLS(demux_t *p_demux,
{
msg_Err( p_demux, "Could not parse playlist" );
delete resources;
return NULL;
return nullptr;
}
HLSStreamFactory *factory = new (std::nothrow) HLSStreamFactory;
HLSManager *manager = NULL;
HLSManager *manager = nullptr;
if(!factory ||
!(manager = new (std::nothrow) HLSManager(p_demux, resources,
p_playlist, factory, logic)))

8
modules/demux/adaptive/encryption/CommonEncryption.cpp

@ -54,7 +54,7 @@ void CommonEncryption::mergeWith(const CommonEncryption &other)
CommonEncryptionSession::CommonEncryptionSession()
{
ctx = NULL;
ctx = nullptr;
}
@ -89,7 +89,7 @@ bool CommonEncryptionSession::start(SharedResources *res, const CommonEncryption
gcry_cipher_setiv(handle, &encryption.iv[0], 16) )
{
gcry_cipher_close(handle);
ctx = NULL;
ctx = nullptr;
return false;
}
ctx = handle;
@ -104,7 +104,7 @@ void CommonEncryptionSession::close()
gcry_cipher_hd_t handle = reinterpret_cast<gcry_cipher_hd_t>(ctx);
if(ctx)
gcry_cipher_close(handle);
ctx = NULL;
ctx = nullptr;
#endif
}
@ -118,7 +118,7 @@ size_t CommonEncryptionSession::decrypt(void *inputdata, size_t inputbytes, bool
if(encryption.method == CommonEncryption::Method::AES_128 && ctx)
{
if ((inputbytes % 16) != 0 || inputbytes < 16 ||
gcry_cipher_decrypt(handle, inputdata, inputbytes, NULL, 0))
gcry_cipher_decrypt(handle, inputdata, inputbytes, nullptr, 0))
{
inputbytes = 0;
}

2
modules/demux/adaptive/http/AuthStorage.cpp

@ -32,7 +32,7 @@ AuthStorage::AuthStorage( vlc_object_t *p_obj )
p_cookies_jar = static_cast<vlc_http_cookie_jar_t *>
(var_InheritAddress( p_obj, "http-cookies" ));
else
p_cookies_jar = NULL;
p_cookies_jar = nullptr;
}
AuthStorage::~AuthStorage()

34
modules/demux/adaptive/http/Chunk.cpp

@ -108,7 +108,7 @@ uint64_t AbstractChunk::getStartByteInFile() const
block_t * AbstractChunk::doRead(size_t size, bool b_block)
{
if(!source)
return NULL;
return nullptr;
block_t *block = (b_block) ? source->readBlock() : source->read(size);
if(block)
@ -141,7 +141,7 @@ block_t * AbstractChunk::read(size_t size)
HTTPChunkSource::HTTPChunkSource(const std::string& url, AbstractConnectionManager *manager,
const adaptive::ID &id, bool access) :
AbstractChunkSource(),
connection (NULL),
connection (nullptr),
connManager (manager),
consumed (0)
{
@ -190,13 +190,13 @@ block_t * HTTPChunkSource::read(size_t readsize)
if(!prepare())
{
eof = true;
return NULL;
return nullptr;
}
if(consumed == contentLength && consumed > 0)
{
eof = true;
return NULL;
return nullptr;
}
if(contentLength && readsize > contentLength - consumed)
@ -206,7 +206,7 @@ block_t * HTTPChunkSource::read(size_t readsize)
if(!p_block)
{
eof = true;
return NULL;
return nullptr;
}
vlc_tick_t time = vlc_tick_now();
@ -215,7 +215,7 @@ block_t * HTTPChunkSource::read(size_t readsize)
if(ret < 0)
{
block_Release(p_block);
p_block = NULL;
p_block = nullptr;
eof = true;
}
else
@ -269,7 +269,7 @@ bool HTTPChunkSource::prepare()
if(httpconn)
connparams = httpconn->getRedirection();
connection->setUsed(false);
connection = NULL;
connection = nullptr;
if(httpconn)
continue;
}
@ -294,7 +294,7 @@ block_t * HTTPChunkSource::readBlock()
HTTPChunkBufferedSource::HTTPChunkBufferedSource(const std::string& url, AbstractConnectionManager *manager,
const adaptive::ID &sourceid, bool access) :
HTTPChunkSource(url, manager, sourceid, access),
p_head (NULL),
p_head (nullptr),
pp_tail (&p_head),
buffered (0)
{
@ -317,7 +317,7 @@ HTTPChunkBufferedSource::~HTTPChunkBufferedSource()
if(p_head)
{
block_ChainRelease(p_head);
p_head = NULL;
p_head = nullptr;
pp_tail = &p_head;
}
buffered = 0;
@ -378,7 +378,7 @@ void HTTPChunkBufferedSource::bufferize(size_t readsize)
if(ret <= 0)
{
block_Release(p_block);
p_block = NULL;
p_block = nullptr;
mutex_locker locker {lock};
done = true;
rate.size = buffered + consumed;
@ -426,7 +426,7 @@ bool HTTPChunkBufferedSource::hasMoreData() const
block_t * HTTPChunkBufferedSource::readBlock()
{
block_t *p_block = NULL;
block_t *p_block = nullptr;
mutex_locker locker {lock};
@ -444,13 +444,13 @@ block_t * HTTPChunkBufferedSource::readBlock()
/* dequeue */
p_block = p_head;
p_head = p_head->p_next;
if(p_head == NULL)
if(p_head == nullptr)
{
pp_tail = &p_head;
if(done)
eof = true;
}
p_block->p_next = NULL;
p_block->p_next = nullptr;
consumed += p_block->i_buffer;
buffered -= p_block->i_buffer;
@ -465,11 +465,11 @@ block_t * HTTPChunkBufferedSource::read(size_t readsize)
while(readsize > buffered && !done)
avail.wait(lock);
block_t *p_block = NULL;
block_t *p_block = nullptr;
if(!readsize || !buffered || !(p_block = block_Alloc(readsize)) )
{
eof = true;
return NULL;
return nullptr;
}
size_t copied = 0;
@ -485,10 +485,10 @@ block_t * HTTPChunkBufferedSource::read(size_t readsize)
if(p_head->i_buffer == 0)
{
block_t *next = p_head->p_next;
p_head->p_next = NULL;
p_head->p_next = nullptr;
block_Release(p_head);
p_head = next;
if(next == NULL)
if(next == nullptr)
pp_tail = &p_head;
}
}

8
modules/demux/adaptive/http/Downloader.cpp

@ -33,7 +33,7 @@ Downloader::Downloader()
{
killed = false;
thread_handle_valid = false;
current = NULL;
current = nullptr;
}
bool Downloader::start()
@ -53,7 +53,7 @@ Downloader::~Downloader()
kill();
if(thread_handle_valid)
vlc_join(thread_handle, NULL);
vlc_join(thread_handle, nullptr);
}
void Downloader::kill()
@ -88,7 +88,7 @@ void * Downloader::downloaderThread(void *opaque)
{
Downloader *instance = static_cast<Downloader *>(opaque);
instance->Run();
return NULL;
return nullptr;
}
void Downloader::Run()
@ -115,7 +115,7 @@ void Downloader::Run()
chunks.pop_front();
current->release();
}
current = NULL;
current = nullptr;
updated_cond.signal();
lock.unlock();
}

10
modules/demux/adaptive/http/HTTPConnection.cpp

@ -476,7 +476,7 @@ const ConnectionParams & HTTPConnection::getRedirection() const
StreamUrlConnection::StreamUrlConnection(vlc_object_t *p_object)
: AbstractConnection(p_object)
{
p_streamurl = NULL;
p_streamurl = nullptr;
bytesRead = 0;
contentLength = 0;
}
@ -490,7 +490,7 @@ void StreamUrlConnection::reset()
{
if(p_streamurl)
vlc_stream_Delete(p_streamurl);
p_streamurl = NULL;
p_streamurl = nullptr;
bytesRead = 0;
contentLength = 0;
contentType = std::string();
@ -604,7 +604,7 @@ AbstractConnection * NativeConnectionFactory::createConnection(vlc_object_t *p_o
if(params.usesAccess() ||
(params.getScheme() != "http" && params.getScheme() != "https") ||
params.getHostname().empty())
return NULL;
return nullptr;
ConnectionParams proxy;
@ -621,7 +621,7 @@ AbstractConnection * NativeConnectionFactory::createConnection(vlc_object_t *p_o
const bool b_secure = (params.getScheme() == "https");
Transport *socket = new (std::nothrow) Transport(b_secure);
if(!socket)
return NULL;
return nullptr;
/* disable pipelined tls until we have ticket/resume session support */
HTTPConnection *conn = new (std::nothrow)
@ -629,7 +629,7 @@ AbstractConnection * NativeConnectionFactory::createConnection(vlc_object_t *p_o
if(!conn)
{
delete socket;
return NULL;
return nullptr;
}
return conn;

12
modules/demux/adaptive/http/HTTPConnectionManager.cpp

@ -39,7 +39,7 @@ AbstractConnectionManager::AbstractConnectionManager(vlc_object_t *p_object_)
: IDownloadRateObserver()
{
p_object = p_object_;
rateObserver = NULL;
rateObserver = nullptr;
}
AbstractConnectionManager::~AbstractConnectionManager()
@ -103,18 +103,18 @@ AbstractConnection * HTTPConnectionManager::reuseConnection(ConnectionParams &pa
if(conn->canReuse(params))
return conn;
}
return NULL;
return nullptr;
}
AbstractConnection * HTTPConnectionManager::getConnection(ConnectionParams &params)
{
if(unlikely(factories.empty() || !downloader))
return NULL;
return nullptr;
if(params.isLocal())
{
if(!localAllowed)
return NULL;
return nullptr;
}
vlc_mutex_lock(&lock);
@ -127,7 +127,7 @@ AbstractConnection * HTTPConnectionManager::getConnection(ConnectionParams &para
if(!conn)
{
vlc_mutex_unlock(&lock);
return NULL;
return nullptr;
}
connectionPool.push_back(conn);
@ -135,7 +135,7 @@ AbstractConnection * HTTPConnectionManager::getConnection(ConnectionParams &para
if (!conn->prepare(params))
{
vlc_mutex_unlock(&lock);
return NULL;
return nullptr;
}
}

18
modules/demux/adaptive/http/Transport.cpp

@ -27,8 +27,8 @@ using namespace adaptive::http;
Transport::Transport(bool b_secure_)
{
creds = NULL;
tls = NULL;
creds = nullptr;
tls = nullptr;
b_secure = b_secure_;
}
@ -49,11 +49,11 @@ bool Transport::connect(vlc_object_t *p_object, const std::string &hostname, int
if(!creds)
return false;
tls = vlc_tls_SocketOpenTLS(creds, hostname.c_str(), port, "https",
NULL, NULL );
nullptr, nullptr );
if(!tls)
{
vlc_tls_ClientDelete(creds);
creds = NULL;
creds = nullptr;
}
}
else
@ -61,12 +61,12 @@ bool Transport::connect(vlc_object_t *p_object, const std::string &hostname, int
tls = vlc_tls_SocketOpenTCP(p_object, hostname.c_str(), port);
}
return tls != NULL;
return tls != nullptr;
}
bool Transport::connected() const
{
return tls != NULL;
return tls != nullptr;
}
void Transport::disconnect()
@ -74,13 +74,13 @@ void Transport::disconnect()
if(tls)
{
vlc_tls_Close(tls);
tls = NULL;
tls = nullptr;
}
if(creds)
{
vlc_tls_ClientDelete(creds);
creds = NULL;
creds = nullptr;
}
}
@ -92,7 +92,7 @@ ssize_t Transport::read(void *p_buffer, size_t len)
std::string Transport::readline()
{
char *line = ::vlc_tls_GetLine(tls);
if(line == NULL)
if(line == nullptr)
return "";
std::string ret(line);

4
modules/demux/adaptive/logic/BufferingLogic.cpp

@ -146,7 +146,7 @@ uint64_t DefaultBufferingLogic::getLiveStartSegmentNumber(BaseRepresentation *re
else if(segmentList)
timeline = segmentList->inheritSegmentTimeline();
else
timeline = NULL;
timeline = nullptr;
if(timeline)
{
@ -218,7 +218,7 @@ uint64_t DefaultBufferingLogic::getLiveStartSegmentNumber(BaseRepresentation *re
if(scaledduration)
{
/* Compute playback offset and effective finished segment from wall time */
vlc_tick_t now = vlc_tick_from_sec(time(NULL));
vlc_tick_t now = vlc_tick_from_sec(time(nullptr));
vlc_tick_t playbacktime = now - i_buffering;
vlc_tick_t minavailtime = playlist->availabilityStartTime.Get() + rep->getPeriodStart();
const uint64_t startnumber = mediaSegmentTemplate->inheritStartNumber();

12
modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp

@ -66,14 +66,14 @@ BaseRepresentation *
NearOptimalAdaptationLogic::getNextQualityIndex( BaseAdaptationSet *adaptSet, RepresentationSelector &selector,
float gammaP, float VD, float Q )
{
BaseRepresentation *ret = NULL;
BaseRepresentation *prev = NULL;
BaseRepresentation *ret = nullptr;
BaseRepresentation *prev = nullptr;
float argmax;
for(BaseRepresentation *rep = selector.lowest(adaptSet);
rep && rep != prev; rep = selector.higher(adaptSet, rep))
{
float arg = ( VD * (getUtility(rep) + gammaP) - Q ) / rep->getBandwidth();
if(ret == NULL || argmax <= arg)
if(ret == nullptr || argmax <= arg)
{
ret = rep;
argmax = arg;
@ -89,8 +89,8 @@ BaseRepresentation *NearOptimalAdaptationLogic::getNextRepresentation(BaseAdapta
BaseRepresentation *lowest = selector.lowest(adaptSet);
BaseRepresentation *highest = selector.highest(adaptSet);
if(lowest == NULL || highest == NULL)
return NULL;
if(lowest == nullptr || highest == nullptr)
return nullptr;
const float umin = getUtility(lowest);
const float umax = getUtility(highest);
@ -113,7 +113,7 @@ BaseRepresentation *NearOptimalAdaptationLogic::getNextRepresentation(BaseAdapta
const float Vd = (secf_from_vlc_tick(ctxcopy.buffering_min) - 1.0) / (umin + gammaP);
BaseRepresentation *m;
if(prevRep == NULL) /* Starting */
if(prevRep == nullptr) /* Starting */
{
m = selector.select(adaptSet, bps);
}

20
modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp

@ -53,8 +53,8 @@ RateBasedAdaptationLogic::~RateBasedAdaptationLogic()
BaseRepresentation *RateBasedAdaptationLogic::getNextRepresentation(BaseAdaptationSet *adaptSet, BaseRepresentation *currep)
{
if(adaptSet == NULL)
return NULL;
if(adaptSet == nullptr)
return nullptr;
vlc_mutex_lock(&lock);
size_t availBps = currentBps + ((currep) ? currep->getBandwidth() : 0);
@ -66,11 +66,11 @@ BaseRepresentation *RateBasedAdaptationLogic::getNextRepresentation(BaseAdaptati
RepresentationSelector selector(maxwidth, maxheight);
BaseRepresentation *rep = selector.select(adaptSet, availBps);
if ( rep == NULL )
if ( rep == nullptr )
{
rep = selector.select(adaptSet);
if ( rep == NULL )
return NULL;
if ( rep == nullptr )
return nullptr;
}
return rep;
@ -129,16 +129,16 @@ FixedRateAdaptationLogic::FixedRateAdaptationLogic(vlc_object_t *obj, size_t bps
BaseRepresentation *FixedRateAdaptationLogic::getNextRepresentation(BaseAdaptationSet *adaptSet, BaseRepresentation *)
{
if(adaptSet == NULL)
return NULL;
if(adaptSet == nullptr)
return nullptr;
RepresentationSelector selector(maxwidth, maxheight);
BaseRepresentation *rep = selector.select(adaptSet, currentBps);
if ( rep == NULL )
if ( rep == nullptr )
{
rep = selector.select(adaptSet);
if ( rep == NULL )
return NULL;
if ( rep == nullptr )
return nullptr;
}
return rep;
}

8
modules/demux/adaptive/logic/Representationselectors.cpp

@ -43,7 +43,7 @@ RepresentationSelector::~RepresentationSelector()
BaseRepresentation * RepresentationSelector::lowest(BaseAdaptationSet *adaptSet) const
{
std::vector<BaseRepresentation *> reps = adaptSet->getRepresentations();
return (reps.empty()) ? NULL : *(reps.begin());
return (reps.empty()) ? nullptr : *(reps.begin());
}
BaseRepresentation * RepresentationSelector::highest(BaseAdaptationSet *adaptSet) const
@ -84,8 +84,8 @@ BaseRepresentation * RepresentationSelector::select(BaseAdaptationSet *adaptSet)
}
BaseRepresentation * RepresentationSelector::select(BaseAdaptationSet *adaptSet, uint64_t bitrate) const
{
if (adaptSet == NULL)
return NULL;
if (adaptSet == nullptr)
return nullptr;
std::vector<BaseRepresentation *> reps = adaptSet->getRepresentations();
return select(reps, 0, bitrate);
@ -94,7 +94,7 @@ BaseRepresentation * RepresentationSelector::select(BaseAdaptationSet *adaptSet,
BaseRepresentation * RepresentationSelector::select(std::vector<BaseRepresentation *>& reps,
uint64_t minbitrate, uint64_t maxbitrate) const
{
BaseRepresentation *candidate = NULL, *lowest = NULL;
BaseRepresentation *candidate = nullptr, *lowest = nullptr;
std::vector<BaseRepresentation *>::const_iterator repIt;
for(repIt=reps.begin(); repIt!=reps.end(); ++repIt)
{

6
modules/demux/adaptive/mp4/AtomsReader.cpp

@ -29,7 +29,7 @@ using namespace adaptive::mp4;
AtomsReader::AtomsReader(vlc_object_t *object_)
{
object = object_;
rootbox = NULL;
rootbox = nullptr;
}
AtomsReader::~AtomsReader()
@ -40,7 +40,7 @@ AtomsReader::~AtomsReader()
void AtomsReader::clean()
{
MP4_BoxFree(rootbox);
rootbox = NULL;
rootbox = nullptr;
}
bool AtomsReader::parseBlock(block_t *p_block)
@ -60,7 +60,7 @@ bool AtomsReader::parseBlock(block_t *p_block)
memset(rootbox, 0, sizeof(*rootbox));
rootbox->i_type = ATOM_root;
rootbox->i_size = p_block->i_buffer;
if ( MP4_ReadBoxContainerChildren( stream, rootbox, NULL ) == 1 )
if ( MP4_ReadBoxContainerChildren( stream, rootbox, nullptr ) == 1 )
{
#ifndef NDEBUG
MP4_BoxDumpStructure(stream, rootbox);

2
modules/demux/adaptive/playlist/BaseAdaptationSet.cpp

@ -74,7 +74,7 @@ BaseRepresentation * BaseAdaptationSet::getRepresentationByID(const ID &id)
if((*it)->getID() == id)
return *it;
}
return NULL;
return nullptr;
}
void BaseAdaptationSet::addRepresentation(BaseRepresentation *rep)

4
modules/demux/adaptive/playlist/BasePeriod.cpp

@ -63,7 +63,7 @@ const std::vector<BaseAdaptationSet*>& BasePeriod::getAdaptationSets() const
void BasePeriod::addAdaptationSet(BaseAdaptationSet *adaptationSet)
{
if ( adaptationSet != NULL )
if ( adaptationSet != nullptr )
{
if(adaptationSet->getRepresentations().empty())
{
@ -83,7 +83,7 @@ BaseAdaptationSet *BasePeriod::getAdaptationSetByID(const adaptive::ID &id)
if( (*it)->getID() == id )
return *it;
}
return NULL;
return nullptr;
}
void BasePeriod::debug(vlc_object_t *obj, int indent) const

4
modules/demux/adaptive/playlist/BasePlaylist.cpp

@ -137,7 +137,7 @@ BasePeriod* BasePlaylist::getFirstPeriod()
if( !periods.empty() )
return periods.front();
else
return NULL;
return nullptr;
}
BasePeriod* BasePlaylist::getNextPeriod(BasePeriod *period)
@ -150,7 +150,7 @@ BasePeriod* BasePlaylist::getNextPeriod(BasePeriod *period)
return periods.at(i + 1);
}
return NULL;
return nullptr;
}
bool BasePlaylist::needsUpdates() const

2
modules/demux/adaptive/playlist/ICanonicalUrl.hpp

@ -29,7 +29,7 @@ namespace adaptive
class ICanonicalUrl
{
public:
ICanonicalUrl( const ICanonicalUrl *parent = NULL ) { setParent(parent); }
ICanonicalUrl( const ICanonicalUrl *parent = nullptr ) { setParent(parent); }
virtual ~ICanonicalUrl() = default;
virtual Url getUrlSegment() const = 0;
void setParent( const ICanonicalUrl *parent ) { parentUrlMember = parent; }

20
modules/demux/adaptive/playlist/Inheritables.cpp

@ -37,7 +37,7 @@ using namespace adaptive;
AbstractAttr::AbstractAttr(Type t)
{
type = t;
parentNode = NULL;
parentNode = nullptr;
}
AbstractAttr::~AbstractAttr()
@ -183,7 +183,7 @@ SegmentBase * AttrsNode::inheritSegmentBase() const
AbstractAttr *p = inheritAttribute(Type::SegmentBase);
if(p && p->isValid())
return static_cast<SegmentBase *>(p);
return NULL;
return nullptr;
}
SegmentList * AttrsNode::inheritSegmentList() const
@ -191,7 +191,7 @@ SegmentList * AttrsNode::inheritSegmentList() const
AbstractAttr *p = inheritAttribute(Type::SegmentList);
if(p && p->isValid())
return static_cast<SegmentList *> (p);
return NULL;
return nullptr;
}
SegmentTemplate * AttrsNode::inheritSegmentTemplate() const
@ -199,7 +199,7 @@ SegmentTemplate * AttrsNode::inheritSegmentTemplate() const
AbstractAttr *p = inheritAttribute(Type::SegmentTemplate);
if(p && p->isValid())
return static_cast<SegmentTemplate *> (p);
return NULL;
return nullptr;
}
SegmentTimeline * AttrsNode::inheritSegmentTimeline() const
@ -207,7 +207,7 @@ SegmentTimeline * AttrsNode::inheritSegmentTimeline() const
AbstractAttr *p = inheritAttribute(Type::Timeline);
if(p && p->isValid())
return static_cast<SegmentTimeline *> (p);
return NULL;
return nullptr;
}
AttrsNode * AttrsNode::matchPath(std::list<AbstractAttr::Type>&path)
@ -218,10 +218,10 @@ AttrsNode * AttrsNode::matchPath(std::list<AbstractAttr::Type>&path)
{
AbstractAttr *p = pn->getAttribute(*it);
if(!p || !p->isValid())
return NULL;
return nullptr;
pn = dynamic_cast<AttrsNode *>(p);
if(pn == NULL)
return NULL;
if(pn == nullptr)
return nullptr;
}
return pn;
}
@ -233,7 +233,7 @@ AbstractAttr * AttrsNode::getAttribute(AbstractAttr::Type type)
if((*it)->getType() == type)
return *it;
}
return NULL;
return nullptr;
}
AbstractAttr * AttrsNode::getAttribute(AbstractAttr::Type type) const
@ -251,5 +251,5 @@ AbstractAttr * AttrsNode::getAttribute(AbstractAttr::Type type,
if(p && p->isValid())
return p;
}
return NULL;
return nullptr;
}

2
modules/demux/adaptive/playlist/Inheritables.hpp

@ -71,7 +71,7 @@ namespace adaptive
class AttrsNode : public AbstractAttr
{
public:
AttrsNode( Type, AttrsNode * = NULL );
AttrsNode( Type, AttrsNode * = nullptr );
~AttrsNode();
AttrsNode(const AttrsNode &) = delete;
AttrsNode & operator=(const AttrsNode &) = delete;

4
modules/demux/adaptive/playlist/Segment.cpp

@ -92,7 +92,7 @@ SegmentChunk* ISegment::toChunk(SharedResources *res, AbstractConnectionManager
if(!prepareChunk(res, chunk, rep))
{
delete chunk;
return NULL;
return nullptr;
}
connManager->start(source);
return chunk;
@ -102,7 +102,7 @@ SegmentChunk* ISegment::toChunk(SharedResources *res, AbstractConnectionManager
delete source;
}
}
return NULL;
return nullptr;
}
bool ISegment::isTemplate() const

2
modules/demux/adaptive/playlist/SegmentBase.h

@ -40,7 +40,7 @@ namespace adaptive
public AbstractSegmentBaseType
{
public:
SegmentBase (SegmentInformation * = NULL);
SegmentBase (SegmentInformation * = nullptr);
virtual ~SegmentBase ();
virtual vlc_tick_t getMinAheadTime(uint64_t curnum) const; /* impl */

6
modules/demux/adaptive/playlist/SegmentBaseType.cpp

@ -34,9 +34,9 @@ Segment * AbstractSegmentBaseType::findSegmentByScaledTime(const std::vector<Seg
stime_t time)
{
if(segments.empty() || (segments.size() > 1 && segments[1]->startTime.Get() == 0) )
return NULL;
return nullptr;
Segment *ret = NULL;
Segment *ret = nullptr;
std::vector<Segment *>::const_iterator it = segments.begin();
while(it != segments.end())
{
@ -44,7 +44,7 @@ Segment * AbstractSegmentBaseType::findSegmentByScaledTime(const std::vector<Seg
if(seg->startTime.Get() > time)
{
if(it == segments.begin())
return NULL;
return nullptr;
else
break;
}

2
modules/demux/adaptive/playlist/SegmentChunk.cpp

@ -38,7 +38,7 @@ SegmentChunk::SegmentChunk(AbstractChunkSource *source, BaseRepresentation *rep_
AbstractChunk(source)
{
rep = rep_;
encryptionSession = NULL;
encryptionSession = nullptr;
}
SegmentChunk::~SegmentChunk()

20
modules/demux/adaptive/playlist/SegmentInformation.cpp

@ -48,15 +48,15 @@ SegmentInformation::SegmentInformation(SegmentInformation *parent_) :
SegmentInformation::SegmentInformation(BasePlaylist * parent_) :
ICanonicalUrl(parent_),
AttrsNode( AbstractAttr::Type::SegmentInformation, NULL )
AttrsNode( AbstractAttr::Type::SegmentInformation, nullptr )
{
parent = NULL;
parent = nullptr;
init();
}
void SegmentInformation::init()
{
baseUrl.Set(NULL);
baseUrl.Set(nullptr);
}
SegmentInformation::~SegmentInformation()
@ -69,7 +69,7 @@ BasePlaylist * SegmentInformation::getPlaylist() const
if(parent)
return parent->getPlaylist();
else
return NULL;
return nullptr;
}
const AbstractSegmentBaseType * SegmentInformation::inheritSegmentProfile() const
@ -89,7 +89,7 @@ Segment * SegmentInformation::getNextMediaSegment(uint64_t i_pos,uint64_t *pi_n
{
const AbstractSegmentBaseType *profile = inheritSegmentProfile();
if(!profile)
return NULL;
return nullptr;
return profile->getNextMediaSegment(i_pos, pi_newpos, pb_gap);
}
@ -97,7 +97,7 @@ InitSegment * SegmentInformation::getInitSegment() const
{
const AbstractSegmentBaseType *profile = inheritSegmentProfile();
if(!profile)
return NULL;
return nullptr;
return profile->getInitSegment();
}
@ -105,7 +105,7 @@ IndexSegment *SegmentInformation::getIndexSegment() const
{
const AbstractSegmentBaseType *profile = inheritSegmentProfile();
if(!profile)
return NULL;
return nullptr;
return profile->getIndexSegment();
}
@ -113,7 +113,7 @@ Segment * SegmentInformation::getMediaSegment(uint64_t pos) const
{
const AbstractSegmentBaseType *profile = inheritSegmentProfile();
if(!profile)
return NULL;
return nullptr;
return profile->getMediaSegment(pos);
}
@ -125,7 +125,7 @@ SegmentInformation * SegmentInformation::getChildByID(const adaptive::ID &id)
if( (*it)->getID() == id )
return *it;
}
return NULL;
return nullptr;
}
void SegmentInformation::updateWith(SegmentInformation *updated)
@ -220,7 +220,7 @@ AbstractSegmentBaseType * SegmentInformation::getProfile() const
else if((p = getAttribute(Type::SegmentBase)))
return static_cast<SegmentBase *> (p);
return NULL;
return nullptr;
}
void SegmentInformation::updateSegmentList(SegmentList *list, bool restamp)

10
modules/demux/adaptive/playlist/SegmentList.cpp

@ -58,7 +58,7 @@ Segment * SegmentList::getMediaSegment(uint64_t number) const
{
uint64_t listindex = timeline->getElementIndexBySequence(number);
if(listindex >= segments.size())
return NULL;
return nullptr;
return segments.at(listindex);
}
@ -75,7 +75,7 @@ Segment * SegmentList::getMediaSegment(uint64_t number) const
break;
}
}
return NULL;
return nullptr;
}
void SegmentList::addSegment(Segment *seg)
@ -94,7 +94,7 @@ void SegmentList::updateWith(AbstractMultipleSegmentBaseType *updated_,
if(!updated || updated->segments.empty())
return;
const Segment * lastSegment = (segments.empty()) ? NULL : segments.back();
const Segment * lastSegment = (segments.empty()) ? nullptr : segments.back();
const Segment * prevSegment = lastSegment;
uint64_t firstnumber = updated->segments.front()->getSequenceNumber();
@ -250,7 +250,7 @@ Segment * SegmentList::getNextMediaSegment(uint64_t i_pos,uint64_t *pi_newpos,
{
uint64_t listindex = timeline->getElementIndexBySequence(i_pos);
if(listindex >= segments.size())
return NULL;
return nullptr;
return segments.at(listindex);
}
@ -265,7 +265,7 @@ Segment * SegmentList::getNextMediaSegment(uint64_t i_pos,uint64_t *pi_newpos,
return seg;
}
}
return NULL;
return nullptr;
}
uint64_t SegmentList::getStartSegmentNumber() const

2
modules/demux/adaptive/playlist/SegmentList.h

@ -38,7 +38,7 @@ namespace adaptive
class SegmentList : public AbstractMultipleSegmentBaseType
{
public:
SegmentList ( SegmentInformation * = NULL );
SegmentList ( SegmentInformation * = nullptr );
virtual ~SegmentList ();
const std::vector<Segment *>& getSegments() const;

14
modules/demux/adaptive/playlist/SegmentTemplate.cpp

@ -53,7 +53,7 @@ void SegmentTemplateSegment::setSourceUrl(const std::string &url)
SegmentTemplate::SegmentTemplate( SegmentInformation *parent ) :
AbstractMultipleSegmentBaseType( parent, AbstractAttr::Type::SegmentTemplate )
{
initialisationSegment.Set( NULL );
initialisationSegment.Set( nullptr );
parentSegmentInformation = parent;
segments.push_back( new SegmentTemplateSegment( this, parent ) );
}
@ -128,7 +128,7 @@ vlc_tick_t SegmentTemplate::getMinAheadTime(uint64_t number) const
else
{
const Timescale timescale = inheritTimescale();
uint64_t current = getLiveTemplateNumber(vlc_tick_from_sec(time(NULL)));
uint64_t current = getLiveTemplateNumber(vlc_tick_from_sec(time(nullptr)));
stime_t i_length = (current - number) * inheritDuration();
return timescale.ToTime(i_length);
}
@ -137,9 +137,9 @@ vlc_tick_t SegmentTemplate::getMinAheadTime(uint64_t number) const
Segment * SegmentTemplate::getMediaSegment(uint64_t number) const
{
const SegmentTimeline *tl = inheritSegmentTimeline();
if(tl == NULL || tl->maxElementNumber() > number)
if(tl == nullptr || tl->maxElementNumber() > number)
return *segments.begin();
return NULL;
return nullptr;
}
InitSegment * SegmentTemplate::getInitSegment() const
@ -158,7 +158,7 @@ Segment * SegmentTemplate::getNextMediaSegment(uint64_t i_pos,uint64_t *pi_newp
{
*pi_newpos = std::max(timeline->minElementNumber(), i_pos);
if (timeline->maxElementNumber() < i_pos)
return NULL;
return nullptr;
}
else
{
@ -178,7 +178,7 @@ Segment * SegmentTemplate::getNextMediaSegment(uint64_t i_pos,uint64_t *pi_newp
if(i_pos >= endnum)
{
*pi_newpos = i_pos;
return NULL;
return nullptr;
}
}
}
@ -212,7 +212,7 @@ bool SegmentTemplate::getSegmentNumberByTime(vlc_tick_t time, uint64_t *ret) con
BasePlaylist *playlist = parent->getPlaylist();
if( playlist->isLive() )
{
vlc_tick_t now = vlc_tick_from_sec(::time(NULL));
vlc_tick_t now = vlc_tick_from_sec(::time(nullptr));
if(playlist->availabilityStartTime.Get())
{
if(time >= playlist->availabilityStartTime.Get() && time < now)

6
modules/demux/adaptive/playlist/SegmentTemplate.h

@ -39,7 +39,7 @@ namespace adaptive
class SegmentTemplateSegment : public Segment
{
public:
SegmentTemplateSegment( SegmentTemplate *, ICanonicalUrl * = NULL );
SegmentTemplateSegment( SegmentTemplate *, ICanonicalUrl * = nullptr );
virtual ~SegmentTemplateSegment();
virtual void setSourceUrl( const std::string &url ); /* reimpl */
@ -50,7 +50,7 @@ namespace adaptive
class SegmentTemplate : public AbstractMultipleSegmentBaseType
{
public:
SegmentTemplate( SegmentInformation * = NULL );
SegmentTemplate( SegmentInformation * = nullptr );
virtual ~SegmentTemplate();
void setSourceUrl( const std::string &url );
uint64_t getLiveTemplateNumber(vlc_tick_t, bool = true) const;
@ -77,7 +77,7 @@ namespace adaptive
class SegmentTemplateInit : public InitSegment
{
public:
SegmentTemplateInit( SegmentTemplate *, ICanonicalUrl * = NULL );
SegmentTemplateInit( SegmentTemplate *, ICanonicalUrl * = nullptr );
virtual ~SegmentTemplateInit();
virtual void setSourceUrl( const std::string &url ); /* reimpl */

2
modules/demux/adaptive/playlist/SegmentTimeline.cpp

@ -88,7 +88,7 @@ stime_t SegmentTimeline::getMinAheadScaledTime(uint64_t number) const
uint64_t SegmentTimeline::getElementNumberByScaledPlaybackTime(stime_t scaled) const
{
const Element *prevel = NULL;
const Element *prevel = nullptr;
std::list<Element *>::const_iterator it;
if(!elements.size())

4
modules/demux/adaptive/playlist/Templates.hpp

@ -30,7 +30,7 @@ namespace adaptive
public:
Initializable()
{
initialisationSegment.Set(NULL);
initialisationSegment.Set(nullptr);
}
~Initializable()
{
@ -44,7 +44,7 @@ namespace adaptive
public:
Indexable()
{
indexSegment.Set(NULL);
indexSegment.Set(nullptr);
}
~Indexable()
{

2
modules/demux/adaptive/playlist/Url.cpp

@ -104,7 +104,7 @@ Url & Url::append(const Url &url)
std::string Url::toString() const
{
return toString(0, NULL);
return toString(0, nullptr);
}
std::string Url::toString(size_t index, const BaseRepresentation *rep) const

2
modules/demux/adaptive/playlist/Url.hpp

@ -38,7 +38,7 @@ namespace adaptive
{
friend class Url;
public:
Component(const std::string &, const SegmentTemplate * = NULL);
Component(const std::string &, const SegmentTemplate * = nullptr);
protected:
std::string component;

4
modules/demux/adaptive/plumbing/CommandsQueue.cpp

@ -85,7 +85,7 @@ void EsOutSendCommand::Execute( es_out_t *out )
p_fakeid->notifyData();
if( p_fakeid->realESID() &&
es_out_Send( out, p_fakeid->realESID(), p_block ) == VLC_SUCCESS )
p_block = NULL;
p_block = nullptr;
p_fakeid->notifyData();
}
@ -223,7 +223,7 @@ EsOutMetaCommand * CommandsFactory::createEsOutMetaCommand( int group, const vlc
vlc_meta_Merge( p_dup, p_meta );
return new (std::nothrow) EsOutMetaCommand( group, p_dup );
}
return NULL;
return nullptr;
}
/*

8
modules/demux/adaptive/plumbing/Demuxer.cpp

@ -97,7 +97,7 @@ MimeDemuxer::MimeDemuxer(vlc_object_t *p_obj_,
p_es_out = out;
factory = factory_;
p_obj = p_obj_;
demuxer = NULL;
demuxer = nullptr;
sourcestream = source;
}
@ -152,7 +152,7 @@ void MimeDemuxer::destroy()
if(demuxer)
{
delete demuxer;
demuxer = NULL;
demuxer = nullptr;
}
sourcestream->Reset();
}
@ -177,7 +177,7 @@ Demuxer::Demuxer(vlc_object_t *p_obj_, const std::string &name_,
p_es_out = out;
name = name_;
p_obj = p_obj_;
p_demux = NULL;
p_demux = nullptr;
b_eof = false;
sourcestream = source;
@ -225,7 +225,7 @@ void Demuxer::destroy()
if(p_demux)
{
demux_Delete(p_demux);
p_demux = NULL;
p_demux = nullptr;
}
sourcestream->Reset();
}

10
modules/demux/adaptive/plumbing/FakeESOut.cpp

@ -138,7 +138,7 @@ FakeESOut * FakeESOut::LockedFakeEsOut::operator ->()
FakeESOut::FakeESOut( es_out_t *es, CommandsQueue *queue )
: AbstractFakeEsOut()
, real_es_out( es )
, extrainfo( NULL )
, extrainfo( nullptr )
, commandsqueue( queue )
, timestamps_offset( 0 )
{
@ -241,7 +241,7 @@ FakeESOutID * FakeESOut::createNewID( const es_format_t *p_fmt )
void FakeESOut::createOrRecycleRealEsID( FakeESOutID *es_id )
{
std::list<FakeESOutID *>::iterator it;
es_out_id_t *realid = NULL;
es_out_id_t *realid = nullptr;
/* declared ES must are temporary until real ES decl */
recycle_candidates.insert(recycle_candidates.begin(), declared.begin(), declared.end());
@ -255,7 +255,7 @@ void FakeESOut::createOrRecycleRealEsID( FakeESOutID *es_id )
if ( cand->isCompatible( es_id ) )
{
realid = cand->realESID();
cand->setRealESID( NULL );
cand->setRealESID( nullptr );
delete *it;
recycle_candidates.erase( it );
break;
@ -465,7 +465,7 @@ es_out_id_t * FakeESOut::esOutAdd(const es_format_t *p_fmt)
vlc_mutex_locker locker(&lock);
if( p_fmt->i_cat != VIDEO_ES && p_fmt->i_cat != AUDIO_ES && p_fmt->i_cat != SPU_ES )
return NULL;
return nullptr;
/* Feed the slave demux/stream_Demux with FakeESOutID struct,
* we'll create real ES later on main demux on execution */
@ -485,7 +485,7 @@ es_out_id_t * FakeESOut::esOutAdd(const es_format_t *p_fmt)
delete es_id;
}
}
return NULL;
return nullptr;
}
int FakeESOut::esOutSend(es_out_id_t *p_es, block_t *p_block)

2
modules/demux/adaptive/plumbing/FakeESOutID.cpp

@ -29,7 +29,7 @@ using namespace adaptive;
FakeESOutID::FakeESOutID( FakeESOut *fakeesout, const es_format_t *p_fmt )
: fakeesout( fakeesout )
, p_real_es_id( NULL )
, p_real_es_id( nullptr )
, pending_delete( false )
{
es_format_Copy( &fmt, p_fmt );

14
modules/demux/adaptive/plumbing/SourceStream.cpp

@ -107,7 +107,7 @@ stream_t * AbstractChunksSourceStream::makeStream()
{
p_stream->pf_control = control_Callback;
p_stream->pf_read = read_Callback;
p_stream->pf_readdir = NULL;
p_stream->pf_readdir = nullptr;
p_stream->pf_seek = seek_Callback;
p_stream->p_sys = this;
}
@ -117,7 +117,7 @@ stream_t * AbstractChunksSourceStream::makeStream()
ChunksSourceStream::ChunksSourceStream(vlc_object_t *p_obj_, AbstractSource *source_)
: AbstractChunksSourceStream(p_obj_, source_)
{
p_block = NULL;
p_block = nullptr;
}
ChunksSourceStream::~ChunksSourceStream()
@ -130,7 +130,7 @@ void ChunksSourceStream::Reset()
{
if(p_block)
block_Release(p_block);
p_block = NULL;
p_block = nullptr;
AbstractChunksSourceStream::Reset();
}
@ -186,7 +186,7 @@ ssize_t ChunksSourceStream::Read(uint8_t *buf, size_t size)
i_copied += p_block->i_buffer;
i_toread -= p_block->i_buffer;
block_Release(p_block);
p_block = NULL;
p_block = nullptr;
}
}
@ -204,7 +204,7 @@ BufferedChunksSourceStream::BufferedChunksSourceStream(vlc_object_t *p_obj_, Abs
i_global_offset = 0;
i_bytestream_offset = 0;
block_BytestreamInit( &bs );
p_peekdata = NULL;
p_peekdata = nullptr;
}
BufferedChunksSourceStream::~BufferedChunksSourceStream()
@ -258,7 +258,7 @@ ssize_t BufferedChunksSourceStream::Read(uint8_t *buf, size_t i_toread)
const size_t i_drop = i_bytestream_offset - MAX_BACKEND;
if(i_drop >= MIN_BACKEND_CLEANUP) /* Dont flush for few bytes */
{
block_GetBytes(&bs, NULL, i_drop);
block_GetBytes(&bs, nullptr, i_drop);
block_BytestreamFlush(&bs);
i_bytestream_offset -= i_drop;
i_global_offset += i_drop;
@ -328,6 +328,6 @@ void BufferedChunksSourceStream::invalidatePeek()
if(p_peekdata)
{
block_Release(p_peekdata);
p_peekdata = NULL;
p_peekdata = nullptr;
}
}

4
modules/demux/adaptive/tools/Conversions.cpp

@ -30,7 +30,7 @@
/*
Decodes a duration as defined by ISO 8601
http://en.wikipedia.org/wiki/ISO_8601#Durations
@param str A null-terminated string to convert
@param str A nullptr-terminated string to convert
@return: The duration in seconds. -1 if an error occurred.
Exemple input string: "PT0H9M56.46S"
@ -41,7 +41,7 @@ static vlc_tick_t str_duration( const char *psz_duration )
vlc_tick_t res = 0;
char* end_ptr;
if ( psz_duration == NULL )
if ( psz_duration == nullptr )
return -1;
if ( ( *(psz_duration++) ) != 'P' )
return -1;

2
modules/demux/adaptive/tools/FormatNamespace.cpp

@ -58,7 +58,7 @@ void FormatNamespace::ParseMPEG4Elements(const std::vector<std::string> &element
return;
uint8_t objectType = std::stoi(elements.at(0).substr(0,2), nullptr, 16);
if(!MPEG4_Codec_By_ObjectType(objectType, NULL, 0,
if(!MPEG4_Codec_By_ObjectType(objectType, nullptr, 0,
&fmt.i_codec,
&fmt.i_profile))
return;

2
modules/demux/adaptive/tools/Retrieve.cpp

@ -39,7 +39,7 @@ block_t * Retrieve::HTTP(SharedResources *resources, const std::string &uri)
{
datachunk = new HTTPChunk(uri, resources->getConnManager(), ID(), true);
} catch (...) {
return NULL;
return nullptr;
}
block_t *block = datachunk->read(1<<25);

2
modules/demux/adaptive/xml/DOMHelper.cpp

@ -78,5 +78,5 @@ Node* DOMHelper::getFirstChildElementByName( Node *root, const std::st
if( root->getSubNodes().at( i )->getName() == name )
return root->getSubNodes().at( i );
}
return NULL;
return nullptr;
}

24
modules/demux/adaptive/xml/DOMParser.cpp

@ -34,16 +34,16 @@
using namespace adaptive::xml;
DOMParser::DOMParser() :
root( NULL ),
stream( NULL ),
vlc_reader( NULL )
root( nullptr ),
stream( nullptr ),
vlc_reader( nullptr )
{
}
DOMParser::DOMParser (stream_t *stream) :
root( NULL ),
root( nullptr ),
stream( stream ),
vlc_reader( NULL )
vlc_reader( nullptr )
{
}
@ -68,10 +68,10 @@ bool DOMParser::parse (bool b)
struct vlc_logger *const logger = vlc_reader->obj.logger;
if(!b)
vlc_reader->obj.logger = NULL;
vlc_reader->obj.logger = nullptr;
root = processNode(b);
vlc_reader->obj.logger = logger;
if ( root == NULL )
if ( root == nullptr )
return false;
return true;
@ -83,7 +83,7 @@ bool DOMParser::reset(stream_t *s)
if(!vlc_reader)
return true;
delete root;
root = NULL;
root = nullptr;
xml_ReaderDelete(vlc_reader);
vlc_reader = xml_ReaderCreate(s, s);
@ -129,7 +129,7 @@ Node* DOMParser::processNode(bool b_strict)
case XML_READER_ENDELEM:
{
if(lifo.empty())
return NULL;
return nullptr;
Node *node = lifo.top();
lifo.pop();
@ -145,12 +145,12 @@ Node* DOMParser::processNode(bool b_strict)
while( lifo.size() > 1 )
lifo.pop();
Node *node = (!lifo.empty()) ? lifo.top() : NULL;
Node *node = (!lifo.empty()) ? lifo.top() : nullptr;
if(b_strict && node)
{
delete node;
return NULL;
return nullptr;
}
return node;
@ -161,7 +161,7 @@ void DOMParser::addAttributesToNode (Node *node)
const char *attrValue;
const char *attrName;
while((attrName = xml_ReaderNextAttr(this->vlc_reader, &attrValue)) != NULL)
while((attrName = xml_ReaderNextAttr(this->vlc_reader, &attrValue)) != nullptr)
{
std::string key = attrName;
std::string value = attrValue;

6
modules/demux/dash/DASHManager.cpp

@ -65,7 +65,7 @@ DASHManager::~DASHManager ()
void DASHManager::scheduleNextUpdate()
{
time_t now = time(NULL);
time_t now = time(nullptr);
vlc_tick_t minbuffer = 0;
std::vector<AbstractStream *>::const_iterator it;
@ -90,7 +90,7 @@ void DASHManager::scheduleNextUpdate()
bool DASHManager::needsUpdate() const
{
if(nextPlaylistupdate && time(NULL) < nextPlaylistupdate)
if(nextPlaylistupdate && time(nullptr) < nextPlaylistupdate)
return false;
return PlaylistManager::needsUpdate();
@ -152,7 +152,7 @@ int DASHManager::doControl(int i_query, va_list args)
vlc_meta_t *p_meta = va_arg (args, vlc_meta_t *);
vlc_meta_t *meta = vlc_meta_New();
if (meta == NULL)
if (meta == nullptr)
return VLC_EGENERIC;
if(!mpd->programInfo.Get()->getTitle().empty())

4
modules/demux/dash/DASHStream.cpp

@ -38,7 +38,7 @@ block_t * DASHStream::checkBlock(block_t *p_block, bool)
AbstractDemuxer *DASHStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
es_out_t *out, AbstractSourceStream *source) const
{
AbstractDemuxer *ret = NULL;
AbstractDemuxer *ret = nullptr;
switch((unsigned)format)
{
case StreamFormat::MP4:
@ -73,7 +73,7 @@ AbstractStream * DASHStreamFactory::create(demux_t *realdemux, const StreamForma
if(stream && !stream->init(format, tracker, manager))
{
delete stream;
return NULL;
return nullptr;
}
return stream;
}

2
modules/demux/dash/mpd/DASHCommonAttributesElements.cpp

@ -113,7 +113,7 @@ const std::list<ContentDescription*> &DASHCommonAttributesElements::getContentPr
void DASHCommonAttributesElements::addContentProtection(ContentDescription *desc)
{
if ( desc != NULL )
if ( desc != nullptr )
this->contentProtections.push_back( desc );
}

6
modules/demux/dash/mpd/IsoffMainParser.cpp

@ -230,7 +230,7 @@ void IsoffMainParser::parseMultipleSegmentBaseType(MPD *mpd, Node *node,
size_t IsoffMainParser::parseSegmentTemplate(MPD *mpd, Node *templateNode, SegmentInformation *info)
{
size_t total = 0;
if (templateNode == NULL)
if (templateNode == nullptr)
return total;
std::string mediaurl;
@ -392,7 +392,7 @@ void IsoffMainParser::parseRepresentations (MPD *mpd, Node *adaptationSetNode
/* Empty Representation with just baseurl (ex: subtitles) */
if(i_total == 0 &&
(currentRepresentation->baseUrl.Get() && !currentRepresentation->baseUrl.Get()->empty()) &&
adaptationSet->getMediaSegment(0) == NULL)
adaptationSet->getMediaSegment(0) == nullptr)
{
SegmentBase *base = new (std::nothrow) SegmentBase(currentRepresentation);
if(base)
@ -572,7 +572,7 @@ void IsoffMainParser::parseProgramInformation(Node * node, MPD *mpd)
Profile IsoffMainParser::getProfile() const
{
Profile res(Profile::Name::Unknown);
if(this->root == NULL)
if(this->root == nullptr)
return res;
std::string urn = root->getAttributeValue("profiles");

2
modules/demux/dash/mpd/MPD.cpp

@ -41,7 +41,7 @@ MPD::MPD (vlc_object_t *p_object, Profile profile_) :
BasePlaylist(p_object),
profile( profile_ )
{
programInfo.Set( NULL );
programInfo.Set( nullptr );
lowLatency = false;
}

4
modules/demux/hls/HLSStreams.cpp

@ -128,7 +128,7 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
AbstractDemuxer *HLSStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
es_out_t *out, AbstractSourceStream *source) const
{
AbstractDemuxer *ret = NULL;
AbstractDemuxer *ret = nullptr;
switch((unsigned)format)
{
case StreamFormat::PACKEDAAC:
@ -171,7 +171,7 @@ AbstractStream * HLSStreamFactory::create(demux_t *realdemux, const StreamFormat
if(stream && !stream->init(format, tracker, manager))
{
delete stream;
return NULL;
return nullptr;
}
return stream;
}

24
modules/demux/hls/playlist/Parser.cpp

@ -77,7 +77,7 @@ static Tag * getTagFromList(std::list<Tag *> &list, int tag)
if( (*it)->getType() == tag )
return *it;
}
return NULL;
return nullptr;
}
static void releaseTagsList(std::list<Tag *> &list)
@ -220,9 +220,9 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
uint64_t sequenceNumber = 0;
bool discontinuity = false;
std::size_t prevbyterangeoffset = 0;
const SingleValueTag *ctx_byterange = NULL;
const SingleValueTag *ctx_byterange = nullptr;
CommonEncryption encryption;
const ValuesListTag *ctx_extinf = NULL;
const ValuesListTag *ctx_extinf = nullptr;
std::list<Tag *>::const_iterator it;
for(it = tagslist.begin(); it != tagslist.end(); ++it)
@ -248,8 +248,8 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
const SingleValueTag *uritag = static_cast<const SingleValueTag *>(tag);
if(uritag->getValue().value.empty())
{
ctx_extinf = NULL;
ctx_byterange = NULL;
ctx_extinf = nullptr;
ctx_byterange = nullptr;
break;
}
@ -266,7 +266,7 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
const Attribute *durAttribute = ctx_extinf->getAttributeByName("DURATION");
if(durAttribute)
nzDuration = vlc_tick_from_sec(durAttribute->floatingPoint());
ctx_extinf = NULL;
ctx_extinf = nullptr;
}
segment->duration.Set(timescale.ToScaled(nzDuration));
segment->startTime.Set(timescale.ToScaled(nzStartTime));
@ -287,7 +287,7 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
range.first = prevbyterangeoffset;
prevbyterangeoffset = range.first + range.second;
segment->setByteRange(range.first, prevbyterangeoffset - 1);
ctx_byterange = NULL;
ctx_byterange = nullptr;
}
if(discontinuity)
@ -375,13 +375,13 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
(psz_line[7] && !std::isspace(psz_line[7])))
{
free(psz_line);
return NULL;
return nullptr;
}
free(psz_line);
M3U8 *playlist = new (std::nothrow) M3U8(p_object);
if(!playlist)
return NULL;
return nullptr;
if(!playlisturl.empty())
playlist->setPlaylistUrl( Helper::getDirectoryPath(playlisturl).append("/") );
@ -588,7 +588,7 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
std::list<Tag *> M3U8Parser::parseEntries(stream_t *stream)
{
std::list<Tag *> entrieslist;
Tag *lastTag = NULL;
Tag *lastTag = nullptr;
char *psz_line;
while((psz_line = vlc_stream_ReadLine(stream)))
@ -636,11 +636,11 @@ std::list<Tag *> M3U8Parser::parseEntries(stream_t *stream)
if(tag)
entrieslist.push_back(tag);
}
lastTag = NULL;
lastTag = nullptr;
}
else // drop
{
lastTag = NULL;
lastTag = nullptr;
}
free(psz_line);

6
modules/demux/hls/playlist/Tags.cpp

@ -190,7 +190,7 @@ const Attribute * AttributesTag::getAttributeByName(const char *name) const
if((*it)->name == name)
return *it;
return NULL;
return nullptr;
}
void AttributesTag::addAttribute(Attribute *attr)
@ -323,7 +323,7 @@ Tag * TagFactory::createTagByName(const std::string &name, const std::string &va
{"EXT-X-SESSION-KEY", AttributesTag::EXTXSESSIONKEY},
{"EXTINF", ValuesListTag::EXTINF},
{"", SingleValueTag::URI},
{NULL, 0},
{nullptr, 0},
};
@ -364,5 +364,5 @@ Tag * TagFactory::createTagByName(const std::string &name, const std::string &va
}
return NULL;
return nullptr;
}

12
modules/demux/smooth/SmoothManager.cpp

@ -59,13 +59,13 @@ Manifest * SmoothManager::fetchManifest()
block_t *p_block = Retrieve::HTTP(resources, playlisturl);
if(!p_block)
return NULL;
return nullptr;
stream_t *memorystream = vlc_stream_MemoryNew(p_demux, p_block->p_buffer, p_block->i_buffer, true);
if(!memorystream)
{
block_Release(p_block);
return NULL;
return nullptr;
}
xml::DOMParser parser(memorystream);
@ -73,10 +73,10 @@ Manifest * SmoothManager::fetchManifest()
{
vlc_stream_Delete(memorystream);
block_Release(p_block);
return NULL;
return nullptr;
}
Manifest *manifest = NULL;
Manifest *manifest = nullptr;
ManifestParser *manifestParser = new (std::nothrow) ManifestParser(parser.getRootNode(), VLC_OBJECT(p_demux),
memorystream, playlisturl);
@ -117,7 +117,7 @@ bool SmoothManager::updatePlaylist()
void SmoothManager::scheduleNextUpdate()
{
time_t now = time(NULL);
time_t now = time(nullptr);
vlc_tick_t minbuffer = 0;
std::vector<AbstractStream *>::const_iterator it;
@ -145,7 +145,7 @@ void SmoothManager::scheduleNextUpdate()
bool SmoothManager::needsUpdate() const
{
if(nextPlaylistupdate && time(NULL) < nextPlaylistupdate)
if(nextPlaylistupdate && time(nullptr) < nextPlaylistupdate)
return false;
return PlaylistManager::needsUpdate();

4
modules/demux/smooth/SmoothStream.cpp

@ -35,7 +35,7 @@ AbstractDemuxer *SmoothStream::newDemux(vlc_object_t *p_obj, const StreamFormat
es_out_t *out, AbstractSourceStream *source) const
{
if((unsigned)format != StreamFormat::MP4)
return NULL;
return nullptr;
return AbstractStream::newDemux(p_obj, format, out, source);
}
@ -51,7 +51,7 @@ AbstractStream * SmoothStreamFactory::create(demux_t *realdemux, const StreamFor
if(stream && !stream->init(format,tracker, manager))
{
delete stream;
return NULL;
return nullptr;
}
return stream;
}

2
modules/demux/smooth/mp4/IndexReader.cpp

@ -60,7 +60,7 @@ bool IndexReader::parseIndex(block_t *p_block, BaseRepresentation *rep)
if(!uuid_box)
return false;
SegmentTimeline *timelineadd = new (std::nothrow) SegmentTimeline(NULL);
SegmentTimeline *timelineadd = new (std::nothrow) SegmentTimeline(nullptr);
if (timelineadd)
{
const MP4_Box_data_tfrf_t *p_tfrfdata = uuid_box->data.p_tfrf;

22
modules/demux/smooth/playlist/ForgedInitSegment.cpp

@ -48,7 +48,7 @@ ForgedInitSegment::ForgedInitSegment(ICanonicalUrl *parent,
{
type = type_;
duration.Set(duration_);
extradata = NULL;
extradata = nullptr;
i_extradata = 0;
timescale = timescale_;
formatex.cbSize = 0;
@ -76,7 +76,7 @@ static uint8_t *HexDecode(const std::string &s, size_t *decoded_size)
if(data)
{
for(size_t i=0; i<*decoded_size; i++)
data[i] = std::strtoul(s.substr(i*2, 2).c_str(), NULL, 16);
data[i] = std::strtoul(s.substr(i*2, 2).c_str(), nullptr, 16);
}
return data;
}
@ -86,7 +86,7 @@ void ForgedInitSegment::fromWaveFormatEx(const uint8_t *p_data, size_t i_data)
if(i_data >= sizeof(WAVEFORMATEX))
{
formatex.wFormatTag = GetWLE(p_data);
wf_tag_to_fourcc(formatex.wFormatTag, &fourcc, NULL);
wf_tag_to_fourcc(formatex.wFormatTag, &fourcc, nullptr);
formatex.nChannels = GetWLE(&p_data[2]);
formatex.nSamplesPerSec = GetDWLE(&p_data[4]);
formatex.nAvgBytesPerSec = GetDWLE(&p_data[8]);
@ -98,7 +98,7 @@ void ForgedInitSegment::fromWaveFormatEx(const uint8_t *p_data, size_t i_data)
if(extradata)
{
free(extradata);
extradata = NULL;
extradata = nullptr;
i_extradata = 0;
}
formatex.cbSize = __MIN(i_data - sizeof(WAVEFORMATEX), formatex.cbSize);
@ -132,7 +132,7 @@ void ForgedInitSegment::setCodecPrivateData(const std::string &extra)
if(extradata)
{
free(extradata);
extradata = NULL;
extradata = nullptr;
i_extradata = 0;
}
extradata = HexDecode(extra, &i_extradata);
@ -175,7 +175,7 @@ void ForgedInitSegment::setTrackID(unsigned i)
void ForgedInitSegment::setAudioTag(uint16_t i)
{
wf_tag_to_fourcc(i, &fourcc, NULL);
wf_tag_to_fourcc(i, &fourcc, nullptr);
}
void ForgedInitSegment::setFourCC(const std::string &fcc)
@ -272,11 +272,11 @@ block_t * ForgedInitSegment::buildMoovBox()
if(!language.empty())
fmt.psz_language = strdup(language.c_str());
bo_t *box = NULL;
bo_t *box = nullptr;
mp4mux_handle_t *muxh = mp4mux_New(FRAGMENTED);
if(muxh)
{
if(mp4mux_CanMux(NULL, &fmt, VLC_FOURCC('s', 'm', 'o', 'o'), true ))
if(mp4mux_CanMux(nullptr, &fmt, VLC_FOURCC('s', 'm', 'o', 'o'), true ))
{
mp4mux_trackinfo_t *p_track = mp4mux_track_Add(muxh,
0x01, /* Will always be 1st and unique track; tfhd patched on block read */
@ -285,14 +285,14 @@ block_t * ForgedInitSegment::buildMoovBox()
mp4mux_track_ForceDuration(p_track, duration.Get());
}
box = mp4mux_GetMoov(muxh, NULL, timescale.ToTime(duration.Get()));
box = mp4mux_GetMoov(muxh, nullptr, timescale.ToTime(duration.Get()));
}
es_format_Clean(&fmt);
if(!box)
{
mp4mux_Delete(muxh);
return NULL;
return nullptr;
}
block_t *moov = box->b;
@ -332,5 +332,5 @@ SegmentChunk* ForgedInitSegment::toChunk(SharedResources *, AbstractConnectionMa
delete source;
}
}
return NULL;
return nullptr;
}

8
modules/demux/smooth/playlist/MemoryChunk.cpp

@ -47,11 +47,11 @@ bool MemoryChunkSource::hasMoreData() const
block_t * MemoryChunkSource::readBlock()
{
block_t *p_block = NULL;
block_t *p_block = nullptr;
if(data)
{
p_block = data;
data = NULL;
data = nullptr;
}
return p_block;
}
@ -59,9 +59,9 @@ block_t * MemoryChunkSource::readBlock()
block_t * MemoryChunkSource::read(size_t toread)
{
if(!data)
return NULL;
return nullptr;
block_t * p_block = NULL;
block_t * p_block = nullptr;
toread = __MIN(data->i_buffer - i_read, toread);
if(toread > 0)

4
modules/demux/smooth/playlist/Parser.cpp

@ -54,7 +54,7 @@ ManifestParser::~ManifestParser()
static SegmentTimeline *createTimeline(Node *streamIndexNode)
{
SegmentTimeline *timeline = new (std::nothrow) SegmentTimeline(NULL);
SegmentTimeline *timeline = new (std::nothrow) SegmentTimeline(nullptr);
if(timeline)
{
std::vector<Node *> chunks = DOMHelper::getElementByTagName(streamIndexNode, "c", true);
@ -264,7 +264,7 @@ Manifest * ManifestParser::parse()
{
Manifest *manifest = new (std::nothrow) Manifest(p_object);
if(!manifest)
return NULL;
return nullptr;
manifest->setPlaylistUrl(Helper::getDirectoryPath(playlisturl).append("/"));

2
modules/demux/smooth/playlist/SmoothSegment.hpp

@ -40,7 +40,7 @@ namespace smooth
class SmoothSegmentTemplate : public SegmentTemplate
{
public:
SmoothSegmentTemplate(SegmentInformation * = NULL);
SmoothSegmentTemplate(SegmentInformation * = nullptr);
~SmoothSegmentTemplate();
virtual SegmentChunk* createChunk(AbstractChunkSource *, BaseRepresentation *); /* reimpl */
};

16
test/modules/demux/dashuri.cpp

@ -39,49 +39,49 @@ static const struct
{
"",
"",
NULL,
nullptr,
0,
},
{
"$",
"$",
NULL,
nullptr,
0,
},
{
"/Num$$ber.m4v",
"/Num$ber.m4v",
NULL,
nullptr,
0,
},
{
"/$Number$.m4v",
"/123.m4v",
NULL,
nullptr,
123,
},
{
"/$$$Number$.m4v",
"/$456789123.m4v",
NULL,
nullptr,
456789123,
},
{
"$Number%d$",
"123",
NULL,
nullptr,
123,
},
{
"/$Number%5d$.m4v",
"/00001.m4v",
NULL,
nullptr,
1,
},
{
"/$Number%2d$.m4v",
"/123456.m4v",
NULL,
nullptr,
123456, /* Must not truncate */
},
{

Loading…
Cancel
Save