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.
- Loading branch information
Showing
2 changed files
with
19 additions
and
18 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) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -63,10 +63,6 @@ class Q_AV_EXPORT VideoFrame : public Frame | |
int pixelFormatFFmpeg() const; | ||
|
||
bool isValid() const; | ||
/* | ||
* call this only when setBytesPerLine() and setBits() will not be called | ||
*/ | ||
void init(); | ||
|
||
QSize size() const; | ||
//int width(int plane = 0) const? | ||
|
@@ -94,6 +90,11 @@ class Q_AV_EXPORT VideoFrame : public Frame | |
return -1 if no texture, not uploaded | ||
*/ | ||
int texture(int plane = 0) const; | ||
private: | ||
/* | ||
* call this only when setBytesPerLine() and setBits() will not be called | ||
*/ | ||
void init(); | ||
}; | ||
|
||
} //namespace QtAV | ||
|
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) 2013 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -242,18 +242,6 @@ bool VideoFrame::isValid() const | |
return d->width > 0 && d->height > 0 && d->format.isValid(); //data not empty? | ||
} | ||
|
||
void VideoFrame::init() | ||
{ | ||
Q_D(VideoFrame); | ||
AVPicture picture; | ||
AVPixelFormat fff = (AVPixelFormat)d->format.pixelFormatFFmpeg(); | ||
//int bytes = avpicture_get_size(fff, width(), height()); | ||
//d->data.resize(bytes); | ||
avpicture_fill(&picture, reinterpret_cast<uint8_t*>(d->data.data()), fff, width(), height()); | ||
setBits(picture.data); | ||
setBytesPerLine(picture.linesize); | ||
} | ||
|
||
QSize VideoFrame::size() const | ||
{ | ||
Q_D(const VideoFrame); | ||
|
@@ -337,4 +325,16 @@ int VideoFrame::texture(int plane) const | |
return d->textures[plane]; | ||
} | ||
|
||
void VideoFrame::init() | ||
{ | ||
Q_D(VideoFrame); | ||
AVPicture picture; | ||
AVPixelFormat fff = (AVPixelFormat)d->format.pixelFormatFFmpeg(); | ||
//int bytes = avpicture_get_size(fff, width(), height()); | ||
//d->data.resize(bytes); | ||
avpicture_fill(&picture, reinterpret_cast<uint8_t*>(d->data.data()), fff, width(), height()); | ||
setBits(picture.data); | ||
setBytesPerLine(picture.linesize); | ||
} | ||
|
||
} //namespace QtAV |