Miam-Player  0.8.0
A nice music player
Statistics.h
Go to the documentation of this file.
1 /******************************************************************************
2  QtAV: Multimedia framework based on Qt and FFmpeg
3  Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
4 
5 * This file is part of QtAV (from 2013)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 ******************************************************************************/
21 
22 #ifndef QTAV_STATISTICS_H
23 #define QTAV_STATISTICS_H
24 
25 #include <QtAV/QtAV_Global.h>
26 #include <QtCore/QHash>
27 #include <QtCore/QTime>
28 #include <QtCore/QSharedData>
29 
33 namespace QtAV {
34 
36 {
37 public:
38  Statistics();
39  ~Statistics();
40  void reset();
41 
42  QString url;
43  int bit_rate;
44  QString format;
45  QTime start_time, duration;
46  QHash<QString, QString> metadata;
47  class Common {
48  public:
49  Common();
50  //TODO: dynamic bit rate compute
51  bool available;
52  QString codec, codec_long;
53  QString decoder;
54  QString decoder_detail;
55  QTime current_time, total_time, start_time;
56  int bit_rate;
57  qint64 frames;
58  qreal frame_rate; // average fps stored in media stream information
59  //union member with ctor, dtor, copy ctor only works in c++11
60  /*union {
61  audio_only audio;
62  video_only video;
63  } only;*/
64  QHash<QString, QString> metadata;
65  } audio, video; //init them
66 
67  //from AVCodecContext
69  public:
70  AudioOnly();
72  int channels;
73  QString channel_layout;
74  QString sample_fmt;
75 
85  } audio_only;
86  //from AVCodecContext
88  public:
89  //union member with ctor, dtor, copy ctor only works in c++11
90  VideoOnly();
91  VideoOnly(const VideoOnly&);
92  VideoOnly& operator =(const VideoOnly&);
93  ~VideoOnly();
94  // compute from pts history
95  qreal currentDisplayFPS() const;
96  qreal pts() const; // last pts
97 
98  int width, height;
103  int coded_width, coded_height;
107  int gop_size;
108  QString pix_fmt;
110  qint64 frameDisplayed(qreal pts); // used to compute currentDisplayFPS()
111  private:
112  class Private;
113  QExplicitlySharedDataPointer<Private> d;
114  } video_only;
115 };
116 
117 } //namespace QtAV
118 
119 #endif // QTAV_STATISTICS_H
QTime start_time
Definition: Statistics.h:45
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
int frame_size
Definition: Statistics.h:79
QString sample_fmt
sample format
Definition: Statistics.h:74
QString decoder
Definition: Statistics.h:53
int channels
number of audio channels
Definition: Statistics.h:72
bool available
Definition: Statistics.h:51
Definition: Statistics.h:47
QString url
Definition: Statistics.h:42
QString decoder_detail
Definition: Statistics.h:54
int sample_rate
samples per second
Definition: Statistics.h:71
QHash< QString, QString > metadata
Definition: Statistics.h:46
int block_align
Definition: Statistics.h:84
QString codec_long
Definition: Statistics.h:52
Definition: Statistics.h:87
int gop_size
Definition: Statistics.h:107
int width
Definition: Statistics.h:98
QString pix_fmt
Definition: Statistics.h:108
int bit_rate
Definition: Statistics.h:56
Definition: Statistics.h:35
QString channel_layout
Definition: Statistics.h:73
int coded_width
Definition: Statistics.h:103
QTime total_time
Definition: Statistics.h:55
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
QString format
Definition: Statistics.h:44
qreal frame_rate
Definition: Statistics.h:58
QHash< QString, QString > metadata
Definition: Statistics.h:64
Definition: Statistics.h:68
int bit_rate
Definition: Statistics.h:43
qint64 frames
Definition: Statistics.h:57