From d62343ee95c5ad42c61794ab8aeb44b8b03d911d Mon Sep 17 00:00:00 2001 From: Tats Date: Wed, 17 Feb 2016 15:53:55 -0500 Subject: [PATCH] Create a hasBits() method that tells whether there's currently bits available or not. --- MediaImpl.cpp | 5 +---- MediaImpl.h | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MediaImpl.cpp b/MediaImpl.cpp index 30ff7f6..90dcc42 100644 --- a/MediaImpl.cpp +++ b/MediaImpl.cpp @@ -62,10 +62,7 @@ const uchar* MediaImpl::getBits() _bitsChanged = false; // Return data. - if (_currentFrameSample == NULL) - return NULL; - else - return _data; + return (hasBits() ? _data : NULL); } QString MediaImpl::getUri() const diff --git a/MediaImpl.h b/MediaImpl.h index ff121ea..ead5607 100644 --- a/MediaImpl.h +++ b/MediaImpl.h @@ -98,6 +98,9 @@ public: */ const uchar* getBits(); + /// Returns true iff bits have started flowing (ie. if there is at least a first sample available). + bool hasBits() const { return (_currentFrameSample != NULL); } + /// Returns true iff bits have changed since last call to getBits(). bool bitsHaveChanged() const { return _bitsChanged; }