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.
add AudioFrame.duration() for convenience
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 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-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -189,6 +189,12 @@ void AudioFrame::setAudioResampler(AudioResampler *conv) | |
d_func()->conv = conv; | ||
} | ||
|
||
qint64 AudioFrame::duration() const | ||
{ | ||
Q_D(const AudioFrame); | ||
return d->format.durationForBytes(d->data.size()); | ||
} | ||
|
||
AudioFrame AudioFrame::to(const AudioFormat &fmt) const | ||
{ | ||
if (!isValid() || !constBits(0)) | ||
|
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-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -70,6 +70,13 @@ class Q_AV_EXPORT AudioFrame : public Frame | |
AudioFrame to(const AudioFormat& fmt) const; | ||
//AudioResamplerId | ||
void setAudioResampler(AudioResampler *conv); //TODO: remove | ||
/*! | ||
Returns the number of microseconds represented by \a bytes in this format. | ||
Returns 0 if this format is not valid. | ||
Note that some rounding may occur if \a bytes is not an exact multiple | ||
of the number of bytes per frame. | ||
*/ | ||
qint64 duration() const; | ||
}; | ||
|
||
} //namespace QtAV | ||
|