summaryrefslogtreecommitdiff
path: root/zttranscode.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-23 23:57:10 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-23 23:57:10 +0000
commitdf1e7f7b0470bd759c9687eeffdcbeee02778008 (patch)
treefbd777063821d50d81aeb1ed0999f4eb6cfd1671 /zttranscode.c
parente30d85766ea8d6b623f0964cbf8129c6c7700462 (diff)
partial update to support all the stuff that went into Zaptel 1.2 recently... this definitely still broken for 2.4 kernels, and maybe for 2.6 as well :-)
includes: Makefile split and reorganize TE120P driver TC400B driver HPEC support (not yet complete) git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@2215 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zttranscode.c')
-rw-r--r--zttranscode.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/zttranscode.c b/zttranscode.c
index 7e3d287..cf99b8a 100644
--- a/zttranscode.c
+++ b/zttranscode.c
@@ -3,7 +3,7 @@
*
* Written by Mark Spencer <markster@digium.com>
*
- * Copyright (C) 2006, Digium, Inc.
+ * Copyright (C) 2006-2007, Digium, Inc.
*
* All rights reserved.
*
@@ -42,7 +42,7 @@
#ifdef STANDALONE_ZAPATA
#include "zaptel.h"
#else
-#include <zaptel/zaptel.h>
+#include <linux/zaptel.h>
#endif
#ifdef LINUX26
#include <linux/moduleparam.h>
@@ -74,6 +74,8 @@ struct zt_transcoder *zt_transcoder_alloc(int numchans)
init_waitqueue_head(&ztc->channels[x].ready);
ztc->channels[x].parent = ztc;
ztc->channels[x].offset = x;
+ ztc->channels[x].chan_built = 0;
+ ztc->channels[x].built_fmts = 0;
}
return ztc;
@@ -207,15 +209,18 @@ static void ztc_release(struct zt_transcoder_channel *ztc)
if (!ztc)
return;
- for (page = virt_to_page(zth);
- page < virt_to_page((unsigned long) zth + sizeof(*zth));
- page++)
- ClearPageReserved(page);
-
ztc->flags &= ~(ZT_TC_FLAG_BUSY);
- if (ztc->tch)
+
+ if(ztc->tch) {
+ for (page = virt_to_page(zth);
+ page < virt_to_page((unsigned long) zth + sizeof(*zth));
+ page++)
+ ClearPageReserved(page);
kfree(ztc->tch);
+ }
+
ztc->tch = NULL;
+ /* Actually reset the transcoder channel */
if (ztc->flags & ZT_TC_FLAG_TRANSIENT)
kfree(ztc);
if (debug)
@@ -252,6 +257,8 @@ static int do_reset(struct zt_transcoder_channel **ztc)
for (x = 0; x < tc->numchannels; x++) {
if (tc->channels[x].flags & ZT_TC_FLAG_BUSY)
continue;
+ if ((tc->channels[x].chan_built) && ((zth->srcfmt | zth->dstfmt) != tc->channels[x].built_fmts))
+ continue;
newztc = &tc->channels[x];
newztc->flags = ZT_TC_FLAG_BUSY;
@@ -274,7 +281,7 @@ static int do_reset(struct zt_transcoder_channel **ztc)
/* Actually reset the transcoder channel */
if ((*ztc)->parent && ((*ztc)->parent->operation))
- return (*ztc)->parent->operation((*ztc), ZT_TCOP_RESET);
+ return (*ztc)->parent->operation((*ztc), ZT_TCOP_ALLOCATE);
return -EINVAL;
}
@@ -308,6 +315,7 @@ static int zt_tc_getinfo(unsigned long data)
return -ENOSYS;
strncpy(info.name, tc->name, sizeof(info.name) - 1);
+ info.numchannels = tc->numchannels;
info.srcfmts = tc->srcfmts;
info.dstfmts = tc->dstfmts;
@@ -333,11 +341,17 @@ static int zt_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case ZT_TCOP_GETINFO:
ret = zt_tc_getinfo(data);
break;
- case ZT_TCOP_RESET:
+ case ZT_TCOP_ALLOCATE:
/* Reset transcoder, possibly changing who we point to */
ret = do_reset(&ztc);
file->private_data = ztc;
break;
+ case ZT_TCOP_RELEASE:
+ ret = ztc->parent->operation(ztc, ZT_TCOP_RELEASE);
+ break;
+ case ZT_TCOP_TEST:
+ ret = ztc->parent->operation(ztc, ZT_TCOP_TEST);
+ break;
case ZT_TCOP_TRANSCODE:
if (!ztc->parent->operation)
return -EINVAL;
@@ -449,7 +463,7 @@ void zttranscode_cleanup(void)
}
#ifdef LINUX26
-module_param(debug, int, 0600);
+module_param(debug, int, S_IRUGO | S_IWUSR);
#else
MODULE_PARM(debug, "i");
#endif