]> sjero.net Git - linphone/blob - tools/lpc2xml_test.c
Aac-eld add missing header according to RFC3640 3.3.6
[linphone] / tools / lpc2xml_test.c
1 /*
2 linphone
3 Copyright (C) 2012 Belledonne Communications SARL
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19
20 #include <stdio.h>
21 #include "lpc2xml.h"
22
23 void cb_function(void *ctx, lpc2xml_log_level level, const char *msg, va_list list) {
24         const char *header = "";
25         switch(level) {
26                 case LPC2XML_DEBUG:
27                         header = "DEBUG";
28                         break;
29                 case LPC2XML_MESSAGE:
30                         header = "MESSAGE";
31                         break;
32                 case LPC2XML_WARNING:
33                         header = "WARNING";
34                         break;
35                 case LPC2XML_ERROR:
36                         header = "ERROR";
37                         break;
38         }
39         fprintf(stdout, "%s - ", header);
40         vfprintf(stdout, msg, list);
41         fprintf(stdout, "\n");
42 }
43
44 void show_usage(int argc, char *argv[]) {
45         fprintf(stderr, "usage %s convert <lpc_file> <xml_file>\n",
46                         argv[0]);
47 }
48
49 int main(int argc, char *argv[]) {
50         if(argc != 4) {
51                 show_usage(argc, argv);
52                 return -1;
53         }
54         
55         lpc2xml_context *ctx = lpc2xml_context_new(cb_function, NULL);
56         LpConfig *lpc = lp_config_new(argv[2]);
57         lpc2xml_set_lpc(ctx, lpc);
58         if(strcmp("convert", argv[1]) == 0) {
59                 lpc2xml_convert_file(ctx, argv[3]);
60         } else {
61                 show_usage(argc, argv);
62         }
63         lp_config_destroy(lpc);
64         lpc2xml_context_destroy(ctx);
65         return 0;
66 }
67