[zaptel-commits] kpfleming: branch mogorman/zaptel-1.2-transcoder
r2015 - /team/mogorman/zapte...
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Mon Jan 29 15:52:57 MST 2007
Author: kpfleming
Date: Mon Jan 29 16:52:57 2007
New Revision: 2015
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2015
Log:
don't use global variables for local operations
Modified:
team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c
Modified: team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c?view=diff&rev=2015&r1=2014&r2=2015
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c Mon Jan 29 16:52:57 2007
@@ -359,10 +359,6 @@
unsigned int dte_seqno_rcv;
};
-static struct zt_transcoder *uencode;
-static struct zt_transcoder *udecode;
-static struct dte_state *encoders;
-static struct dte_state *decoders;
static int debug = 0;
static char *mode;
u32 debug_packets = 0;
@@ -1326,6 +1322,8 @@
unsigned int complexfmts;
struct firmware embedded_firmware;
const struct firmware *firmware = &embedded_firmware;
+ struct dte_state *encoders;
+ struct dte_state *decoders;
for (x = 0; x < (sizeof(ifaces) / sizeof(ifaces[0])); x++)
if (!ifaces[x]) break;
@@ -1424,15 +1422,15 @@
wc->numchannels = min_numchannels;
}
- uencode = zt_transcoder_alloc(wc->numchannels);
- udecode = zt_transcoder_alloc(wc->numchannels);
+ wc->uencode = zt_transcoder_alloc(wc->numchannels);
+ wc->udecode = zt_transcoder_alloc(wc->numchannels);
encoders = vmalloc(sizeof(*encoders) * wc->numchannels);
decoders = vmalloc(sizeof(*decoders) * wc->numchannels);
- if (!uencode || !udecode || !encoders || !decoders) {
- if (uencode)
- zt_transcoder_free(uencode);
- if (udecode)
- zt_transcoder_free(udecode);
+ if (!wc->uencode || !wc->udecode || !encoders || !decoders) {
+ if (wc->uencode)
+ zt_transcoder_free(wc->uencode);
+ if (wc->udecode)
+ zt_transcoder_free(wc->udecode);
if (encoders)
vfree(encoders);
if (decoders)
@@ -1444,27 +1442,24 @@
memset(encoders, 0, sizeof(*encoders) * wc->numchannels);
memset(decoders, 0, sizeof(*decoders) * wc->numchannels);
- strcpy(udecode->name, "DTE Decoder");
- strcpy(uencode->name, "DTE Encoder");
-
- udecode->srcfmts = uencode->dstfmts = complexfmts;
- udecode->dstfmts = uencode->srcfmts = ZT_FORMAT_ULAW | ZT_FORMAT_ALAW;
-
- udecode->operation = uencode->operation = dte_operation;
+ strcpy(wc->udecode->name, "DTE Decoder");
+ strcpy(wc->uencode->name, "DTE Encoder");
+
+ wc->udecode->srcfmts = wc->uencode->dstfmts = complexfmts;
+ wc->udecode->dstfmts = wc->uencode->srcfmts = ZT_FORMAT_ULAW | ZT_FORMAT_ALAW;
+
+ wc->udecode->operation = wc->uencode->operation = dte_operation;
for (x = 0;x < wc->numchannels; x++) {
dte_init_state(&encoders[x], 1, x, wc);
encoders[x].encoder = 1;
dte_init_state(&decoders[x], 0, x, wc);
- uencode->channels[x].pvt = &encoders[x];
- udecode->channels[x].pvt = &decoders[x];
- }
-
- wc->uencode = uencode;
- wc->udecode = udecode;
-
- zt_transcoder_register(uencode);
- zt_transcoder_register(udecode);
+ wc->uencode->channels[x].pvt = &encoders[x];
+ wc->udecode->channels[x].pvt = &decoders[x];
+ }
+
+ zt_transcoder_register(wc->uencode);
+ zt_transcoder_register(wc->udecode);
/* Enable bus mastering */
pci_set_master(pdev);
More information about the zaptel-commits
mailing list