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

📄 play_rmcapture.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 3 页
字号:
/* * * Copyright (c) 2001-2007 Sigma Designs, Inc.  * All Rights Reserved. Proprietary and Confidential. * *//**	@file   play_rmcapture.c	@brief  sample application to show how to use rmcapture		@author Christian Wolff Sean.Sekwon.Choi*/// to enable or disable the debug messages of this source file, put 1 or 0 below#if 1#define LOCALDBG ENABLE#else#define LOCALDBG DISABLE#endif#include "sample_os.h"#define ALLOW_OS_CODE 1#include "../rua/include/rua.h"#include "../rua/include/rua_property.h"#include "../dcc/include/dcc.h"#include "../dcc/include/dcc_macros.h"#include "../rmcore/include/rmstatustostring.h"#include "../rmlibcw/include/rmlibcw.h"#include "../emhwlib_hal/pll/include/pll_hal.h"#include "command_ids.h"#include "get_key.h"#include "common.h"#include "../rmcapture/include/rmcapture.h"////////////////////////////////////////////////////////////////////////////////struct RUA *pInstance = NULL;struct display_cmdline disp_opt;struct capture_cmdline capture_opt[2];struct audio_cmdline audio_opt;struct rmcapture_options rmcapture_options;struct local_cmdline {	RMuint32 chip_num;	enum cap_board board;	RMuint32 input_num;	RMuint32 i2c_module;	RMuint32 TimerNumber;	RMbool zoom_force;	RMuint32 zoom_x;	RMuint32 zoom_y;	RMuint32 zoom_w;	RMuint32 zoom_h;	RMuint32 zoomstep;	RMbool force_overscan_crop;	RMuint32 overscan_crop_amount;	RMuint32 overscan_crop;  // percentage of frame size to crop around edge for overscanned pictures	struct EMhwlibDisplayWindow *output_window;	RMuint32 arg_vbi;	RMbool parse_anc;	RMbool print_anc;	RMbool dump_vbi;	RMbool enable_i2c_cc;	RMbool enable_i2c_wss;	struct EMhwlibInputReadbackI2CCC i2c_cc;	RMbool ccfifo_print;	RMuint32 use_soft_cc_decoder;	RMuint32 ccfifo_id_in;	RMuint32 ccfifo_id_send;	RMuint32 ccfifo_id_out;	RMuint32 ccfifo_addr_in;	RMuint32 ccfifo_addr_out;	RMuint32 VBIFlags;	RMuint32 VBIPTS;	RMuint32 VBISequence;	RMuint32 VBISize;	RMuint32 VBIOffs;	RMuint16 *pVBIChunk;	RMuint16 *pVBIData;	FILE *vbidump;	RMbool update;	RMbool use_gpio_fid;	RMbool invert_fid;	RMbool last_hotplug;	struct ReceiveObject_type *pR;	struct RUABufferPool *pDmaReceive;	RMbool force_active_format;	enum EMhwlibActiveFormat active_format;	RMbool force_wide_screen;	RMbool wide_screen;	RMuint32 wss_odd;	RMuint32 wss_even;	RMbool last_hdcp_ok;	RMbool last_power;	RMbool last_sync;	RMbool last_clock;	RMbool last_auth;	RMbool last_crypt;	RMbool break_hdcp;	RMuint32 cable_eq;	RMbool new_avi;	enum EMhwlibScanInfo last_scan;	RMbool update_videomode;	RMbool follow_vfreq;	RMbool verbouse;	RMbool intr_debug;	RMbool green_bg;//	enum hdmi_mode hdmi_mode;  // TRUE: HDMI with info frames, audio etc. FALSE: DVI mode	RMbool upsample_from_422;	RMuint32 CurrChStat;	RMuint16 CurrPc;	RMuint8 last_isrc[32];	RMuint8 last_isrc_header;	RMbool last_isrc2;	RMuint8 intr_mask[6];	enum audio_state audio_state;	RMuint64 audio_guard_time;	RMbool restart_audio;  // have to restart audio passthrough due to errors or changes	RMbool audio_pll_locked;  // stability of audio clock	RMbool lpcm_24bit;	enum EMhwlibTVStandard old_std;	enum EMhwlibTVStandard prev_std;	RMuint32 same_ct;} local_opt[2];//////////////////////////////////////////////////////////////////////////////////// Command line Option Processing//////////////////////////////////////////////////////////////////////////////////#define SCANPARAM(x, msg, skip)\do {\	argi++;\	if (argi < argc) {\		param = strtoul(argv[argi], &endptr, 0);\		if (endptr[0] == '\0') x = param;\		else {\			fprintf(stderr, msg " after %s\n", argv[argi - skip]);\			err = RM_ERROR;\		}\	} else {\		fprintf(stderr, "Please specify %d number%s after %s\n", skip, (skip == 1) ? "" : "s", argv[argi - skip]);\		err = RM_ERROR;\	}\} while(0)// zoom helper defines#undef ZOOM_0#undef ZOOM_1#define ZOOM_0 4096  // 0% zoom position#define ZOOM_1 8192  // 100% zoom position// options->output_window needs to be set when calling this!static RMstatus init_local_options(	struct local_cmdline *options){	RMDBGLOG((ENABLE, "%s\n",__func__));		options->chip_num = 0;	options->board = cap_board_none;	options->input_num = 0;	options->i2c_module = 1;	options->TimerNumber = 1;	options->zoom_force = FALSE;	options->zoom_x = ZOOM_0;	options->zoom_y = ZOOM_0;	options->zoom_w = ZOOM_1;	options->zoom_h = ZOOM_1;	options->zoomstep = 1;	set_default_out_window(options->output_window);	options->force_overscan_crop = FALSE;	options->overscan_crop = 0;	options->overscan_crop_amount = 5;  // 2.5% on each edge. ITU Bt.1379.1 specifies 3.5% "safe action" and 5% "safe title"	options->arg_vbi = 0;	options->parse_anc = FALSE;	options->print_anc = FALSE;	options->dump_vbi = FALSE;	options->enable_i2c_cc = FALSE;	options->enable_i2c_wss = FALSE;	options->i2c_cc.Enable = FALSE;	options->ccfifo_print = FALSE;	options->use_soft_cc_decoder = 0;	options->ccfifo_id_in = 0;	options->ccfifo_id_send = 0;	options->ccfifo_id_out = 0;	options->ccfifo_addr_in = 0;	options->ccfifo_addr_out = 0;	options->VBIOffs = 0;	options->pVBIData = NULL;	options->vbidump = NULL;	options->update = FALSE;	options->use_gpio_fid = FALSE;	options->invert_fid = FALSE;	options->last_hotplug = FALSE;	options->pR = NULL;	options->pDmaReceive = NULL;	options->force_active_format = FALSE;	options->active_format = EMhwlibAF_same_as_picture;	options->force_wide_screen = FALSE;	options->wide_screen = FALSE;	options->wss_odd = 0;	options->wss_even = 0;	options->last_hdcp_ok = FALSE;	options->last_power = FALSE;	options->last_sync = FALSE;	options->last_clock = FALSE;	options->last_auth = FALSE;	options->last_crypt = FALSE;	options->break_hdcp = FALSE;	options->cable_eq = 0x0C;	options->new_avi = FALSE;	options->last_scan = EMhwlibScanInfo_NoData;	options->update_videomode = FALSE;	options->follow_vfreq = FALSE;	options->verbouse = FALSE;	options->intr_debug = FALSE;	options->green_bg = FALSE;//	options->hdmi_mode = mode_unknown;	options->upsample_from_422 = FALSE;	options->last_isrc_header = 0;	options->last_isrc2 = FALSE;	RMMemset(options->last_isrc, 0xFF, sizeof(options->last_isrc));	options->audio_state = audio_state_off;	options->restart_audio = FALSE;	options->lpcm_24bit = FALSE;  // 16 bit	options->audio_pll_locked = TRUE;	options->same_ct = 0;		return RM_OK;}static void show_local_options(void){	RMDBGLOG((ENABLE, "%s\n",__func__));		fprintf(stderr, "PLAY_RMCAPTURE OPTIONS\n");	fprintf(stderr, "  -v: verbouse (twice for more verbouse)\n");	fprintf(stderr, "  -m <chip>: number of the mambo chip (default: 0)\n");	fprintf(stderr, "  -window <x> <y> <w> <h>: specify position, width and height of the scaler window\n");	fprintf(stderr, "  -zoom <x> <y> <w> <h>: zoom window into the captured video\n");	fprintf(stderr, "    all zoom values: 0..4095: absolute pixel, 4096..8192: 0%%..100%% relative size\n");	fprintf(stderr, "  -inclip <mode>: set clipping or wide mode of input: (n)ormal, (w)ide, (l)etterbox\n");	fprintf(stderr, "  -vbidump <filename>: dump received VBI data to a binary file\n");	fprintf(stderr, "  -vbiprint: print a hex-dump of the received VBI data block\n");	fprintf(stderr, "  -anc: parse VBI data for ANC header and print any Line21-CC text or TeleText\n");	fprintf(stderr, "  -ancprint: print also the ANC header info and a payload hex dump\n");	fprintf(stderr, "  -i2c <module>: which i2c module to use (0=software, 1=hardware)\n");	fprintf(stderr, "  -I <board> <input>]: select board and input\n");	fprintf(stderr, "    board:\n");	fprintf(stderr, "      [775]  (A/V-Input with saa7119, WM8775), \n");	fprintf(stderr, "      871e1  (A/V-Input for odyssey), \n");	fprintf(stderr, "      760e1  (DTV Ref. EM8620L w/ adv7402, MSP34x5), \n");	fprintf(stderr, "      760e2  (DTV Ref. EM8620L w/ saa7119, WM8775, MSP34x5), \n");	fprintf(stderr, "      844e1  (DTV Ref. EM8624 w/ saa7119, SiI9031, AD9883, WM8775, MSP34x5), \n");	fprintf(stderr, "      904e1  (DTV Ref. SMP8634 w/ saa7119, AD9380, WM8775, MSP34x5), \n");	fprintf(stderr, "      jamo   (KiSS Jamo plasma w/ 2 saa7119, AD9888, MSP34x5)\n");	fprintf(stderr, "  -i2ccc: enable CC passthrough from Philips 7119 via i2c\n");	fprintf(stderr, "  -i2ccc <chip>: enable CC passthrough from capture chip via i2c\n");	fprintf(stderr, "    7119: Philips SAA7119\n");	fprintf(stderr, "  -ccprint: print closed caption data from the CC fifo\n");	fprintf(stderr, "    (passing through the app instead of direct passthrough)\n");	fprintf(stderr, "  -softcc, -softcc608: enable NTSC software CC decoding on top of output picture\n");	fprintf(stderr, "  -softcc708: enable PAL software CC decoding on top of output picture\n");	fprintf(stderr, "  -i2cwss: enable WSS passthrough from Philips 7119 via i2c\n");	fprintf(stderr, "  -update: continuusly check for video mode change and adjust\n");	fprintf(stderr, "  -gpiofid: use input field ID from GPIO pin\n");	fprintf(stderr, "  -fidinv: invert detected field ID\n");	fprintf(stderr, "  -eq <len>: cable length equalisation, 0..15 [12]\n");	fprintf(stderr, "  -fv: follow the vertical frequency of the capture on the output\n");	fprintf(stderr, "  -bg: use a different background color than black\n");	fprintf(stderr, "  -ov <crop>: percentage of frame size to crop around edge for overscanned pictures [5] (applies to VGA, LVDS and digital outputs only)\n");	fprintf(stderr, "  -pcm24: capture PCM audio from I2S with 24 bits (default: 16 bits)\n");}static RMstatus parse_local_cmdline(	int argc, 	char **argv, 	int *index, 	struct local_cmdline *options){	RMstatus err = RM_OK;	int argi = *index;	RMuint32 param;	RMascii *endptr;		if (argv[argi][0] == '-') {		if (RMCompareAscii(&(argv[argi][1]), "zoom")) {			options->zoom_force = TRUE;			SCANPARAM(options->zoom_x, "please specify a x value", 1);			SCANPARAM(options->zoom_y, "please specify a y value", 2);			SCANPARAM(options->zoom_w, "please specify a w value", 3);			SCANPARAM(options->zoom_h, "please specify a h value", 4);		}		else if (RMCompareAscii(&(argv[argi][1]), "inclip")) {			argi++;

⌨️ 快捷键说明

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