📄 overlayaud.c
字号:
/***** Copyright (c) 2002 Equator Technologies, Inc.**//****************************************************************************** FILENAME: overlayaud.c****** DESCRIPTION:*** Test application for video capture and display overlay with Audio.****** This application captures two video sources (PAL or NTSC),*** displaying one in a picture-in-picture window. A graphics overlay*** is also drawn on the screen.****** Note: This application will only function on boards with two*** video sources (e.g. Stingray, Dolphin).****** Sample command lines:*** NTSC: overlayaud 0 1 0 0*** PAL: overlayaud 1 1 0 0***************************************************************************/#include <eti/drv.h>// Macro for checking a driver return code#define CHECK_RC(rc, fnname) \ if (ETIDRV_CHECK_ERROR(rc)) { \ printf(fnname ## " failed, error = 0x%08x\n", rc); \ exit(1); \ }// Main processing functionSCODE ProcessOverlay_Audio( BOOL bUsePal, // Set to 0 to capture/display NTSC BOOL bUsePort0, // Set to 1 to enable primary video in BOOL bUsePort1, // Set to 1 to enable secondary video in int iFramesToCapture // Number of frames to capture (0=capture forever)){ SCODE err = ETIDRV_OK; int iFrameCount; err = InitOverlay(bUsePal, bUsePort0, bUsePort1); CHECK_RC(err, "InitOverlay"); if (bUsePal) err = InitAudio(25); // 25 frames per sec to match PAL else err = InitAudio(30); // 30 frames per sec to match NTSC CHECK_RC (err, "InitAudio"); // // Loop the desired number of frames (0 = forever) // iFrameCount = 0; while (iFramesToCapture == 0 || iFrameCount < iFramesToCapture) { err = ProcessOverlaySingle(iFrameCount); CHECK_RC(err, "ProcessOverlaySingle"); err = ProcessAudioSingle(); CHECK_RC(err, "ProcessAudioSingle"); ++iFrameCount; } err = CloseOverlay(); CHECK_RC(err, "CloseOverlay"); err = CloseAudio(); CHECK_RC(err, "CloseAudio"); return err;}static void usage (void){ printf("usage: overlayaud bUsePal bUsePort0 bUsePort1 NumFrames\n"); printf(" Zero NumFrames will run forever\n");}SCODE overlayaud( BOOL bUsePal, // Set to 0 to capture/display NTSC BOOL bUsePort0, // Set to 1 to enable primary video in BOOL bUsePort1, // Set to 1 to enable secondary video in int iFramesToCapture // Number of frames to capture (0=capture forever)){ if ((bUsePal != 0 && bUsePal != 1) || // valid UsePal values (bUsePort0 != 0 && bUsePort0 != 1) || // valid port0 values (bUsePort1 != 0 && bUsePort1 != 1) || // valid port1 values (bUsePort0 == 0 && bUsePort1 == 0) || // no input ports? iFramesToCapture < 0) { usage(); exit(); } printf("Overlay and Audio test application\n"); return ProcessOverlay_Audio (bUsePal, bUsePort0,bUsePort1,iFramesToCapture);}#ifndef RTOSvoid main(int argc, char *argv[]){ SCODE err; BOOL bUsePal = 0; BOOL bUsePort0 = 0; BOOL bUsePort1 = 0; int iFramesToCapture = 0; // // 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 = overlayaud(bUsePal, bUsePort0, bUsePort1, iFramesToCapture); exit (err == ETIDRV_OK ? 0 : 1);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -