The following example shows an example of how to close a CODEC instance. The ioCloseCodec routine frees memory associated with the CODEC.
LONG ioCloseCodec ( PCCB pccb )
{
LONG rc = MMIO_SUCCESS; /* Return code of IOProc's call. */
ENTERCRITX;
if (pccb->codecopen.pSrcHdr) {
HhpFreeMem(hheap,(PVOID)pccb->codecopen.pSrcHdr);
}
if (pccb->codecopen.pDstHdr) {
HhpFreeMem(hheap,(PVOID)pccb->codecopen.pDstHdr);
}
if (pccb->codecopen.pControlHdr) {
HhpFreeMem(hheap,(PVOID)pccb->codecopen.pControlHdr);
}
if (pccb->codecopen.pOtherInfo) {
HhpFreeMem(hheap,(PVOID)pccb->codecopen.pOtherInfo);
}
if (pccb->hCodec) {
rc = pccb->pmmioproc(&pccb->hCodec,
MMIOM_CODEC_CLOSE,
0L,
0L);
if (!rc) {
pccb->hCodec = 0L;
}
}
if (pccb->hmodule) {
//----DosFreeModule(pccb->hmodule);
pccb->hmodule = 0;
}
HhpFreeMem(hheap,(PVOID)pccb);
pccb = NULL;
EXITCRIT;
return(rc);
}