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

📄 audioparsebuffer.h

📁 完整的基于Conxant平台的USB电视棒的WIN驱动程序。
💻 H
字号:
#ifndef _AUDIO_PARSE_BUFFER_H_
#define _AUDIO_PARSE_BUFFER_H_

extern "C" 
{
#include <wdm.h>
}

#include <windef.h>
#include <ks.h>
#include <ksmedia.h>

/*+++ *******************************************************************\ 
* 
*  Copyright and Disclaimer: 
*  
*     --------------------------------------------------------------- 
*     This software is provided "AS IS" without warranty of any kind, 
*     either expressed or implied, including but not limited to the 
*     implied warranties of noninfringement, merchantability and/or 
*     fitness for a particular purpose.
*     --------------------------------------------------------------- 
*   
*     Copyright (c) 2008 Conexant Systems, Inc. 
*     All rights reserved. 
*
\******************************************************************* ---*/ 
#include "BasePin.h"

class AncillaryPacket;

class AudioParseBuffer
{
    //Note that the actual maximum on data bytes is 32, since there 
    // are 4 audio channels which send 8 bytes of data each.  
    //However, we are only interested in channels 1 and 2, so we will
    // never use more than the first 16 data bytes.

    typedef struct _AUDIO_PACKET
    {
        BYTE    header00;
        BYTE    headerFF_1;
        BYTE    headerFF_2;
        BYTE    data_id;
        BYTE    data_id2;
        BYTE    data_count;
        WORD    data_channel1[4];       
        WORD    data_channel2[4];       
    }AUDIO_PACKET, *PAUDIO_PACKET;

public:
    AudioParseBuffer();
     DWORD parseBuffer(AncillaryPacket* p_packet);

    VOID setPin(BasePin* _p_pin);
    VOID releasePin();

protected:
   DWORD copySamplesIntoBuffer(
                                               PWORD p_samples, 
                                               DWORD sample_count,
                                               DWORD channel_number) ;
                                               
    
    VOID completeCurrentBuffer();

private:
    
    PKSSTREAM_POINTER   _p_current_buffer;
    DWORD               _channel1_samples_in_buffer;
    DWORD               _channel2_samples_in_buffer;
    BasePin*            _p_pin;
    KMUTEX              _mutex;
};
////////////////////////////////////////////////////////////////////////////////////////////
class AudioIISBuffer
{
   
    
public:
    AudioIISBuffer();
     DWORD parseBuffer(PBYTE p_data, DWORD data_count);

    VOID setPin(BasePin* _p_pin);
    VOID releasePin();
	VOID completeBuffers(PBYTE p_data, DWORD data_count);

protected:
      
                                              
    VOID completeCurrentBuffer();
	VOID sleep(LONG time);

private:
    
    PKSSTREAM_POINTER   _p_current_buffer;

      DWORD	           _remain_in_buffer;
    BasePin*            _p_pin;
    KMUTEX              _mutex;
    DWORD 		   _fail_count;

    PKSSTREAM_POINTER _p_partial_buffer;
    DWORD            _bytes_in_partial_buffer;
};


#endif

⌨️ 快捷键说明

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