00001 /***************************************************************************** 00002 * statistic.h : vout statistic 00003 ***************************************************************************** 00004 * Copyright (C) 2009 Laurent Aimar 00005 * $Id: e17386ee8f7d90e44b43df00aae8cb04c88cb803 $ 00006 * 00007 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org> 00008 * 00009 * This program is free software; you can redistribute it and/or modify it 00010 * under the terms of the GNU Lesser General Public License as published by 00011 * the Free Software Foundation; either version 2.1 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public License 00020 * along with this program; if not, write to the Free Software Foundation, 00021 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00022 *****************************************************************************/ 00023 00024 #ifndef LIBVLC_VOUT_STATISTIC_H 00025 #define LIBVLC_VOUT_STATISTIC_H 00026 00027 typedef struct { 00028 vlc_spinlock_t spin; 00029 00030 int displayed; 00031 int lost; 00032 } vout_statistic_t; 00033 00034 static inline void vout_statistic_Init(vout_statistic_t *stat) 00035 { 00036 vlc_spin_init(&stat->spin); 00037 } 00038 static inline void vout_statistic_Clean(vout_statistic_t *stat) 00039 { 00040 vlc_spin_destroy(&stat->spin); 00041 } 00042 static inline void vout_statistic_GetReset(vout_statistic_t *stat, int *displayed, int *lost) 00043 { 00044 vlc_spin_lock(&stat->spin); 00045 *displayed = stat->displayed; 00046 *lost = stat->lost; 00047 00048 stat->displayed = 0; 00049 stat->lost = 0; 00050 vlc_spin_unlock(&stat->spin); 00051 } 00052 static inline void vout_statistic_Update(vout_statistic_t *stat, int displayed, int lost) 00053 { 00054 vlc_spin_lock(&stat->spin); 00055 stat->displayed += displayed; 00056 stat->lost += lost; 00057 vlc_spin_unlock(&stat->spin); 00058 } 00059 00060 #endif
1.7.1