libmp3splt
|
00001 /********************************************************** 00002 * 00003 * libmp3splt -- library based on mp3splt, 00004 * for mp3/ogg splitting without decoding 00005 * 00006 * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net> 00007 * Copyright (c) 2005-2011 Alexandru Munteanu - io_fx@yahoo.fr 00008 * 00009 * http://mp3splt.sourceforge.net 00010 * 00011 *********************************************************/ 00012 00013 /********************************************************** 00014 * 00015 * This program is free software; you can redistribute it and/or 00016 * modify it under the terms of the GNU General Public License 00017 * as published by the Free Software Foundation; either version 2 00018 * of the License, or (at your option) any later version. 00019 * 00020 * This program is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with this program; if not, write to the Free Software 00027 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00028 * 02111-1307, 00029 * USA. 00030 * 00031 *********************************************************/ 00032 00033 #include <string.h> 00034 #include <stdarg.h> 00035 00036 #include "splt.h" 00037 00038 extern int global_debug; 00039 00040 static char global_mem_err_mess[1024] = "error allocating memory in splt_d_print_debug !\n"; 00041 00042 static void splt_d_send_message(splt_state *state, const char *mess); 00043 00044 void splt_d_print_debug(splt_state *state, const char *message, ...) 00045 { 00046 if (global_debug) 00047 { 00048 va_list ap; 00049 00050 va_start(ap, message); 00051 char *mess = splt_su_format_messagev(state, message, ap); 00052 va_end(ap); 00053 00054 if (mess) 00055 { 00056 splt_d_send_message(state, mess); 00057 00058 free(mess); 00059 mess = NULL; 00060 } 00061 } 00062 } 00063 00064 void splt_d_send_memory_error_message(splt_state *state) 00065 { 00066 splt_d_send_message(state, global_mem_err_mess); 00067 } 00068 00069 static void splt_d_send_message(splt_state *state, const char *mess) 00070 { 00071 if (state) 00072 { 00073 splt_c_put_debug_message_to_client(state, mess); 00074 } 00075 else 00076 { 00077 fprintf(stdout,"%s\n",mess); 00078 fflush(stdout); 00079 } 00080 00081 } 00082