]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/infopanels.cpp
* Split apart gui and input management
[vlc] / modules / gui / qt4 / components / infopanels.cpp
1 /*****************************************************************************
2  * infopanels.cpp : Panels for the information dialogs
3  ****************************************************************************
4  * Copyright (C) 2000-2005 the VideoLAN team
5  * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #include "components/infopanels.hpp"
25 #include "qt4.hpp"
26 #include "ui/input_stats.h"
27 #include <QWidget>
28
29 InputStatsPanel::InputStatsPanel( QWidget *parent, intf_thread_t *_p_intf ) :
30                                   QWidget( parent ), p_intf( _p_intf )
31 {
32     ui.setupUi( this );
33 }
34
35 InputStatsPanel::~InputStatsPanel()
36 {
37 }
38
39 void InputStatsPanel::Update( input_item_t *p_item )
40 {
41
42     vlc_mutex_lock( &p_item->p_stats->lock );
43
44 #define UPDATE( widget,format, calc... ) \
45     { QString str; ui.widget->setText( str.sprintf( format, ## calc ) );  }
46
47     UPDATE( read_text, "%8.0f kB", (float)(p_item->p_stats->i_read_bytes)/1000);
48     UPDATE( input_bitrate_text, "%6.0f kb/s", (float)(p_item->p_stats->f_input_bitrate * 8000 ));
49     UPDATE( demuxed_text, "%8.0f kB", (float)(p_item->p_stats->i_demux_read_bytes)/1000 );
50     UPDATE( stream_bitrate_text, "%6.0f kb/s", (float)(p_item->p_stats->f_demux_bitrate * 8000 ));
51
52     /* Video */
53     UPDATE( vdecoded_text, "%5i", p_item->p_stats->i_decoded_video );
54     UPDATE( vdisplayed_text, "%5i", p_item->p_stats->i_displayed_pictures );
55     UPDATE( vlost_frames, "%5i", p_item->p_stats->i_lost_pictures );
56
57     /* Sout */
58     UPDATE( sent_text, "%5i", p_item->p_stats->i_sent_packets );
59     UPDATE( sent_bytes_text, "%8.0f kB",
60             (float)(p_item->p_stats->i_sent_bytes)/1000 );
61     UPDATE( send_bitrate_text, "%6.0f kb/s",
62             (float)(p_item->p_stats->f_send_bitrate*8)*1000 );
63
64     /* Audio*/
65     UPDATE( adecoded_text, "%5i", p_item->p_stats->i_decoded_audio );
66     UPDATE( aplayed_text, "%5i", p_item->p_stats->i_played_abuffers );
67     UPDATE( alost_text, "%5i", p_item->p_stats->i_lost_abuffers );
68
69     vlc_mutex_unlock(& p_item->p_stats->lock );
70 }