00001 /***************************************************************************** 00002 * avutil.h: avutil helper functions 00003 ***************************************************************************** 00004 * Copyright (C) 1999-2008 the VideoLAN team 00005 * $Id: 48a5222b26eda3891569f84326f5cdc0a01623c3 $ 00006 * 00007 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 00008 * Gildas Bazin <gbazin@videolan.org> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00023 *****************************************************************************/ 00024 00025 /***************************************************************************** 00026 * Export libavutil messages to the VLC message system 00027 *****************************************************************************/ 00028 static inline void LibavutilCallback( void *p_opaque, int i_level, 00029 const char *psz_format, va_list va ) 00030 { 00031 AVCodecContext *p_avctx = (AVCodecContext *)p_opaque; 00032 const AVClass *p_avc; 00033 00034 p_avc = p_avctx ? p_avctx->av_class : 0; 00035 00036 #define cln p_avc->class_name 00037 /* Make sure we can get p_this back */ 00038 if( !p_avctx || !p_avc || !cln || 00039 cln[0]!='A' || cln[1]!='V' || cln[2]!='C' || cln[3]!='o' || 00040 cln[4]!='d' || cln[5]!='e' || cln[6]!='c' ) 00041 { 00042 if( i_level == AV_LOG_ERROR ) vfprintf( stderr, psz_format, va ); 00043 return; 00044 } 00045 #undef cln 00046 00047 switch( i_level ) 00048 { 00049 case AV_LOG_DEBUG: 00050 case AV_LOG_INFO: 00051 /* Print debug messages if they were requested */ 00052 if( !p_avctx->debug ) 00053 break; 00054 00055 case AV_LOG_ERROR: 00056 case AV_LOG_QUIET: 00057 vfprintf( stderr, psz_format, va ); 00058 break; 00059 } 00060 }
1.5.6