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 Statistics which can be used by filters
- Loading branch information
Showing
11 changed files
with
201 additions
and
13 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
******************************************************************************/ | ||
|
||
#ifndef QTAV_STATISTICS_H | ||
#define QTAV_STATISTICS_H | ||
|
||
#include <QtAV/QtAV_Global.h> | ||
#include <QtCore/QTime> | ||
|
||
/* | ||
* time unit is s | ||
*/ | ||
|
||
namespace QtAV { | ||
|
||
class StatisticsPrivate; | ||
class Q_EXPORT Statistics | ||
{ | ||
public: | ||
Statistics(); | ||
~Statistics(); | ||
|
||
QString url; | ||
class Common { | ||
public: | ||
Common(); | ||
QString format; | ||
QString codec, codec_long; | ||
//common audio/video info that may be used(visualize) by filters | ||
QTime current_time, total_time, start_time; | ||
qreal bit_rate, avg_frame_rate; //Kps | ||
qint64 frames; | ||
qint64 size; //audio/video stream size | ||
|
||
//union member with ctor, dtor, copy ctor only works in c++11 | ||
/*union { | ||
audio_only audio; | ||
video_only video; | ||
} only;*/ | ||
} audio, video; //init them | ||
|
||
//from AVCodecContext | ||
class AudioOnly { | ||
public: | ||
AudioOnly(); | ||
int sample_rate; ///< samples per second | ||
int channels; ///< number of audio channels | ||
//enum AVSampleFormat sample_fmt; ///< sample format | ||
/** | ||
* Number of samples per channel in an audio frame. | ||
* - decoding: may be set by some decoders to indicate constant frame size | ||
*/ | ||
int frame_size; | ||
/** | ||
* Frame counter, set by libavcodec. | ||
* @note the counter is not incremented if encoding/decoding resulted in an error. | ||
*/ | ||
int frame_number; | ||
/** | ||
* number of bytes per packet if constant and known or 0 | ||
* Used by some WAV based audio codecs. | ||
*/ | ||
int block_align; | ||
//int cutoff; //Audio cutoff bandwidth (0 means "automatic") | ||
//uint64_t channel_layout; | ||
} audio_only; | ||
//from AVCodecContext | ||
class VideoOnly { | ||
public: | ||
//union member with ctor, dtor, copy ctor only works in c++11 | ||
VideoOnly(); | ||
int width, height; | ||
/** | ||
* Bitstream width / height, may be different from width/height if lowres enabled. | ||
* - encoding: unused | ||
* - decoding: Set by user before init if known. Codec should override / dynamically change if needed. | ||
*/ | ||
int coded_width, coded_height; | ||
/** | ||
* the number of pictures in a group of pictures, or 0 for intra_only | ||
*/ | ||
int gop_size; | ||
//enum AVPixelFormat pix_fmt; //TODO: new enum in QtAV | ||
/** | ||
* Motion estimation algorithm used for video coding. | ||
* 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), | ||
* 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] | ||
*/ | ||
//int me_method; | ||
} video_only; | ||
}; | ||
|
||
} //namespace QtAV | ||
|
||
#endif // QTAV_STATISTICS_H |
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2013 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
******************************************************************************/ | ||
|
||
#include "QtAV/Statistics.h" | ||
|
||
namespace QtAV { | ||
|
||
Statistics::Common::Common(): | ||
bit_rate(0) | ||
, avg_frame_rate(0) | ||
, frames(0) | ||
, size(0) | ||
{ | ||
} | ||
|
||
Statistics::AudioOnly::AudioOnly(): | ||
sample_rate(0) | ||
, channels(0) | ||
, frame_size(0) | ||
, frame_number(0) | ||
, block_align(0) | ||
{ | ||
} | ||
|
||
Statistics::VideoOnly::VideoOnly(): | ||
width(0) | ||
, height(0) | ||
, coded_width(0) | ||
, coded_height(0) | ||
, gop_size(0) | ||
{ | ||
} | ||
|
||
Statistics::Statistics() | ||
{ | ||
} | ||
|
||
Statistics::~Statistics() | ||
{ | ||
} | ||
|
||
} //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
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