Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
2f01e7a5
Commit
2f01e7a5
authored
Feb 22, 2012
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: info_panels: Add bitrate graph
parent
48e2f6c3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
263 additions
and
5 deletions
+263
-5
modules/gui/qt4/Modules.am
modules/gui/qt4/Modules.am
+3
-0
modules/gui/qt4/components/info_panels.cpp
modules/gui/qt4/components/info_panels.cpp
+21
-5
modules/gui/qt4/components/info_panels.hpp
modules/gui/qt4/components/info_panels.hpp
+5
-0
modules/gui/qt4/components/info_widgets.cpp
modules/gui/qt4/components/info_widgets.cpp
+180
-0
modules/gui/qt4/components/info_widgets.hpp
modules/gui/qt4/components/info_widgets.hpp
+52
-0
po/POTFILES.in
po/POTFILES.in
+2
-0
No files found.
modules/gui/qt4/Modules.am
View file @
2f01e7a5
...
...
@@ -47,6 +47,7 @@ nodist_SOURCES_qt4 = \
dialogs/extensions.moc.cpp \
components/extended_panels.moc.cpp \
components/info_panels.moc.cpp \
components/info_widgets.moc.cpp \
components/preferences_widgets.moc.cpp \
components/complete_preferences.moc.cpp \
components/simple_preferences.moc.cpp \
...
...
@@ -305,6 +306,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/extensions.cpp \
components/extended_panels.cpp \
components/info_panels.cpp \
components/info_widgets.cpp \
components/preferences_widgets.cpp \
components/complete_preferences.cpp \
components/simple_preferences.cpp \
...
...
@@ -380,6 +382,7 @@ noinst_HEADERS = \
dialogs/extensions.hpp \
components/extended_panels.hpp \
components/info_panels.hpp \
components/info_widgets.hpp \
components/preferences_widgets.hpp \
components/complete_preferences.hpp \
components/simple_preferences.hpp \
...
...
modules/gui/qt4/components/info_panels.cpp
View file @
2f01e7a5
...
...
@@ -33,6 +33,7 @@
#include "qt4.hpp"
#include "components/info_panels.hpp"
#include "components/interface_widgets.hpp"
#include "info_widgets.hpp"
#include <assert.h>
#include <vlc_url.h>
...
...
@@ -491,7 +492,7 @@ void InfoPanel::saveCodecsInfo()
*/
InputStatsPanel
::
InputStatsPanel
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
Q
GridLayout
*
layout
=
new
QGrid
Layout
(
this
);
Q
VBoxLayout
*
layout
=
new
QVBox
Layout
(
this
);
QLabel
*
topLabel
=
new
QLabel
(
qtr
(
"Current"
" media / stream "
"statistics"
)
);
...
...
@@ -526,6 +527,8 @@ InputStatsPanel::InputStatsPanel( QWidget *parent ): QWidget( parent )
"0"
,
input
,
"KiB"
);
CREATE_AND_ADD_TO_CAT
(
input_bitrate_stat
,
qtr
(
"Input bitrate"
),
"0"
,
input
,
"kb/s"
);
input_bitrate_graph
=
new
QTreeWidgetItem
();
input_bitrate_stat
->
addChild
(
input_bitrate_graph
);
CREATE_AND_ADD_TO_CAT
(
demuxed_stat
,
qtr
(
"Demuxed data size"
),
"0"
,
input
,
"KiB"
)
;
CREATE_AND_ADD_TO_CAT
(
stream_bitrate_stat
,
qtr
(
"Content bitrate"
),
"0"
,
input
,
"kb/s"
);
...
...
@@ -565,7 +568,19 @@ InputStatsPanel::InputStatsPanel( QWidget *parent ): QWidget( parent )
StatsTree
->
resizeColumnToContents
(
0
);
StatsTree
->
setColumnWidth
(
1
,
200
);
layout
->
addWidget
(
StatsTree
,
1
,
0
);
layout
->
addWidget
(
StatsTree
,
4
,
0
);
statsView
=
new
VLCStatsView
(
this
);
statsView
->
setFrameStyle
(
QFrame
::
NoFrame
);
statsView
->
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Fixed
);
input_bitrate_graph
->
setSizeHint
(
1
,
QSize
(
0
,
100
)
);
StatsTree
->
setItemWidget
(
input_bitrate_graph
,
1
,
statsView
);
}
void
InputStatsPanel
::
hideEvent
(
QHideEvent
*
event
)
{
statsView
->
reset
();
QWidget
::
hideEvent
(
event
);
}
/**
...
...
@@ -590,6 +605,8 @@ void InputStatsPanel::update( input_item_t *p_item )
UPDATE_INT
(
corrupted_stat
,
p_item
->
p_stats
->
i_demux_corrupted
);
UPDATE_INT
(
discontinuity_stat
,
p_item
->
p_stats
->
i_demux_discontinuity
);
statsView
->
addValue
(
p_item
->
p_stats
->
f_input_bitrate
*
8000
);
/* Video */
UPDATE_INT
(
vdecoded_stat
,
p_item
->
p_stats
->
i_decoded_video
);
UPDATE_INT
(
vdisplayed_stat
,
p_item
->
p_stats
->
i_displayed_pictures
);
...
...
@@ -614,4 +631,3 @@ void InputStatsPanel::update( input_item_t *p_item )
void
InputStatsPanel
::
clear
()
{
}
modules/gui/qt4/components/info_panels.hpp
View file @
2f01e7a5
...
...
@@ -51,6 +51,7 @@ class QLineEdit;
class
CoverArtLabel
;
class
QTextEdit
;
class
QLabel
;
class
VLCStatsView
;
class
MetaPanel
:
public
QWidget
{
...
...
@@ -116,11 +117,14 @@ class InputStatsPanel: public QWidget
Q_OBJECT
public:
InputStatsPanel
(
QWidget
*
);
protected:
virtual
void
hideEvent
(
QHideEvent
*
);
private:
QTreeWidget
*
StatsTree
;
QTreeWidgetItem
*
input
;
QTreeWidgetItem
*
read_media_stat
;
QTreeWidgetItem
*
input_bitrate_stat
;
QTreeWidgetItem
*
input_bitrate_graph
;
QTreeWidgetItem
*
demuxed_stat
;
QTreeWidgetItem
*
stream_bitrate_stat
;
QTreeWidgetItem
*
corrupted_stat
;
...
...
@@ -142,6 +146,7 @@ private:
QTreeWidgetItem
*
aplayed_stat
;
QTreeWidgetItem
*
alost_stat
;
VLCStatsView
*
statsView
;
public
slots
:
void
update
(
input_item_t
*
);
void
clear
();
...
...
modules/gui/qt4/components/info_widgets.cpp
0 → 100644
View file @
2f01e7a5
/*****************************************************************************
* info_widgets.cpp : Widgets for info panels
****************************************************************************
* Copyright (C) 2013 the VideoLAN team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "qt4.hpp"
#include "info_widgets.hpp"
#include <QGridLayout>
#include <QLabel>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QPolygonF>
#include <QGraphicsPolygonItem>
#include <QGraphicsLineItem>
#include <QVectorIterator>
#define STATS_LENGTH 10
#define ADD_LABEL(row, color, text) \
label = new QLabel( QString( "<font color=\"%1\">%2</font>" ) \
.arg( color.name() ) \
.arg( text ) \
); \
layout->addWidget( label, row, 0, 1, 1, 0 );
VLCStatsView
::
VLCStatsView
(
QWidget
*
parent
)
:
QGraphicsView
(
parent
)
{
QColor
history
(
0
,
0
,
0
,
255
),
total
(
237
,
109
,
0
,
160
),
content
(
109
,
237
,
0
,
160
);
scale
(
1.0
,
-
1.0
);
/* invert our Y axis */
setOptimizationFlags
(
QGraphicsView
::
DontAdjustForAntialiasing
);
setAlignment
(
Qt
::
AlignLeft
);
setVerticalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
viewScene
=
new
QGraphicsScene
(
this
);
historyShape
=
viewScene
->
addPolygon
(
QPolygonF
(),
QPen
(
Qt
::
NoPen
),
QBrush
(
history
)
);
totalbitrateShape
=
viewScene
->
addPolygon
(
QPolygonF
(),
QPen
(
Qt
::
NoPen
),
QBrush
(
total
)
);
setScene
(
viewScene
);
reset
();
QPen
linepen
(
Qt
::
DotLine
);
linepen
.
setBrush
(
QBrush
(
QColor
(
33
,
33
,
33
)
)
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
rulers
[
i
]
=
viewScene
->
addLine
(
QLineF
(),
linepen
);
}
#undef ADD_LABEL
void
VLCStatsView
::
reset
()
{
historymergepointer
=
0
;
blocksize
=
4
;
valuesaccumulator
=
0
;
valuesaccumulatorcount
=
0
;
historyShape
->
setPolygon
(
QPolygonF
()
);
totalbitrateShape
->
setPolygon
(
QPolygonF
()
);
}
void
VLCStatsView
::
addValue
(
float
value
)
{
value
/=
1000
;
QPolygonF
shape
=
totalbitrateShape
->
polygon
();
if
(
shape
.
count
()
>
(
STATS_LENGTH
+
2
)
)
/* keep only STATS_LENGTH samples */
{
shape
.
remove
(
1
);
for
(
int
i
=
1
;
i
<
(
STATS_LENGTH
+
2
);
i
++
)
(
(
QPointF
&
)
shape
.
at
(
i
)
).
setX
(
i
-
1
);
/*move back values*/
}
int
count
=
shape
.
count
();
if
(
count
==
0
)
{
shape
<<
QPointF
(
0
,
0
);
/* begin and close shape */
shape
<<
QPointF
(
count
,
0
);
}
shape
.
insert
(
shape
.
end
()
-
1
,
QPointF
(
count
,
value
)
);
(
(
QPointF
&
)
shape
.
last
()
).
setX
(
count
);
totalbitrateShape
->
setPolygon
(
shape
);
addHistoryValue
(
value
);
QRectF
maxsizes
=
scene
()
->
itemsBoundingRect
();
maxsizes
.
setRight
(
STATS_LENGTH
);
fitInView
(
maxsizes
);
/* fix viewport */
drawRulers
(
maxsizes
);
}
void
VLCStatsView
::
drawRulers
(
const
QRectF
&
maxsizes
)
{
float
height
=
maxsizes
.
height
()
*
1000
;
int
texp
=
0
;
while
(
height
>
1.0
)
{
height
/=
10
;
texp
++
;
}
height
=
1.0
;
while
(
texp
--
)
height
*=
10
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
float
y
=
(
height
/
5
)
*
(
i
+
1
)
/
1000
;
rulers
[
i
]
->
setLine
(
QLineF
(
0
,
y
,
STATS_LENGTH
,
y
)
);
}
}
void
VLCStatsView
::
addHistoryValue
(
float
value
)
{
/* We keep a full history by creating virtual blocks for inserts, growing
by power of 2 when no more space is available. At this time, we also
free space by agregating the oldest values 2 by 2.
Each shown value finally being a mean of blocksize samples.
*/
bool
doinsert
=
false
;
int
next_blocksize
=
blocksize
;
QPolygonF
shape
=
historyShape
->
polygon
();
int
count
=
shape
.
count
();
if
(
count
==
0
)
{
shape
<<
QPointF
(
0
,
0
);
/* begin and close shape */
shape
<<
QPointF
(
count
,
0
);
}
valuesaccumulator
+=
(
value
/
blocksize
);
valuesaccumulatorcount
++
;
if
(
valuesaccumulatorcount
==
blocksize
)
{
valuesaccumulator
=
0
;
valuesaccumulatorcount
=
0
;
doinsert
=
true
;
}
if
(
doinsert
)
{
if
(
count
>
(
STATS_LENGTH
+
2
)
)
{
float
y
=
0
;
y
+=
((
QPointF
&
)
shape
.
at
(
historymergepointer
+
1
)).
y
();
y
+=
((
QPointF
&
)
shape
.
at
(
historymergepointer
+
2
)).
y
();
y
/=
2
;
/* merge */
shape
.
remove
(
historymergepointer
+
2
);
(
(
QPointF
&
)
shape
.
at
(
historymergepointer
+
1
)
).
setY
(
y
);
for
(
int
i
=
historymergepointer
+
1
;
i
<
(
STATS_LENGTH
+
2
);
i
++
)
(
(
QPointF
&
)
shape
.
at
(
i
)
).
setX
(
i
-
1
);
/*move back values*/
historymergepointer
++
;
if
(
historymergepointer
>
(
STATS_LENGTH
-
1
)
)
{
historymergepointer
=
0
;
next_blocksize
=
(
blocksize
<<
1
);
}
}
shape
.
insert
(
shape
.
end
()
-
1
,
QPointF
(
count
,
value
)
);
(
(
QPointF
&
)
shape
.
last
()
).
setX
(
count
);
}
else
(
(
QPointF
&
)
shape
.
last
()
).
setX
(
count
-
1
);
historyShape
->
setPolygon
(
shape
);
blocksize
=
next_blocksize
;
}
modules/gui/qt4/components/info_widgets.hpp
0 → 100644
View file @
2f01e7a5
/*****************************************************************************
* info_widgets.hpp : Widgets for info panels
****************************************************************************
* Copyright (C) 2013 the VideoLAN team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef INFO_WIDGETS_HPP
#define INFO_WIDGETS_HPP
#include <QGraphicsView>
class
QGraphicsView
;
class
QGraphicsScene
;
class
QGraphicsPolygonItem
;
class
QGraphicsLineItem
;
class
VLCStatsView
:
public
QGraphicsView
{
Q_OBJECT
public:
VLCStatsView
(
QWidget
*
);
void
addValue
(
float
);
void
reset
();
private:
void
addHistoryValue
(
float
);
void
drawRulers
(
const
QRectF
&
);
QGraphicsScene
*
viewScene
;
QGraphicsPolygonItem
*
totalbitrateShape
;
QGraphicsPolygonItem
*
historyShape
;
QGraphicsLineItem
*
rulers
[
3
];
unsigned
int
historymergepointer
;
unsigned
int
blocksize
;
float
valuesaccumulator
;
unsigned
int
valuesaccumulatorcount
;
};
#endif // INFO_WIDGETS_HPP
po/POTFILES.in
View file @
2f01e7a5
...
...
@@ -605,6 +605,8 @@ modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.hpp
modules/gui/qt4/components/info_panels.cpp
modules/gui/qt4/components/info_panels.hpp
modules/gui/qt4/components/info_widgets.cpp
modules/gui/qt4/components/info_widgets.hpp
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/open_panels.cpp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment