📄 vidcapmain.c
字号:
/**
*** Copyright (c) 2002 Equator Technologies, Inc.
**/
/************************************************************************
***
*** FILENAME: vidcapmain.c
***
*** DESCRIPTION:
*** Test application for video capture and display.
***
*** This application captures and displays PAL or NTSC video.
***
*** Note: The Shark board only has one video input path.
***
*** Sample command lines:
*** NTSC: vidcap 0 1 0 0 (one input port)
*** vidcap 0 1 1 0 (alternate between two input ports)
*** PAL: vidcap 1 1 0 0 (one input port)
***
************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <eti/drv.h>
static void usage (void)
{
printf("usage: vidcap bUsePal bUsePort0 bUsePort1 NumFrames\n");
printf(" Zero NumFrames will run forever\n");
printf(" Set bUsePort to 1 for S-Video, 2 for composite\n");
}
SCODE vidcap(BOOL bUsePal, // Set to 0 to capture/display NTSC
BOOL bUsePort0, // Capture from video port 0
BOOL bUsePort1, // Capture from video port 1
int iFramesToCapture // Number of frames to capture (0=capture forever)
)
{
if ((bUsePal != 0 && bUsePal != 1) || // valid UsePal values
(bUsePort0 < 0 || bUsePort0 > 2) || // valid port0 values
(bUsePort1 < 0 || bUsePort1 > 2) || // valid port1 values
(bUsePort0 == 0 && bUsePort1 == 0) || // no input ports?
iFramesToCapture < 0)
{
usage();
exit(1);
}
printf("Video capture test application\n");
printf("Format: %s, Port0: %d, Port1: %d\n",
bUsePal ? "PAL" : "NTSC", bUsePort0, bUsePort1);
if (iFramesToCapture == 0) {
printf("Run forever\n");
}
else {
printf("Capture %d frames\n", iFramesToCapture);
}
return ProcessVidcap (bUsePal, bUsePort0, bUsePort1, iFramesToCapture);
}
// Command line entry point
void main(int argc, char *argv[])
{
SCODE err;
BOOL bUsePal;
BOOL bUsePort0;
BOOL bUsePort1;
int iFramesToCapture;
//
// Get command line arguments
//
if (argc != 5) {
usage();
exit(1);
}
bUsePal = atoi(argv[1]);
bUsePort0 = atoi(argv[2]);
bUsePort1 = atoi(argv[3]);
iFramesToCapture = atoi(argv[4]);
err = vidcap(bUsePal, bUsePort0, bUsePort1, iFramesToCapture);
exit(err == ETIDRV_OK ? 0 : 1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -