diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-18 16:57:27 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-18 16:57:27 +0000 |
commit | d5fdbf3ae45e14564fba04ec2874b3f3f5ff1d5c (patch) | |
tree | 32d0ec356eb9250adcf7ebbdd995c29b7844356c /codecs | |
parent | 64de60f14566734bac074a9c5443d3af4e389e47 (diff) |
look for transcoder in proper place based on build against Zaptel or DAHDI
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@138663 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs')
-rw-r--r-- | codecs/codec_dahdi.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/codecs/codec_dahdi.c b/codecs/codec_dahdi.c index 00dd94bb2..321dac4d7 100644 --- a/codecs/codec_dahdi.c +++ b/codecs/codec_dahdi.c @@ -139,7 +139,7 @@ static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) /* Give the frame to the hardware transcoder... */ res = write(ztp->fd, f->data, f->datalen); if (-1 == res) { - ast_log(LOG_ERROR, "Failed to write to /dev/dahdi/transcode: %s\n", strerror(errno)); + ast_log(LOG_ERROR, "Failed to write to transcoder: %s\n", strerror(errno)); } if (f->datalen != res) { ast_log(LOG_ERROR, "Requested write of %d bytes, but only wrote %d bytes.\n", f->datalen, res); @@ -168,7 +168,7 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt) /* Nothing waiting... */ return NULL; } else { - ast_log(LOG_ERROR, "Failed to read from /dev/dahdi/transcode: %s\n", strerror(errno)); + ast_log(LOG_ERROR, "Failed to read from transcoder: %s\n", strerror(errno)); return NULL; } } else { @@ -234,10 +234,17 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source) struct pvt *ztp = pvt->pvt; int flags; +#ifdef HAVE_ZAPTEL + if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0) { + ast_log(LOG_ERROR, "Failed to open /dev/zap/transcode: %s\n", strerror(errno)); + return -1; + } +#else if ((fd = open("/dev/dahdi/transcode", O_RDWR)) < 0) { ast_log(LOG_ERROR, "Failed to open /dev/dahdi/transcode: %s\n", strerror(errno)); return -1; } +#endif ztp->fmts.srcfmt = (1 << source); ztp->fmts.dstfmt = (1 << dest); @@ -405,10 +412,17 @@ static int find_transcoders(void) int fd, res; unsigned int x, y; +#ifdef HAVE_ZAPTEL + if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0) { + ast_log(LOG_ERROR, "Failed to open /dev/zap/transcode: %s\n", strerror(errno)); + return 0; + } +#else if ((fd = open("/dev/dahdi/transcode", O_RDWR)) < 0) { ast_log(LOG_ERROR, "Failed to open /dev/dahdi/transcode: %s\n", strerror(errno)); return 0; } +#endif for (info.tcnum = 0; !(res = ioctl(fd, DAHDI_TC_GETINFO, &info)); info.tcnum++) { if (option_verbose > 1) |