📄 lvideoca.h
字号:
#ifndef __LVIDEOCA_H__
#define __LVIDEOCA_H__
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// For module global variables declaration....
#ifdef __VIDEOCAP_CPP__
#define GLOBAL
#else
#define GLOBAL extern
#endif // __VIDEOCAP_CPP__
#define VIDEOCAP_CONFIG_REGISTRY "SOFTWARE\\MPEG-I\\WMPEG200"
#define VIDEOCAP_LOG_FILENAME "\\VideoCap.log"
#define VIDEO_BUFFER_COUNT "VideoBufferCount"
#define VIDEO_BUFFER_SIZE "VideoBufferSize"
#define LOG_BUFFER_EVENT "LogBufferEvent"
#define USE_LOG_FILE "UseLogFile"
#define DEFAULT_VIDEO_BUFFER_SIZE 163840 // 32768 * 5
#define MIN_VIDEO_BUFFER_SIZE 32768 // 32K bytes
#define MAX_VIDEO_BUFFER_SIZE DEFAULT_VIDEO_BUFFER_SIZE
#define YCbCr_420_NTSC_FULL_SIZE 704L*480*3/2
#define YCbCr_420_NTSC_SIF_SIZE 352L*240*3/2
#define YCbCr_420_NTSC_QSIF_SIZE 176L*112*3/2
#define YCbCr_420_SQUARE_SIF_SIZE 320L*240*3/2
#define YCbCr_420_SQUARE_QSIF_SIZE 160L*112*3/2
#define YCbCr_420_PAL_FULL_SIZE 704L*576*3/2
#define YCbCr_420_PAL_SIF_SIZE 352L*288*3/2
#define YCbCr_420_PAL_QSIF_SIZE 176L*144*3/2
#define LOGO_WIDTH 96
#define LOGO_HEIGHT 32
// Define the range and default value for video buffer count
#define MIN_VIDEO_BUFFER_COUNT 2
#define MAX_VIDEO_BUFFER_COUNT 64
#define DEFAULT_VIDEO_BUFFER_COUNT 10
typedef enum _VIDEO_OPERATION_MODE
{
STOP_MODE,
LVE_MODE,
LVPT_MODE,
LVSS_MODE,
SFE_MODE
} VIDEO_OPERATION_MODE, *PVIDEO_OPERATION_MODE;
typedef struct _VIDEOCAP_BUFFER_CONFIG
{
ULONG ulSize;
HGLOBAL hBufferHandle;
LPBYTE lpBuffer;
OVERLAPPED OverlappedEvent;
} VIDEOCAP_BUFFER_CONFIG, *PVIDEOCAP_BUFFER_CONFIG;
/*--------------------------------------
Members:
ulSize
The buffer size.
hBufferHandle
The buffer handle.
lpBuffer
The buffer pointer.
OverlappedEvent
The overlap event.
--------------------------------------*/
typedef struct _VIDEOCAP_GLOBAL_CONFIG
{
int iVideoBufferCount; // Indicate the total video buffers for each device slot.
// The size of each video buffer should bigger than
// 352*288*3/2=152064 bytes. We define it as 163840 bytes.
int iVideoBufferSize; // Indicate the video buffer size at recording mode.
// Its size must be 32768*n bytes.
int iLogBufferEvent; // Dump buffer events.
int iUseLogFile; // Dump other information.
} VIDEOCAP_GLOBAL_CONFIG, *PVIDEOCAP_GLOBAL_CONFIG;
typedef struct _VIDEOCAP_QUEUE_NODE
{
DWORD dwBufferIndex; // The buffer index
DWORD dwBufferDataSize; // The data size at buffer
} VIDEOCAP_QUEUE_NODE, *PVIDEOCAP_QUEUE_NODE;
typedef struct _VIDEOCAP_THREAD_PARAMETERS
{
DWORD dwSlotNumber; // The device's slot number
HANDLE hThreadFinishEvent; // The thread finish event
} VIDEOCAP_THREAD_PARAMETERS, *PVIDEOCAP_THREAD_PARAMETERS;
typedef struct _VIDEOCAP_GDS
{
PVIDEOCAP_GLOBAL_CONFIG pGlobalConfig;
MPJ_CaptureConfigValues *pCaptureDefaultConfig;
PVIDEOCAP_BUFFER_CONFIG pVideoBufferConfig; // Point the video buffers.
// The total number is defined at
// registry value VideoBufferCount.
PVIDEOCAP_QUEUE_NODE pQueueList; // A queue list maintains the video
// buffers have not been processed.
DWORD dwQueueHead;
DWORD dwQueueTail;
DWORD dwAddQueueCount;
DWORD dwReadQueueCount;
COMMON_PHandleBufferFunction pHandleBufferFunction; // Function pointer that
// handles video buffer.
MPJ_SessionID SessionID; // Current device slot's session ID.
VIDEO_OPERATION_MODE OperationMode; // Current device slot's operation mode.
HANDLE hThread; // The thread handle for each device slot.
DWORD dwThreadID; // The thread ID for each device slot.
HANDLE hThreadFinishEvent; // The thread will be ended when the event signaled.
HANDLE hThreadReadyEvent; // (1) The thread is ready or not, (2) stop the waitting buffer event loop.
BOOL fStop; // Turn on this flag will cause video capture process stop.
DWORD dwVideoUsedBufferSize; // The current video buffer size evaluated at VIDEOCAP_StartCapture.
DWORD dwRuntimeErrorCode; // Indicate the error code happened at capture period.
DWORD dwStartTicks; // The start tick count of device slot's capture action.
} VIDEOCAP_GDS, *PVIDEOCAP_GDS;
GLOBAL PVIDEOCAP_GDS _pGDS;
GLOBAL DWORD _dwTotalSlotNumber;
GLOBAL VIDEOCAP_GLOBAL_CONFIG _GlobalConfig;
//=============================
// Module functions
//=============================
// At VideoCap.cpp
int VIDEOCAP_HandleBufferEvents( DWORD dwSlotNumber, int iBufferIndex );
int VIDEOCAP_WaitEvent( DWORD dwSlotNumber );
void InitModule( LPBYTE lpRegistryPath );
// At BufferQueue.cpp
int InitQueue( DWORD dwSlotNumber );
int AddQueue( DWORD dwSlotNumber, PVIDEOCAP_QUEUE_NODE pQueueNode );
int SendQueueNodetoHandler( DWORD dwSlotNumber );
// At VideoThread.cpp
DWORD VideoThread( PVIDEOCAP_THREAD_PARAMETERS lpThreadParameters );
// At Buffer.cpp
int VIDEOCAP_CreateBuffer( PVIDEOCAP_BUFFER_CONFIG pBufferConfig );
int VIDEOCAP_FreeBuffer( PVIDEOCAP_BUFFER_CONFIG pBufferConfig );
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __LVIDEOCA_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -