⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsknetwork.c

📁 TI公司C6000系列DSP(DM642)进行网络视频电话通讯源代码
💻 C
字号:
#include <std.h>
#include <tsk.h>
#include <stdio.h>
#include <csl.h>
#include <csl_cache.h>
#include <csl_dat.h>
#include <chan.h>
#include <scom.h>
#include <utl.h>
#include <ialg.h>

#include "appmain.h"
#include "appThreads.h"
#include "appBiosObjects.h"

#include "c:\ti\c6000\ndk\inc\netmain.h"

void tskNetworkTx()
{
    int      jpg_size,channel;
    UINT8    *jpg_buf;
    UINT8    *pFileBuffer;

    ScomMessage *pMsgBuf;
    SCOM_Handle hs_Enc2JPG,hs_JPG2Enc;

    hs_Enc2JPG = SCOM_open("ENC2NET");
    hs_JPG2Enc = SCOM_open("NET2ENC");

    if( !hs_Enc2JPG || !hs_JPG2Enc )
    {
        for(;;);
    }

    for(;;)
    {
        // Get a JPEG file
        pMsgBuf = SCOM_getMsg( hs_Enc2JPG, SYS_FOREVER );

        channel  = pMsgBuf->channel;
        jpg_size = pMsgBuf->sizeLinear;
        jpg_buf  = pMsgBuf->bufLinear;


        // Convert the JPG to a file so NETCAM still works
        if( jpg_size > 0 && jpg_size < 256000 )
        {
            pFileBuffer = mmBulkAlloc( jpg_size );
            if( pFileBuffer )
            {
                mmCopy( pFileBuffer, jpg_buf, jpg_size );

                if( channel == 1 )
                {
                    efs_destroyfile( "image1.jpg" );
                    efs_createfilecb( "image1.jpg", jpg_size, pFileBuffer,
                                    (EFSFUN)mmBulkFree, (UINT32)pFileBuffer );
                }
                else if( channel == 2 )
                {
                    efs_destroyfile( "image2.jpg" );
                    efs_createfilecb( "image2.jpg", jpg_size, pFileBuffer,
                                    (EFSFUN)mmBulkFree, (UINT32)pFileBuffer );
                }
            }
        }

        // We pulled the JPEG file into cache, so clean it out
        OEMCacheClean( jpg_buf, jpg_size );

        // Synch the cache
        OEMCacheCleanSynch();

        // Tell the encode that we're done with the JPEG file
        SCOM_putMsg( hs_JPG2Enc, pMsgBuf );
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -