Esempio n. 1
0
static v4l2_std_id parse_pal(const char *pal)
{
	if (pal[0] == '-') {
		switch (tolower(pal[1])) {
			case '6':
				return V4L2_STD_PAL_60;
			case 'b':
			case 'g':
				return V4L2_STD_PAL_BG;
			case 'h':
				return V4L2_STD_PAL_H;
			case 'n':
				if (tolower(pal[2]) == 'c')
					return V4L2_STD_PAL_Nc;
				return V4L2_STD_PAL_N;
			case 'i':
				return V4L2_STD_PAL_I;
			case 'd':
			case 'k':
				return V4L2_STD_PAL_DK;
			case 'm':
				return V4L2_STD_PAL_M;
		}
	}
	fprintf(stderr, "pal specifier not recognised\n");
	stds_usage();
	exit(1);
}
Esempio n. 2
0
static void usage_all(void)
{
       common_usage();
       tuner_usage();
       io_usage();
       stds_usage();
       vidcap_usage();
       vidout_usage();
       overlay_usage();
       vbi_usage();
       sdr_usage();
       selection_usage();
       misc_usage();
       streaming_usage();
       edid_usage();
}
Esempio n. 3
0
static v4l2_std_id parse_ntsc(const char *ntsc)
{
	if (ntsc[0] == '-') {
		switch (tolower(ntsc[1])) {
			case 'm':
				return V4L2_STD_NTSC_M;
			case 'j':
				return V4L2_STD_NTSC_M_JP;
			case 'k':
				return V4L2_STD_NTSC_M_KR;
		}
	}
	fprintf(stderr, "ntsc specifier not recognised\n");
	stds_usage();
	exit(1);
}
Esempio n. 4
0
static v4l2_std_id parse_secam(const char *secam)
{
	if (secam[0] == '-') {
		switch (tolower(secam[1])) {
			case 'b':
			case 'g':
			case 'h':
				return V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H;
			case 'd':
			case 'k':
				return V4L2_STD_SECAM_DK;
			case 'l':
				if (tolower(secam[2]) == 'c')
					return V4L2_STD_SECAM_LC;
				return V4L2_STD_SECAM_L;
		}
	}
	fprintf(stderr, "secam specifier not recognised\n");
	stds_usage();
	exit(1);
}
Esempio n. 5
0
void stds_cmd(int ch, char *optarg)
{
	switch (ch) {
	case OptSetStandard:
		if (!strncasecmp(optarg, "pal", 3)) {
			if (optarg[3])
				standard = parse_pal(optarg + 3);
			else
				standard = V4L2_STD_PAL;
		}
		else if (!strncasecmp(optarg, "ntsc", 4)) {
			if (optarg[4])
				standard = parse_ntsc(optarg + 4);
			else
				standard = V4L2_STD_NTSC;
		}
		else if (!strncasecmp(optarg, "secam", 5)) {
			if (optarg[5])
				standard = parse_secam(optarg + 5);
			else
				standard = V4L2_STD_SECAM;
		}
		else if (isdigit(optarg[0])) {
			standard = strtol(optarg, 0L, 0) | (1ULL << 63);
		} else {
			fprintf(stderr, "Unknown standard '%s'\n", optarg);
			stds_usage();
			exit(1);
		}
		break;
	case OptSetDvBtTimings:
		parse_dv_bt_timings(optarg, &dv_timings,
				query_and_set_dv_timings, enum_and_set_dv_timings);
		break;
	}
}
Esempio n. 6
0
static void parse_dv_bt_timings(char *optarg, struct v4l2_dv_timings *dv_timings,
		bool &query, int &enumerate)
{
	char *value;
	char *subs = optarg;
	struct v4l2_bt_timings *bt = &dv_timings->bt;

	dv_timings->type = V4L2_DV_BT_656_1120;

	if (!strcmp(subs, "query")) {
		query = true;
		return;
	}

	while (*subs != '\0') {
		static const char *const subopts[] = {
			"width",
			"height",
			"interlaced",
			"polarities",
			"pixelclock",
			"hfp",
			"hs",
			"hbp",
			"vfp",
			"vs",
			"vbp",
			"il_vfp",
			"il_vs",
			"il_vbp",
			"index",
			NULL
		};

		switch (parse_subopt(&subs, subopts, &value)) {
		case 0:
			bt->width = atoi(value);
			break;
		case 1:
			bt->height = strtol(value, 0L, 0);
			break;
		case 2:
			bt->interlaced = strtol(value, 0L, 0);
			break;
		case 3:
			bt->polarities = strtol(value, 0L, 0);
			break;
		case 4:
			bt->pixelclock = strtol(value, 0L, 0);
			break;
		case 5:
			bt->hfrontporch = strtol(value, 0L, 0);
			break;
		case 6:
			bt->hsync = strtol(value, 0L, 0);
			break;
		case 7:
			bt->hbackporch = strtol(value, 0L, 0);
			break;
		case 8:
			bt->vfrontporch = strtol(value, 0L, 0);
			break;
		case 9:
			bt->vsync = strtol(value, 0L, 0);
			break;
		case 10:
			bt->vbackporch = strtol(value, 0L, 0);
			break;
		case 11:
			bt->il_vfrontporch = strtol(value, 0L, 0);
			break;
		case 12:
			bt->il_vsync = strtol(value, 0L, 0);
			break;
		case 13:
			bt->il_vbackporch = strtol(value, 0L, 0);
			break;
		case 14:
			enumerate = strtol(value, 0L, 0);
			break;
		default:
			stds_usage();
			exit(1);
		}
	}
}