[vlc-commits] demux: adaptive: use enum classes for statuses, fix return value
Francois Cartegnie
git at videolan.org
Tue Jan 5 20:25:35 UTC 2021
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 31 15:19:30 2020 +0100| [5afa6c17d9938f9069c56ed46f3d6d9c4a9e1e4d] | committer: Francois Cartegnie
demux: adaptive: use enum classes for statuses, fix return value
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5afa6c17d9938f9069c56ed46f3d6d9c4a9e1e4d
---
modules/demux/adaptive/PlaylistManager.cpp | 44 ++++++++++++------------
modules/demux/adaptive/PlaylistManager.h | 4 +--
modules/demux/adaptive/Streams.cpp | 44 ++++++++++++------------
modules/demux/adaptive/Streams.hpp | 36 +++++++++----------
modules/demux/adaptive/Time.hpp | 2 +-
modules/demux/adaptive/http/Chunk.cpp | 4 +--
modules/demux/adaptive/http/Chunk.h | 6 ++--
modules/demux/adaptive/http/ConnectionParams.hpp | 2 +-
modules/demux/adaptive/http/HTTPConnection.cpp | 13 ++++---
modules/demux/adaptive/http/HTTPConnection.hpp | 14 ++++----
modules/demux/adaptive/plumbing/Demuxer.cpp | 12 +++----
modules/demux/adaptive/plumbing/Demuxer.hpp | 8 ++---
12 files changed, 94 insertions(+), 95 deletions(-)
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index c8156dffa8..9f53c0dcc8 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -196,7 +196,7 @@ void PlaylistManager::stop()
struct PrioritizedAbstractStream
{
- AbstractStream::buffering_status status;
+ AbstractStream::BufferingStatus status;
vlc_tick_t demuxed_amount;
AbstractStream *st;
};
@@ -213,10 +213,10 @@ static bool streamCompare(const PrioritizedAbstractStream &a, const Prioritized
return false;
}
-AbstractStream::buffering_status PlaylistManager::bufferize(vlc_tick_t i_nzdeadline,
+AbstractStream::BufferingStatus PlaylistManager::bufferize(vlc_tick_t i_nzdeadline,
vlc_tick_t i_min_buffering, vlc_tick_t i_extra_buffering)
{
- AbstractStream::buffering_status i_return = AbstractStream::buffering_end;
+ AbstractStream::BufferingStatus i_return = AbstractStream::BufferingStatus::End;
/* First reorder by status >> buffering level */
std::vector<PrioritizedAbstractStream> prioritized_streams(streams.size());
@@ -249,24 +249,24 @@ AbstractStream::buffering_status PlaylistManager::bufferize(vlc_tick_t i_nzdeadl
/* initial */
}
- AbstractStream::buffering_status i_ret = st->bufferize(i_nzdeadline,
+ AbstractStream::BufferingStatus i_ret = st->bufferize(i_nzdeadline,
i_min_buffering,
i_extra_buffering,
getActiveStreamsCount() <= 1);
- if(i_return != AbstractStream::buffering_ongoing) /* Buffering streams need to keep going */
+ if(i_return != AbstractStream::BufferingStatus::Ongoing) /* Buffering streams need to keep going */
{
if(i_ret > i_return)
i_return = i_ret;
}
/* Bail out, will start again (high prio could be same starving stream) */
- if( i_return == AbstractStream::buffering_lessthanmin )
+ if( i_return == AbstractStream::BufferingStatus::Lessthanmin )
break;
}
vlc_mutex_lock(&demux.lock);
if(demux.i_nzpcr == VLC_TICK_INVALID &&
- i_return != AbstractStream::buffering_lessthanmin /* prevents starting before buffering is reached */ )
+ i_return != AbstractStream::BufferingStatus::Lessthanmin /* prevents starting before buffering is reached */ )
{
demux.i_nzpcr = getFirstDTS();
}
@@ -275,16 +275,16 @@ AbstractStream::buffering_status PlaylistManager::bufferize(vlc_tick_t i_nzdeadl
return i_return;
}
-AbstractStream::status PlaylistManager::dequeue(vlc_tick_t i_floor, vlc_tick_t *pi_nzbarrier)
+AbstractStream::Status PlaylistManager::dequeue(vlc_tick_t i_floor, vlc_tick_t *pi_nzbarrier)
{
- AbstractStream::status i_return = AbstractStream::status_eof;
+ AbstractStream::Status i_return = AbstractStream::Status::Eof;
const vlc_tick_t i_nzdeadline = *pi_nzbarrier;
for(AbstractStream *st : streams)
{
vlc_tick_t i_pcr;
- AbstractStream::status i_ret = st->dequeue(i_nzdeadline, &i_pcr);
+ AbstractStream::Status i_ret = st->dequeue(i_nzdeadline, &i_pcr);
if( i_ret > i_return )
i_return = i_ret;
@@ -435,7 +435,7 @@ int PlaylistManager::doDemux(vlc_tick_t increment)
if(!b_dead)
vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + VLC_TICK_FROM_MS(50));
vlc_mutex_unlock(&demux.lock);
- return (b_dead || b_all_disabled) ? AbstractStream::status_eof : AbstractStream::status_buffering;
+ return (b_dead || b_all_disabled) ? VLC_DEMUXER_EOF : VLC_DEMUXER_SUCCESS;
}
if(demux.i_firstpcr == VLC_TICK_INVALID)
@@ -444,13 +444,13 @@ int PlaylistManager::doDemux(vlc_tick_t increment)
vlc_tick_t i_nzbarrier = demux.i_nzpcr + increment;
vlc_mutex_unlock(&demux.lock);
- AbstractStream::status status = dequeue(demux.i_nzpcr, &i_nzbarrier);
+ AbstractStream::Status status = dequeue(demux.i_nzpcr, &i_nzbarrier);
updateControlsPosition();
switch(status)
{
- case AbstractStream::status_eof:
+ case AbstractStream::Status::Eof:
{
/* might be end of current period */
if(currentPeriod)
@@ -472,19 +472,19 @@ int PlaylistManager::doDemux(vlc_tick_t increment)
}
}
break;
- case AbstractStream::status_buffering:
+ case AbstractStream::Status::Buffering:
vlc_mutex_lock(&demux.lock);
vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + VLC_TICK_FROM_MS(50));
vlc_mutex_unlock(&demux.lock);
break;
- case AbstractStream::status_discontinuity:
+ case AbstractStream::Status::Discontinuity:
vlc_mutex_lock(&demux.lock);
demux.i_nzpcr = VLC_TICK_INVALID;
demux.i_firstpcr = VLC_TICK_INVALID;
es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
vlc_mutex_unlock(&demux.lock);
break;
- case AbstractStream::status_demuxed:
+ case AbstractStream::Status::Demuxed:
vlc_mutex_lock(&demux.lock);
if( demux.i_nzpcr != VLC_TICK_INVALID && i_nzbarrier != demux.i_nzpcr )
{
@@ -642,18 +642,18 @@ void PlaylistManager::Run()
vlc_tick_t i_nzpcr = demux.i_nzpcr;
vlc_mutex_unlock(&demux.lock);
- AbstractStream::buffering_status i_return = bufferize(i_nzpcr, i_min_buffering, i_extra_buffering);
+ AbstractStream::BufferingStatus i_return = bufferize(i_nzpcr, i_min_buffering, i_extra_buffering);
- if(i_return != AbstractStream::buffering_lessthanmin)
+ if(i_return != AbstractStream::BufferingStatus::Lessthanmin)
{
vlc_tick_t i_deadline = vlc_tick_now();
- if(i_return == AbstractStream::buffering_ongoing)
+ if(i_return == AbstractStream::BufferingStatus::Ongoing)
i_deadline += VLC_TICK_FROM_MS(10);
- else if(i_return == AbstractStream::buffering_full)
+ else if(i_return == AbstractStream::BufferingStatus::Full)
i_deadline += VLC_TICK_FROM_MS(100);
- else if(i_return == AbstractStream::buffering_end)
+ else if(i_return == AbstractStream::BufferingStatus::End)
i_deadline += VLC_TICK_FROM_SEC(1);
- else /*if(i_return == AbstractStream::buffering_suspended)*/
+ else /*if(i_return == AbstractStream::BufferingStatus::suspended)*/
i_deadline += VLC_TICK_FROM_MS(250);
// TODO: The current function doesn't seem to modify shared
diff --git a/modules/demux/adaptive/PlaylistManager.h b/modules/demux/adaptive/PlaylistManager.h
index 6a93b95840..9484f3cf60 100644
--- a/modules/demux/adaptive/PlaylistManager.h
+++ b/modules/demux/adaptive/PlaylistManager.h
@@ -59,8 +59,8 @@ namespace adaptive
bool started() const;
void stop();
- AbstractStream::buffering_status bufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t);
- AbstractStream::status dequeue(vlc_tick_t, vlc_tick_t *);
+ AbstractStream::BufferingStatus bufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t);
+ AbstractStream::Status dequeue(vlc_tick_t, vlc_tick_t *);
void drain();
virtual bool needsUpdate() const;
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index cd77398522..204bd7c480 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -57,7 +57,7 @@ AbstractStream::AbstractStream(demux_t * demux_)
demuxer = NULL;
fakeesout = NULL;
notfound_sequence = 0;
- last_buffer_status = buffering_lessthanmin;
+ last_buffer_status = BufferingStatus::Lessthanmin;
vlc_mutex_init(&lock);
}
@@ -291,7 +291,7 @@ bool AbstractStream::decodersDrained()
return fakeEsOut()->decodersDrained();
}
-AbstractStream::buffering_status AbstractStream::getLastBufferStatus() const
+AbstractStream::BufferingStatus AbstractStream::getLastBufferStatus() const
{
return last_buffer_status;
}
@@ -301,7 +301,7 @@ vlc_tick_t AbstractStream::getDemuxedAmount(vlc_tick_t from) const
return fakeEsOut()->commandsQueue()->getDemuxedAmount(from);
}
-AbstractStream::buffering_status AbstractStream::bufferize(vlc_tick_t nz_deadline,
+AbstractStream::BufferingStatus AbstractStream::bufferize(vlc_tick_t nz_deadline,
vlc_tick_t i_min_buffering,
vlc_tick_t i_extra_buffering,
bool b_keep_alive)
@@ -310,7 +310,7 @@ AbstractStream::buffering_status AbstractStream::bufferize(vlc_tick_t nz_deadlin
return last_buffer_status;
}
-AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadline,
+AbstractStream::BufferingStatus AbstractStream::doBufferize(vlc_tick_t nz_deadline,
vlc_tick_t i_min_buffering,
vlc_tick_t i_extra_buffering,
bool b_keep_alive)
@@ -321,7 +321,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
if(!segmentTracker || !connManager || !valid)
{
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_end;
+ return BufferingStatus::End;
}
/* Disable streams that are not selected (alternate streams) */
@@ -333,13 +333,13 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
msg_Dbg(p_realdemux, "deactivating %s stream %s",
format.str().c_str(), description.c_str());
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_end;
+ return BufferingStatus::End;
}
if(fakeEsOut()->commandsQueue()->isDraining())
{
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_suspended;
+ return BufferingStatus::Suspended;
}
segmentTracker->setStartPosition();
@@ -348,7 +348,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
if(!segmentTracker->bufferingAvailable())
{
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_suspended;
+ return BufferingStatus::Suspended;
}
if(!demuxer)
@@ -364,12 +364,12 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
discontinuity = false;
fakeEsOut()->commandsQueue()->setDraining();
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_ongoing;
+ return BufferingStatus::Ongoing;
}
valid = false; /* Prevent further retries */
fakeEsOut()->commandsQueue()->setEOF(true);
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_end;
+ return BufferingStatus::End;
}
}
@@ -387,7 +387,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
vlc_mutex_unlock(&lock);
Demuxer::Status demuxStatus = demuxer->demux(nz_deadline);
vlc_mutex_lock(&lock);
- if(demuxStatus != Demuxer::Status::STATUS_SUCCESS)
+ if(demuxStatus != Demuxer::Status::Success)
{
if(discontinuity || needrestart)
{
@@ -401,11 +401,11 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
}
needrestart = false;
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_ongoing;
+ return BufferingStatus::Ongoing;
}
fakeEsOut()->commandsQueue()->setEOF(true);
vlc_mutex_unlock(&lock);
- return AbstractStream::buffering_end;
+ return BufferingStatus::End;
}
i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(nz_deadline);
segmentTracker->notifyBufferingLevel(i_min_buffering, i_demuxed, i_total_buffering);
@@ -415,13 +415,13 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
if(i_demuxed < i_total_buffering) /* need to read more */
{
if(i_demuxed < i_min_buffering)
- return AbstractStream::buffering_lessthanmin; /* high prio */
- return AbstractStream::buffering_ongoing;
+ return BufferingStatus::Lessthanmin; /* high prio */
+ return BufferingStatus::Ongoing;
}
- return AbstractStream::buffering_full;
+ return BufferingStatus::Full;
}
-AbstractStream::status AbstractStream::dequeue(vlc_tick_t nz_deadline, vlc_tick_t *pi_pcr)
+AbstractStream::Status AbstractStream::dequeue(vlc_tick_t nz_deadline, vlc_tick_t *pi_pcr)
{
vlc_mutex_locker locker(&lock);
@@ -436,19 +436,19 @@ AbstractStream::status AbstractStream::dequeue(vlc_tick_t nz_deadline, vlc_tick_
*pi_pcr = fakeEsOut()->commandsQueue()->Process(p_realdemux->out, VLC_TICK_0 + nz_deadline);
if(!fakeEsOut()->commandsQueue()->isEmpty())
- return AbstractStream::status_demuxed;
+ return Status::Demuxed;
if(!fakeEsOut()->commandsQueue()->isEOF())
{
fakeEsOut()->commandsQueue()->Abort(true); /* reset buffering level and flags */
- return AbstractStream::status_discontinuity;
+ return Status::Discontinuity;
}
}
if(!valid || disabled || fakeEsOut()->commandsQueue()->isEOF())
{
*pi_pcr = nz_deadline;
- return AbstractStream::status_eof;
+ return Status::Eof;
}
vlc_tick_t bufferingLevel = fakeEsOut()->commandsQueue()->getBufferingLevel();
@@ -461,10 +461,10 @@ AbstractStream::status AbstractStream::dequeue(vlc_tick_t nz_deadline, vlc_tick_
if(nz_deadline + VLC_TICK_0 <= bufferingLevel) /* demuxed */
{
*pi_pcr = fakeEsOut()->commandsQueue()->Process( p_realdemux->out, VLC_TICK_0 + nz_deadline );
- return AbstractStream::status_demuxed;
+ return Status::Demuxed;
}
- return AbstractStream::status_buffering;
+ return Status::Buffering;
}
std::string AbstractStream::getContentType()
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index e89b4b7981..3d7f5ccfd5 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -69,23 +69,23 @@ namespace adaptive
virtual bool reactivate(vlc_tick_t);
bool isDisabled() const;
bool isValid() const;
- typedef enum {
- status_eof = 0, /* prioritized */
- status_discontinuity,
- status_demuxed,
- status_buffering,
- } status;
- typedef enum {
- buffering_end = 0, /* prioritized */
- buffering_suspended,
- buffering_full,
- buffering_ongoing,
- buffering_lessthanmin,
- } buffering_status;
- buffering_status bufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t, bool = false);
- buffering_status getLastBufferStatus() const;
+ enum class Status {
+ Eof = 0, /* prioritized */
+ Discontinuity,
+ Demuxed,
+ Buffering,
+ };
+ enum class BufferingStatus {
+ End = 0, /* prioritized */
+ Suspended,
+ Full,
+ Ongoing,
+ Lessthanmin,
+ };
+ BufferingStatus bufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t, bool = false);
+ BufferingStatus getLastBufferStatus() const;
vlc_tick_t getDemuxedAmount(vlc_tick_t) const;
- status dequeue(vlc_tick_t, vlc_tick_t *);
+ Status dequeue(vlc_tick_t, vlc_tick_t *);
bool decodersDrained();
virtual bool setPosition(vlc_tick_t, bool);
bool getMediaPlaybackTimes(vlc_tick_t *, vlc_tick_t *, vlc_tick_t *,
@@ -137,8 +137,8 @@ namespace adaptive
private:
void declaredCodecs();
- buffering_status doBufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t, bool);
- buffering_status last_buffer_status;
+ BufferingStatus doBufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t, bool);
+ BufferingStatus last_buffer_status;
bool valid;
bool disabled;
unsigned notfound_sequence;
diff --git a/modules/demux/adaptive/Time.hpp b/modules/demux/adaptive/Time.hpp
index 3dea66f44b..4a0e60f88a 100644
--- a/modules/demux/adaptive/Time.hpp
+++ b/modules/demux/adaptive/Time.hpp
@@ -23,7 +23,7 @@
#include <vlc_common.h>
/* Scaled time */
-typedef int64_t stime_t;
+using stime_t = int64_t;
class Timescale
{
diff --git a/modules/demux/adaptive/http/Chunk.cpp b/modules/demux/adaptive/http/Chunk.cpp
index 6839ae3a5c..53937054e7 100644
--- a/modules/demux/adaptive/http/Chunk.cpp
+++ b/modules/demux/adaptive/http/Chunk.cpp
@@ -66,7 +66,7 @@ std::string AbstractChunkSource::getContentType() const
return std::string();
}
-enum RequestStatus AbstractChunkSource::getRequestStatus() const
+RequestStatus AbstractChunkSource::getRequestStatus() const
{
return requeststatus;
}
@@ -87,7 +87,7 @@ std::string AbstractChunk::getContentType()
return source->getContentType();
}
-enum RequestStatus AbstractChunk::getRequestStatus() const
+RequestStatus AbstractChunk::getRequestStatus() const
{
return source->getRequestStatus();
}
diff --git a/modules/demux/adaptive/http/Chunk.h b/modules/demux/adaptive/http/Chunk.h
index b174f41f5a..a5abfced8b 100644
--- a/modules/demux/adaptive/http/Chunk.h
+++ b/modules/demux/adaptive/http/Chunk.h
@@ -54,10 +54,10 @@ namespace adaptive
void setBytesRange (const BytesRange &);
const BytesRange & getBytesRange () const;
virtual std::string getContentType () const;
- enum RequestStatus getRequestStatus() const;
+ RequestStatus getRequestStatus() const;
protected:
- enum RequestStatus requeststatus;
+ RequestStatus requeststatus;
size_t contentLength;
BytesRange bytesRange;
};
@@ -68,7 +68,7 @@ namespace adaptive
virtual ~AbstractChunk();
std::string getContentType ();
- enum RequestStatus getRequestStatus () const;
+ RequestStatus getRequestStatus () const;
size_t getBytesRead () const;
uint64_t getStartByteInFile () const;
bool isEmpty () const;
diff --git a/modules/demux/adaptive/http/ConnectionParams.hpp b/modules/demux/adaptive/http/ConnectionParams.hpp
index fb9f9d9af1..dc35cf76eb 100644
--- a/modules/demux/adaptive/http/ConnectionParams.hpp
+++ b/modules/demux/adaptive/http/ConnectionParams.hpp
@@ -29,7 +29,7 @@ namespace adaptive
{
class Transport;
- enum RequestStatus
+ enum class RequestStatus
{
Success,
Redirection,
diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index 2b1b91f326..88a0c3676c 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -140,8 +140,8 @@ void HTTPConnection::disconnect()
transport->disconnect();
}
-enum RequestStatus
- HTTPConnection::request(const std::string &path, const BytesRange &range)
+RequestStatus HTTPConnection::request(const std::string &path,
+ const BytesRange &range)
{
queryOk = false;
chunked = false;
@@ -187,7 +187,7 @@ enum RequestStatus
return RequestStatus::GenericError;
}
- enum RequestStatus status = parseReply();
+ RequestStatus status = parseReply();
if(status == RequestStatus::Success)
{
queryOk = true;
@@ -252,8 +252,7 @@ bool HTTPConnection::send(const void *buf, size_t size)
return transport->send(buf, size);
}
-enum RequestStatus
- HTTPConnection::parseReply()
+RequestStatus HTTPConnection::parseReply()
{
std::string statusline = readLine();
@@ -507,8 +506,8 @@ bool StreamUrlConnection::canReuse(const ConnectionParams ¶ms_) const
params.getPort() == params_.getPort());
}
-enum RequestStatus
- StreamUrlConnection::request(const std::string &path, const BytesRange &range)
+RequestStatus StreamUrlConnection::request(const std::string &path,
+ const BytesRange &range)
{
reset();
diff --git a/modules/demux/adaptive/http/HTTPConnection.hpp b/modules/demux/adaptive/http/HTTPConnection.hpp
index e41ea5b549..7ea76db180 100644
--- a/modules/demux/adaptive/http/HTTPConnection.hpp
+++ b/modules/demux/adaptive/http/HTTPConnection.hpp
@@ -46,8 +46,8 @@ namespace adaptive
virtual bool prepare (const ConnectionParams &);
virtual bool canReuse (const ConnectionParams &) const = 0;
- virtual enum RequestStatus
- request (const std::string& path, const BytesRange & = BytesRange()) = 0;
+ virtual RequestStatus request(const std::string& path,
+ const BytesRange & = BytesRange()) = 0;
virtual ssize_t read (void *p_buffer, size_t len) = 0;
virtual size_t getContentLength() const;
@@ -72,8 +72,8 @@ namespace adaptive
virtual ~HTTPConnection();
virtual bool canReuse (const ConnectionParams &) const;
- virtual enum RequestStatus
- request (const std::string& path, const BytesRange & = BytesRange());
+ virtual RequestStatus request(const std::string& path,
+ const BytesRange & = BytesRange());
virtual ssize_t read (void *p_buffer, size_t len);
void setUsed( bool );
@@ -93,7 +93,7 @@ namespace adaptive
virtual std::string buildRequestHeader(const std::string &path) const;
ssize_t readChunk (void *p_buffer, size_t len);
- enum RequestStatus parseReply();
+ RequestStatus parseReply();
std::string readLine();
std::string useragent;
std::string referer;
@@ -121,8 +121,8 @@ namespace adaptive
virtual bool canReuse (const ConnectionParams &) const;
- virtual enum RequestStatus
- request (const std::string& path, const BytesRange & = BytesRange());
+ virtual RequestStatus request(const std::string& path,
+ const BytesRange & = BytesRange());
virtual ssize_t read (void *p_buffer, size_t len);
virtual void setUsed( bool );
diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index 43d3dafdc0..812b08bb18 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -81,11 +81,11 @@ AbstractDemuxer::Status AbstractDemuxer::returnCode(int i_ret)
switch(i_ret)
{
case VLC_DEMUXER_SUCCESS:
- return Status::STATUS_SUCCESS;
+ return Status::Success;
case VLC_DEMUXER_EGENERIC:
- return Status::STATUS_END_OF_FILE;
+ return Status::Eof;
default:
- return Status::STATUS_ERROR;
+ return Status::Error;
};
}
@@ -166,7 +166,7 @@ void MimeDemuxer::drain()
AbstractDemuxer::Status MimeDemuxer::demux(vlc_tick_t t)
{
if(!demuxer)
- return Status::STATUS_END_OF_FILE;
+ return Status::Eof;
return demuxer->demux(t);
}
@@ -238,7 +238,7 @@ void Demuxer::drain()
Demuxer::Status Demuxer::demux(vlc_tick_t)
{
if(!p_demux || b_eof)
- return Status::STATUS_END_OF_FILE;
+ return Status::Eof;
int i_ret = demux_Demux(p_demux);
if(i_ret != VLC_DEMUXER_SUCCESS)
b_eof = true;
@@ -278,7 +278,7 @@ AbstractDemuxer::Status SlaveDemuxer::demux(vlc_tick_t nz_deadline)
if( demux_Control(p_demux, DEMUX_SET_NEXT_DEMUX_TIME, i_next_demux_time ) != VLC_SUCCESS )
{
b_eof = true;
- return Status::STATUS_END_OF_FILE;
+ return Status::Eof;
}
Status status = Demuxer::demux(i_next_demux_time);
es_out_Control(p_es_out, ES_OUT_SET_GROUP_PCR, 0, i_next_demux_time);
diff --git a/modules/demux/adaptive/plumbing/Demuxer.hpp b/modules/demux/adaptive/plumbing/Demuxer.hpp
index 0f16180178..b6ea1380fe 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.hpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.hpp
@@ -32,11 +32,11 @@ namespace adaptive
class AbstractDemuxer
{
public:
- enum Status
+ enum class Status
{
- STATUS_SUCCESS,
- STATUS_ERROR,
- STATUS_END_OF_FILE,
+ Success,
+ Error,
+ Eof,
};
AbstractDemuxer();
virtual ~AbstractDemuxer();
More information about the vlc-commits
mailing list