forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frame always copy valid values from given pitch/stride array
- Loading branch information
Showing
2 changed files
with
17 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2015 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -103,12 +103,13 @@ void Frame::setBits(uchar *b, int plane) | |
|
||
void Frame::setBits(const QVector<uchar *> &b) | ||
{ | ||
if (b.size() > planeCount()) { | ||
qWarning("Invalid plane size! Valid range is [0, %d), current is %d", planeCount(), b.size()); | ||
return; | ||
} | ||
Q_D(Frame); | ||
const int nb_planes = planeCount(); | ||
d->planes = b; | ||
if (d->planes.size() > nb_planes) { | ||
d->planes.reserve(nb_planes); | ||
d->planes.resize(nb_planes); | ||
} | ||
} | ||
|
||
void Frame::setBits(quint8 *slice[]) | ||
|
@@ -130,12 +131,13 @@ void Frame::setBytesPerLine(int lineSize, int plane) | |
|
||
void Frame::setBytesPerLine(const QVector<int> &lineSize) | ||
{ | ||
if (lineSize.size() > planeCount()) { | ||
qWarning("Invalid plane size! Valid range is [0, %d), current is %d", planeCount(), lineSize.size()); | ||
return; | ||
} | ||
Q_D(Frame); | ||
const int nb_planes = planeCount(); | ||
d->line_sizes = lineSize; | ||
if (d->line_sizes.size() > nb_planes) { | ||
d->line_sizes.reserve(nb_planes); | ||
d->line_sizes.resize(nb_planes); | ||
} | ||
} | ||
|
||
void Frame::setBytesPerLine(int stride[]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2015 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -70,17 +70,18 @@ class Q_AV_EXPORT Frame | |
uchar* bits(int plane = 0); | ||
const uchar *bits(int plane = 0) const; | ||
/*! | ||
* \brief setBits set slice from FFmpeg | ||
* \brief setBits | ||
* does nothing if plane is invalid. if given array size is greater than planeCount(), only planeCount() elements is used | ||
* \param b slice | ||
* \param plane color/audio channel | ||
*/ | ||
// TODO: const? | ||
void setBits(uchar *b, int plane = 0); | ||
void setBits(const QVector<uchar*>& b); | ||
void setBits(quint8 *slice[]); | ||
/* | ||
* It's used now until I complete all pixel formats in QtAV. | ||
* set strides from FFmpeg. 4 channels at most for video | ||
/*! | ||
* \brief setBytesPerLine | ||
* does nothing if plane is invalid. if given array size is greater than planeCount(), only planeCount() elements is used | ||
*/ | ||
void setBytesPerLine(int lineSize, int plane = 0); | ||
void setBytesPerLine(const QVector<int>& lineSize); | ||
|