コード例 #1
0
static void oglspectrum_start(void)
{
	if (pthread_mutex_trylock(&scope_mutex) != 0) {
		alsaplayer_error("spectrum already running");
		return;
	}
	start_display();
}
コード例 #2
0
ファイル: opengl_spectrum.c プロジェクト: sedwards/xmms3
static void oglspectrum_init(void)
{
	if (dpy) return;

	oglspectrum_read_config();

	if(!oglspectrum_cfg.tdfx_mode)
		start_display();
}	
コード例 #3
0
ファイル: mailmaint.c プロジェクト: sipb/athena-svn-mirror
static int print_2(int argc, char *argv[], void *callback)
{
  char buf[BUFSIZ];

  found_some = 1;
  sprintf(buf, "%s %s", argv[0], argv[1]);
  start_display(buf);

  return MR_CONT;
}
コード例 #4
0
ファイル: mailmaint.c プロジェクト: sipb/athena-svn-mirror
static int print_1(int argc, char *argv[], void *callback)
{
  char buf[BUFSIZ];

  /* no newline 'cause display_buff adds one */
  sprintf(buf, "%s\n", argv[0]);
  start_display(buf);

  return MR_CONT;
}
コード例 #5
0
ファイル: opengl_spectrum.c プロジェクト: sedwards/xmms3
static void oglspectrum_playback_start(void)
{
	if(oglspectrum_cfg.tdfx_mode)
	{
		if(window)
			stop_display();

		start_display();
	}
}
コード例 #6
0
ファイル: mailmaint.c プロジェクト: sipb/athena-svn-mirror
static int print_all(int argc, char *argv[], void *callback)
{
  char buf[BUFSIZ];

  if (moreflg)
    return 0;
  if (first_time)
    {
      erase_line(DISPROW + 1, STARTCOL);
      show_text(DISPROW + 1, STARTCOL, "All mailing lists:");
      first_time = 0;
    }
  sprintf(buf, "%s\n", argv[0]);
  start_display(buf);

  return MR_CONT;
}
コード例 #7
0
ファイル: 3dsp.c プロジェクト: ghent360/bluez
int main(int argc, char *argv[])
{
	bool display_role = false, glasses_role = false;
	uint16_t index = 0;
	const char *str;
	bool use_raw = false;
	int exit_status;

	for (;;) {
		int opt;

		opt = getopt_long(argc, argv, "DGi:rvh", main_options, NULL);
		if (opt < 0)
			break;

		switch (opt) {
		case 'D':
			display_role = true;
			break;
		case 'G':
			glasses_role = true;
			break;
		case 'i':
			if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3))
				str = optarg + 3;
			else
				str = optarg;
			if (!isdigit(*str)) {
				usage();
				return EXIT_FAILURE;
			}
			index = atoi(str);
			break;
		case 'r':
			use_raw = true;
			break;
		case 'v':
			printf("%s\n", VERSION);
			return EXIT_SUCCESS;
		case 'h':
			usage();
			return EXIT_SUCCESS;
		default:
			return EXIT_FAILURE;
		}
	}

	if (argc - optind > 0) {
		fprintf(stderr, "Invalid command line parameters\n");
		return EXIT_FAILURE;
	}

	if (display_role == glasses_role) {
		fprintf(stderr, "Specify either display or glasses role\n");
		return EXIT_FAILURE;
	}

	mainloop_init();

	printf("3D Synchronization Profile testing ver %s\n", VERSION);

	if (use_raw) {
		hci_dev = bt_hci_new_raw_device(index);
		if (!hci_dev) {
			fprintf(stderr, "Failed to open HCI raw device\n");
			return EXIT_FAILURE;
		}
	} else {
		hci_dev = bt_hci_new_user_channel(index);
		if (!hci_dev) {
			fprintf(stderr, "Failed to open HCI user channel\n");
			return EXIT_FAILURE;
		}

		reset_on_init = true;
		reset_on_shutdown = true;
	}

	if (display_role)
		start_display();
	else if (glasses_role)
		start_glasses();

	exit_status = mainloop_run_with_signal(signal_callback, NULL);

	bt_hci_unref(hci_dev);

	return exit_status;
}
コード例 #8
0
ファイル: fastereo.c プロジェクト: BackupTheBerlios/fastereo
/**
 * Fonction principale
 * @param argc nombre d'arguments
 * @param argv tableau d'arguments
 * @return program exit code
 */
