Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 5 additions & 30 deletions src/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ Frame::Frame(int _width,



Frame::Frame(Frame &src)
Frame::Frame(Frame const& src)
{
// free memory if allocated before.
release();

// Copy fields.
width = src.width;
height = src.height;
Expand Down Expand Up @@ -267,7 +264,7 @@ void Frame::cloneTo(Frame& dst)



bool Frame::operator==(Frame &src)
bool Frame::operator==(Frame const& src) const
{
// Check yourself.
if (this == &src)
Expand Down Expand Up @@ -296,31 +293,9 @@ bool Frame::operator==(Frame &src)



bool Frame::operator!=(Frame &src)
bool Frame::operator!=(Frame const& src) const
{
// Check yourself.
if (this == &src)
return false;

// Check frame atributes.
if (width != src.width ||
height != src.height ||
fourcc != src.fourcc ||
frameId != src.frameId ||
sourceId != src.sourceId ||
size != src.size)
return true;

// Compare frame data.
if (data == src.data)
return false;

if (size > 0 && src.size > 0)
for (int i = 0; i < size; ++i)
if (data[i] != src.data[i])
return true;

return false;
return !(*this == src);
}


Expand Down Expand Up @@ -478,4 +453,4 @@ bool Frame::deserialize(uint8_t* _data, int _size)
memcpy(data, &_data[pos], size);

return true;
}
}
8 changes: 4 additions & 4 deletions src/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Frame
* @brief Copy class constructor.
* @param src Source class object.
*/
Frame(Frame& src);
Frame(Frame const& src);

/**
* @brief Class destructor.
Expand All @@ -114,14 +114,14 @@ class Frame
* @param src Source frame object.
* @return TRUE if the frames are not identical or FALSE.
*/
bool operator!= (Frame& src);
bool operator!= (Frame const& src) const;

/**
* @brief Operator "==". Operator to compare two frame objects.
* @param src Source frame object.
* @return TRUE if the frames are identical or FALSE.
*/
bool operator== (Frame& src);
bool operator== (Frame const& src) const;

/**
* @brief Clone data. Method copies frame and copy just pointer to data.
Expand Down Expand Up @@ -171,4 +171,4 @@ class Frame
bool m_isAllocated{false};
};
}
}
}