コード例 #1
0
static GstFlowReturn
gst_cacasink_render (GstBaseSink * basesink, GstBuffer * buffer)
{
  GstCACASink *cacasink = GST_CACASINK (basesink);
  GstVideoFrame frame;

  GST_DEBUG ("render");

  if (!gst_video_frame_map (&frame, &cacasink->info, buffer, GST_MAP_READ))
    goto invalid_frame;

  caca_clear ();
  caca_draw_bitmap (0, 0, cacasink->screen_width - 1,
      cacasink->screen_height - 1, cacasink->bitmap,
      GST_VIDEO_FRAME_PLANE_DATA (&frame, 0));
  caca_refresh ();

  gst_video_frame_unmap (&frame);

  return GST_FLOW_OK;

  /* ERRORS */
invalid_frame:
  {
    GST_ERROR_OBJECT (cacasink, "invalid frame received");
    return GST_FLOW_ERROR;
  }
}
コード例 #2
0
ファイル: testcaca.c プロジェクト: jjo/um-posix-dev
int main(void)
{
	int event;
	int ch;
	struct caca_sprite *carita=NULL;

	if (caca_init()) 
		return 1;
	caca_set_feature(CACA_ANTIALIASING_PREFILTER);
	caca_set_delay(40000);
	caca_set_color(CACA_COLOR_YELLOW, CACA_COLOR_RED);
	caca_draw_thin_box(0,0,10,2);
	caca_refresh();
	carita=caca_load_sprite("carita.txt");
	while(1) {
		while((event = caca_get_event(CACA_EVENT_ANY))) {
			caca_set_color(CACA_COLOR_BLACK, CACA_COLOR_WHITE);
			caca_printf(1,1, "%x\n", event);
			if(event & CACA_EVENT_KEY_PRESS)
			{
				ch=event & 0xffff;
				switch(ch)
				{
					case 'q':
					case 'Q':
						goto fin;
					case '0'...'9':  /* extension gcc */
						caca_set_color(caca_rand(2,14), CACA_COLOR_BLACK);
						caca_draw_thin_line(0,3,caca_get_width(),3+(ch-'0')*10);
					default:
						if (carita)
							caca_draw_sprite(caca_rand(4,caca_get_width()), caca_rand(4,caca_get_height()), carita, 0);
				}
			}
			caca_refresh();
		}
	}
コード例 #3
0
ファイル: event.c プロジェクト: jetlive/xynth
void * s_video_caca_event_parse (void *arg)
{
	s_rect_t coor;
	unsigned int event;
	unsigned int event_mask;
	s_video_input_data_t data;
	s_video_caca_data_t *priv = (s_video_caca_data_t *) xynth_server->driver->driver_data;
	
	event_mask = CACA_EVENT_TYPE_ANY;

	while (xynth_server->window->running != 1) {
		usleep(20000);
	}
	
	while ((event = caca_wait_event(event_mask)) >= 0) {
		memset(&data, 0, sizeof(s_video_input_data_t));
		switch (event & CACA_EVENT_TYPE_ANY) {
			case CACA_EVENT_TYPE_KEY_PRESS:
			case CACA_EVENT_TYPE_KEY_RELEASE:
				if (priv->keybd_fd[1] != -1) {
					s_pipe_api_write(priv->keybd_fd[1], &data, sizeof(s_video_input_data_t));
				}
				break;
			case CACA_EVENT_TYPE_MOUSE_PRESS:
			case CACA_EVENT_TYPE_MOUSE_RELEASE:
			case CACA_EVENT_TYPE_MOUSE_MOTION:
				break;
			case CACA_EVENT_TYPE_RESIZE:
				coor.x = 0;
				coor.y = 0;
				coor.w = xynth_server->window->surface->width;
				coor.h = xynth_server->window->surface->height;
				caca_refresh();
				s_server_surface_update(&coor);
				break;
			default:
//				debugf(DSER, "Event received : %d", event.type);
				break;

		}
		event = 0;
	}

end:	return NULL;
}
コード例 #4
0
ファイル: vo_caca.c プロジェクト: BOTCrusher/sagetv
static void flip_page(void)
{

    if (showosdmessage)
    {
	if (time(NULL) >= stoposd)
	{
	    showosdmessage = 0;
	    if (posbar)
		posbar[0] = '\0';
	} else {
	    caca_putstr(osdx, osdy, osdmessagetext);
	    
	    if (posbar)
		caca_putstr(0, posbary, posbar);
	}
    }

    caca_refresh();
}
コード例 #5
0
ファイル: vo_caca.c プロジェクト: BOTCrusher/sagetv
static void check_events (void)
{
    unsigned int cev;

    if ((cev = caca_get_event(CACA_EVENT_ANY)))
    {
	if (cev & CACA_EVENT_RESIZE)
	{
	    caca_refresh();
	    resize();
	} else if (cev & CACA_EVENT_KEY_RELEASE)
	{
	    int key = (cev & 0x00ffffff);
	    enum caca_feature cf;

	    switch (key) {
	    case 'd':
	    case 'D':
	      /* Toggle dithering method */
	      cf = 1 + caca_get_feature(CACA_DITHERING);
	      if (cf > CACA_DITHERING_MAX)
		  cf = CACA_DITHERING_MIN;
	      caca_set_feature(cf);
	      osdmessage(MESSAGE_DURATION, "Using %s", caca_get_feature_name(cf));
	      break;

	    case 'a':
	    case 'A':
	      /* Toggle antialiasing method */
	      cf = 1 + caca_get_feature(CACA_ANTIALIASING);
	      if (cf > CACA_ANTIALIASING_MAX)
		  cf = CACA_ANTIALIASING_MIN;
	      caca_set_feature(cf);
	      osdmessage(MESSAGE_DURATION, "Using %s", caca_get_feature_name(cf));
	      break;

	    case 'b':
	    case 'B':
	      /* Toggle background method */
	      cf = 1 + caca_get_feature(CACA_BACKGROUND);
	      if (cf > CACA_BACKGROUND_MAX)
		  cf = CACA_BACKGROUND_MIN;
	      caca_set_feature(cf);
	      osdmessage(MESSAGE_DURATION, "Using %s", caca_get_feature_name(cf));
	      break;

	    case CACA_KEY_UP:
	      mplayer_put_key(KEY_UP);
	      break;
	    case CACA_KEY_DOWN:
	      mplayer_put_key(KEY_DOWN);
	      break;
	    case CACA_KEY_LEFT:
	      mplayer_put_key(KEY_LEFT);
	      break;
	    case CACA_KEY_RIGHT:
	      mplayer_put_key(KEY_RIGHT);
	      break;
	    case CACA_KEY_ESCAPE:
	      mplayer_put_key(KEY_ESC);
	      break;
	    case CACA_KEY_PAGEUP:
	      mplayer_put_key(KEY_PAGE_UP);
	      break;
	    case CACA_KEY_PAGEDOWN:
	      mplayer_put_key(KEY_PAGE_DOWN);
	      break;
	    case CACA_KEY_RETURN:
	      mplayer_put_key(KEY_ENTER);
	      break;
	    case CACA_KEY_HOME:
	      mplayer_put_key(KEY_HOME);
	      break;
	    case CACA_KEY_END:
	      mplayer_put_key(KEY_END);
	      break;
	    default:
	      if (key <= 255)
		  mplayer_put_key (key);
	      break;
	    }
	}
    }
}