1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* Wilcard TC400B Digium Transcoder Engine Interface Driver for Zapata Telephony interface test tool.
*
* Written by Matt O'Gorman <mogormandigium.com>
*
* Copyright (C) 2006, Digium, Inc.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <sys/mman.h>
#include <zaptel/zaptel.h>
struct format_map {
unsigned int map[32][32];
};
static int find_transcoders(void)
{
struct zt_transcode_info info = { 0, };
struct format_map map = { { { 0 } } };
int fd, res;
unsigned int x, y;
info.op = ZT_TCOP_GETINFO;
if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0) {
printf("Warning: No Zaptel transcoder support!\n");
return 0;
}
for (info.tcnum = 0; !(res = ioctl(fd, ZT_TRANSCODE_OP, &info)); info.tcnum++) {
printf("Found transcoder %d, '%s'.\n",info.tcnum, info.name);
x = ZT_TCOP_TEST;
ioctl(fd, ZT_TRANSCODE_OP, &x);
}
close(fd);
if (!info.tcnum)
printf("No hardware transcoders found.\n");
return 0;
}
int main()
{
printf("this is a test\n");
find_transcoders();
return 0;
}
|