-#if 0
-static int process_cmdline(int argc, char *argv[])
-{
- char c;
- const struct option long_opts[] = {
- {"help", no_argument, NULL, 0 },
- {"bitrate", required_argument, NULL, 1 },
- {"minqp", required_argument, NULL, 2 },
- {"initialqp", required_argument, NULL, 3 },
- {"intra_period", required_argument, NULL, 4 },
- {"idr_period", required_argument, NULL, 5 },
- {"ip_period", required_argument, NULL, 6 },
- {"rcmode", required_argument, NULL, 7 },
- {"srcyuv", required_argument, NULL, 9 },
- {"recyuv", required_argument, NULL, 10 },
- {"fourcc", required_argument, NULL, 11 },
- {"syncmode", no_argument, NULL, 12 },
- {"enablePSNR", no_argument, NULL, 13 },
- {"prit", required_argument, NULL, 14 },
- {"priv", required_argument, NULL, 15 },
- {"framecount", required_argument, NULL, 16 },
- {"entropy", required_argument, NULL, 17 },
- {"profile", required_argument, NULL, 18 },
- {NULL, no_argument, NULL, 0 }};
- int long_index;
-
- while ((c =getopt_long_only(argc, argv, "w:h:n:f:o:?", long_opts, &long_index)) != EOF) {
- switch (c) {
- case 'w':
- frame_width = atoi(optarg);
- break;
- case 'h':
- frame_height = atoi(optarg);
- break;
- case 'n':
- case 'f':
- frame_rate = atoi(optarg);
- break;
- case 'o':
- coded_fn = strdup(optarg);
- break;
- case 0:
- print_help();
- exit(0);
- case 1:
- frame_bitrate = atoi(optarg);
- break;
- case 2:
- minimal_qp = atoi(optarg);
- break;
- case 3:
- initial_qp = atoi(optarg);
- break;
- case 4:
- intra_period = atoi(optarg);
- break;
- case 5:
- intra_idr_period = atoi(optarg);
- break;
- case 6:
- ip_period = atoi(optarg);
- break;
- case 7:
- rc_mode = string_to_rc(optarg);
- if (rc_mode < 0) {
- print_help();
- exit(1);
- }
- break;
- case 9:
- srcyuv_fn = strdup(optarg);
- break;
- case 11:
- srcyuv_fourcc = string_to_fourcc(optarg);
- if (srcyuv_fourcc <= 0) {
- print_help();
- exit(1);
- }
- break;
- case 13:
- calc_psnr = 1;
- break;
- case 14:
- misc_priv_type = strtol(optarg, NULL, 0);
- break;
- case 15:
- misc_priv_value = strtol(optarg, NULL, 0);
- break;
- case 17:
- h264_entropy_mode = atoi(optarg) ? 1: 0;
- break;
- case 18:
- if (strncmp(optarg, "BP", 2) == 0)
- h264_profile = VAProfileH264Baseline;
- else if (strncmp(optarg, "MP", 2) == 0)
- h264_profile = VAProfileH264Main;
- else if (strncmp(optarg, "HP", 2) == 0)
- h264_profile = VAProfileH264High;
- else
- h264_profile = (VAProfile)0;
- break;
- case ':':
- case '?':
- print_help();
- exit(0);
- }
- }
-
- if (ip_period < 1) {
- printf(" ip_period must be greater than 0\n");
- exit(0);
- }
- if (intra_period != 1 && intra_period % ip_period != 0) {
- printf(" intra_period must be a multiplier of ip_period\n");
- exit(0);
- }
- if (intra_period != 0 && intra_idr_period % intra_period != 0) {
- printf(" intra_idr_period must be a multiplier of intra_period\n");
- exit(0);
- }
-
- if (frame_bitrate == 0)
- frame_bitrate = frame_width * frame_height * 12 * frame_rate / 50;
-
- if (coded_fn == NULL) {
- struct stat buf;
- if (stat("/tmp", &buf) == 0)
- coded_fn = strdup("/tmp/test.264");
- else if (stat("/sdcard", &buf) == 0)
- coded_fn = strdup("/sdcard/test.264");
- else
- coded_fn = strdup("./test.264");
- }
-
- /* store coded data into a file */
- coded_fp = fopen(coded_fn, "w+");
- if (coded_fp == NULL) {
- printf("Open file %s failed, exit\n", coded_fn);
- exit(1);
- }
-
- frame_width_mbaligned = (frame_width + 15) & (~15);
- frame_height_mbaligned = (frame_height + 15) & (~15);
- if (frame_width != frame_width_mbaligned ||
- frame_height != frame_height_mbaligned) {
- printf("Source frame is %dx%d and will code clip to %dx%d with crop\n",
- frame_width, frame_height,
- frame_width_mbaligned, frame_height_mbaligned
- );
- }
-
- return 0;
-}
-#endif
-
-static Display *x11_display;
-static Window x11_window;
-
-VADisplay
-va_open_display(void)