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

📄 sdatabuf.h

📁 direct show
💻 H
字号:
#ifndef STREAM_DATA_BUFFAR_H
#define STREAM_DATA_BUFFAR_H
//#include "ddkh.h"
#ifdef  DDK_DRIVER_HEADER
#define DWORD    ULONG
#define BOOL     BOOLEAN
#endif

//Stream type id define
//DO NOT CHANGE THE ODRER, if you change the order,you must change the
//AllStream struct

#define AUDIO_IN_A1     0
#define MPG_IN_DEBIS1   1
#define MPG_IN_DEBIS2   2

#define AUDIO_OUT_A1    3
#define AUDIO_IN_A2     4
#define AUDIO_OUT_A2    5
//#define VIDEO_IN_FIDA   4
//#define VIDEO_IN_FIDB   5
//#define MPG_IN_DEBIS1   6
//#define MPG_IN_DEBIS2   7
#define LAST_ID         2

#define MAX_ID     LAST_ID + 1    

//Driver stream id define
#define STREAM_ENCODER1   MPG_IN_DEBIS1
#define STREAM_ENCODER2   MPG_IN_DEBIS2
#define STREAM_AUDIOIN    AUDIO_IN_A1

//Stream int MASK
#define AUDIO_IN_A1_MSK     (1<<13)
#define AUDIO_OUT_A1_MSK    (1<<12)
#define AUDIO_IN_A2_MSK     (1<<15)
#define AUDIO_OUT_A2_MSK    (1<<14)
#define VIDEO_IN_FIDA_MSK   (1<<8)
#define VIDEO_IN_FIDB_MSK   (1<<7)
#define MPG_IN_DEBIS_MSK    (1<<19)


//Error code define m_SQDErr value
#define   SQD_NOERR 		 0     
#define   SQD_HAS_OPENED 	 -1
#define   SQD_UNKNOW_STREAM_ID 	 -2
#define   SQD_STREAM_NOT_OPENED  -3
#define   SQD_ENABLE_HWINT_ERR   -4
#define   SQD_NOT_SUPPORTED      -5
#define   SQD_ZERO_POINTER       -6
#define   SQD_CREATE_STREAM_EVENT_ERR  -7
#define   SQD_IN_PARAMS_ERR         -8
#define   SQD_MEM_ALLOC_ERR      -9
#define   SQD_DEVICE_NOT_EXIST   -10
#define   SQD_VXD_OPENSTREAM_ERR   -11
#define   SQD_VXD_STOPSTREAM_ERR  -12
#define   SQD_VXD_STARTSTREAM_ERR   -13
#define   SQD_VXD_CLOSESTREAM_ERR -14
#define   SQD_STREAM_NO_BUF_ERR   -15
#define   SQD_STREAM_NOT_STOPED   -16
#define   SQD_STREAM_NOT_STARTED   -17

//flag define
#define BUF_FULL           1   //buf full
#define BUF_IN_VXD_QUE     2   //buf is in vxd empty queue 
#define BUF_BEEN_USED      4   //buf is been used by ring3

//ping pang buf write to one buf and read from other buf
typedef struct {
DWORD first_audinbuf;
DWORD second_audinbuf;
DWORD first_audinbuf_r0;
DWORD second_audinbuf_r0;
int   buflength;
int PhyAudInBufMiddle;
} DevAudIn, *PDevAudIn ;

typedef struct {
DWORD first_audoutbuf;
DWORD second_audoutbuf;
DWORD first_audoutbuf_r0;
DWORD second_audoutbuf_r0;
int   buflength;
int PhyAudOutBufMiddle;
} DevAudOut, *PDevAudOut ;

#define MAX_ENCODER  2

//define subid_reg value
//Mpg channel 1 two hardware buf
#define CH1_FIRST_MPGINBUF       0
#define CH1_SECOND_MPGINBUF      1
//Mpg channel 2 two hardware buf
#define CH2_FIRST_MPGINBUF       (0<<4)
#define CH2_SECOND_MPGINBUF      (1<<4)


typedef struct {
DWORD first_mpginbuf;
DWORD second_mpginbuf;
DWORD first_mpginbuf_r0;
DWORD second_mpginbuf_r0;
int   buflength;
DWORD subid_reg;
DWORD int_event_mask; //mpg attached int event mask 
DWORD int_mc1_start_mask; //start bit mask in mc1 reg
int   channel_id;       
} DevMpgIn, *PDevMpgIn ;

//this is the buffer (queue) struct
typedef struct stream_que_buf {
void * pdatbuf;      //data buffer
//void * pdatbuftmp;//temp data buffer pointer
int    buflength; //byte length of data buffer
DWORD  flag;      //flags
BOOL   is_read;   //TRUE=user read, FALSE=user write
int  streamid;    //stream type id
struct stream_que_buf * pnext; //pointer next 
//*** ring 0 use them,ring3 user do not use them****//
void * pdatbuf_r0;   //ring 0 data buffer
void * pdatbuftmp_r0;//ring 0 temp data buffer pointer
struct stream_que_buf * pnext_r0; //ring 0 use pointer next 
struct stream_que_buf * pthis_r0; //save this buf head ring0 pointer
} SQueDataBuf, *PSQueDataBuf;

typedef struct {
PSQueDataBuf * arry_ptr;
int total_ptr;
} SQueSavBuf,* PSQueSavBuf;

typedef struct {
#ifndef  DDK_DRIVER_HEADER
SQueDataBuf * queh; //que head pointer
SQueDataBuf * quet; //que tail pointer
#else
//*** ring 0 use them,ring3 user do not use them****//
SQueDataBuf * queh_r0; //ring0 que head pointer
SQueDataBuf * quet_r0; //ring0 que tail pointer
#endif
} BufQue , * PBufQue;

//state is one of three state
#define STREAM_CLOSE   0
#define STREAM_OPEN    1
#define STREAM_START   2
//only vxd use
#define STREAM_OVERFLOW 4 //STREAM_OK


//every stream has one this struct
typedef struct stream_que_data {
int    State; 
HANDLE hStreamEvent;
SQueSavBuf   TotalBufNode;// save this stream all buf head pointer,for free all buf
PSQueDataBuf pFullQueHead; //the first full data buf poniter
PSQueDataBuf pFullQueTail; //the first full data buf poniter
PVOID        pStreamDevParam; //the special data use for stream dev
int  BufCount;        //the number of the SQueDataBuf in this stream
//DWORD int_mask;
} SQD, *PSQD;

//stream State define
//#define STREAM_START  	2 //STREAM_STOP   0
//#define STREAM_OPEN   	1 //STREAM_CLOSE  0
//#define STREAM_OVERFLOW 4 //STREAM_OK

#ifdef  DDK_DRIVER_HEADER

//this is the driver stream struct
typedef struct drv_sqd {
//int StreamId;
HANDLE  hStreamEvent;   //this event will inform the ring3 app,Vxd HAS finished process. 
PKEVENT pEvent;
PSQueDataBuf pQueHead_r0; //delete ring0 buf from head
PSQueDataBuf pQueTail_r0; //insert ring0 buf to tail
PVOID pGeneral_r0;        //this is a ring0 general pointer, is is different for different stream id
                          //it is used to save the id specify device data 
int State;             //this stream state
DWORD LostCounter;     //this stream buffer data lost counter in driver  
} DRVStream,* PDRVStream;

#endif


#endif

⌨️ 快捷键说明

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