1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(video): add accessor functions for sourceID and frameID

Additionally refactors some code to be more optimized.
This commit is contained in:
initramfs 2016-05-04 10:26:36 +08:00 committed by initramfs
parent 80a776475c
commit 8952208e8a
No known key found for this signature in database
GPG Key ID: 78B8BDF87E9EF0AF
2 changed files with 26 additions and 5 deletions

View File

@ -410,12 +410,12 @@ void VideoFrame::storeAVFrame(AVFrame* frame, const QSize& dimensions, const int
void VideoFrame::deleteFrameBuffer()
{
for(auto frameIterator = frameBuffer.begin(); frameIterator != frameBuffer.end(); ++frameIterator)
for(const auto& frameIterator : frameBuffer)
{
AVFrame* frame = frameIterator->second;
AVFrame* frame = frameIterator.second;
// Treat source frame and derived frames separately
if(sourceFrameKey == frameIterator->first)
if(sourceFrameKey == frameIterator.first)
{
if(freeSourceFrame)
{

View File

@ -152,11 +152,32 @@ public:
*/
const AVFrame* getAVFrame(QSize frameSize, const int pixelFormat, const bool requireAligned);
/**
* @brief Returns the ID for the given frame.
*
* Frame IDs are globally unique (with respect to the running instance).
*
* @return an integer representing the ID of this frame.
*/
inline IDType getFrameID() const
{
return frameID;
}
/**
* @brief Returns the ID for the VideoSource which created this frame.
* @return an integer representing the ID of the VideoSource which created this frame.
*/
inline IDType getSourceID() const
{
return sourceID;
}
/**
* @brief Retrieves a copy of the source VideoFrame's dimensions.
* @return QRect copy representing the source VideoFrame's dimensions.
*/
inline QRect getSourceDimensions()
inline QRect getSourceDimensions() const
{
return sourceDimensions;
}
@ -165,7 +186,7 @@ public:
* @brief Retrieves a copy of the source VideoFormat's pixel format.
* @return integer copy represetning the source VideoFrame's pixel format.
*/
inline int getSourcePixelFormat()
inline int getSourcePixelFormat() const
{
return sourcePixelFormat;
}