int
main(int argc, char *argv[])
{
    /* debug trace start */
    Edbg(("main(argc=%d, argv=%s)", argc, argv[0]));
    Initdbg((&argc, argv));

    int c;
    char display_opengl = FALSE;
    int ret;
	static struct sigaction act;

    /* on récupère les options */
    while ( (c = getopt(argc, argv, "hga:z:")) >= 0) 
    {
        switch (c) 
        {
            case 'h':
                /* print help */
                print_usage();
                Rdbg(("main return EXIT_SUCCESS"));
                return EXIT_SUCCESS;
            case 'g':
                /* display in OpenGL */
                display_opengl = TRUE;
                break;
            case 'z':
                /* display in OpenGL */
                g_zoomim = strtod(optarg, (char **)NULL);
                break;
            case 'a':
                /* nombre de keyframes dans l'animation OpenGL */
                g_anim_nb_keyframes = strtol(optarg, (char **)NULL, 10);;
                break;
        }
    }

    /* il faut le nom du fichier de commandes dans les arguments */
    if ((argc-optind) != 1)
    {
        print_usage();
        Rdbg(("main return EXIT_FAILURE"));
        return EXIT_FAILURE;
    }

	/* on catche le Ctrl-C */
	act.sa_handler = terminate_program_catch;
	sigfillset(&(act.sa_mask));
	sigaction(SIGINT, &act, NULL);

    /* on charge les commandes */
    ret = execute_commands(argv[optind]);
    if (ret != RETURN_SUCCESS)
    {
        destroy_cameras();
        return EXIT_FAILURE;
    }

    /* on vérifie qu'il y a bien au moins 2 caméras chargées */
    if (g_cameras.nb < 2)
    {
        fprintf(stderr, "Il faut charger au moins 2 caméras!\n");
        destroy_cameras();
        return EXIT_FAILURE;
    }

    /* affichage */
    if (TRUE == display_opengl)
    {
        /* on utilise atexit car glut ne dit pas quand il quitte le programme
         * (ce gros malin...) 
         * cf 3.070 http://users.frii.com/martz/oglfaq/glut.htm
         * update: depuis j'utilise SDL mais je garde quand même atexit... */
        atexit(terminate_program);

        init_display();
        start_display();
        destroy_display();
    }

    /* nettoyage */
    destroy_cameras();

    /* debug trace end */
    Rdbg(("main EXIT_SUCCESS"));
    return EXIT_SUCCESS;
}
コード例 #9
0
static int start_loop(void)
{
	int ret, display_index;
	struct v4l2_buffer buf;
	static int captFrmCnt = 0;
	unsigned char *displaybuffer = NULL;
	int i;
	char *ptrPlanar = NULL;
	void *src, *dest;

	ptrPlanar = (char *)calloc(1, nWidthFinal * nHeightFinal * 2);

	while (!quit) {
		fd_set fds;
		struct timeval tv;
		int r;


		FD_ZERO(&fds);
		FD_SET(fdCapture, &fds);

		/* Timeout */
		tv.tv_sec = 2;
		tv.tv_usec = 0;
		r = select(fdCapture + 1, &fds, NULL, NULL, &tv);
		if (-1 == r) {
			if (EINTR == errno)
				continue;
			printf("StartCameraCapture:select\n");
			return -1;
		}
		if (0 == r)
			continue;

		CLEAR(buf);
		buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		buf.memory = V4L2_MEMORY_MMAP;

		/* determine ready buffer */
		if (-1 == ioctl(fdCapture, VIDIOC_DQBUF, &buf)) {
			if (EAGAIN == errno)
				continue;
			printf("StartCameraCaputre:ioctl:VIDIOC_DQBUF\n");
			return -1;
		}

		if (en_capture_to_file) {
			if (captFrmCnt == num_frame_to_capture) {
				printf("Writing frame %d to file %s, size = %d\n",num_frame_to_capture,
					 FILE_CAPTURE, file_size);
				fwrite(buffers[buf.index].start, 1, file_size, fp_capture);
				printf("Writing file %s complete\n", FILE_CAPTURE);
				fclose(fp_capture);
			}
		}
		if (captFrmCnt <= 1) {
			
			if (!captFrmCnt) {
				printf("5. Test enque first buffer\n");
				ret = start_display(fd_vid1, buf.index, 0);
			}
			else {
				printf("5. Test enque second buffer\n");
				ret = start_display(fd_vid1, buf.index, 1);
			}
			if (ret < 0) {
				printf("\tError: Starting display failed:VID1\n");
				return ret;
			}
			captFrmCnt++;
			continue;
		}
		
		ret = put_display_buffer(fd_vid1, buf.index);
		if (ret < 0) {
			printf("Error in putting the display buffer\n");
			return ret;
		}

		/******************* V4L2 display ********************/
		display_index = get_display_buffer(fd_vid1);
		if (display_index < 0) {
			printf("Error in getting the  display buffer:VID1\n");
			return ret;
		}
		/***************** END V4L2 display ******************/

		
		if (printfn)
			printf("time:%lu    frame:%u\n", (unsigned long)time(NULL),
		       		captFrmCnt++);

		buf.index = display_index;
		/* requeue the buffer */
		if (-1 == ioctl(fdCapture, VIDIOC_QBUF, &buf))
			printf("StartCameraCaputre:ioctl:VIDIOC_QBUF\n");
		if (stress_test) {
			start_loopCnt--;
			if (start_loopCnt == 0) {
				start_loopCnt = 50;
				break;
			}
		}
	}

	return ret;
}