Beispiel #1
0
void gui_unload_preview()
{
    debug_start();

    if( tmp_preview != NULL )
    {
        GLES2D_FreeTexture( tmp_preview );
        tmp_preview = NULL;
    }

    video_quit( );

    if ( applications[category]->type[list_curpos[ category ]] ) // .pnd spotted
    {
        if( pnd_mounted )
        {
            pnd_pnd_unmount( pndrun, applications[category]->fullpath[list_curpos[ category ]], applications[category]->id[list_curpos[ category ]] );
            pnd_mounted = 0;
        }
    }

    preview_timer = 100;

    debug_end();
}
Beispiel #2
0
int
main(int argc, char *argv[])
{
	options_init();
	options_deal(argc, argv);
	video_init();
	screen_init();
	screen_mainloop();
	screen_quit();
	video_quit();
	exit(EXIT_SUCCESS);
}
Beispiel #3
0
void
game_quit ()
{
  if (false == initialized)
    {
      LOG_FATAL ("not initialized");
    }

  mouse_quit ();
  audio_quit ();
  keyboard_quit ();
  video_quit ();
  filepath_quit ();
  conf_quit ();

  initialized = false;
}
Beispiel #4
0
void gui_clean()
{
    debug_start();

    video_quit();

    gui_clean_skin();
    gui_unload_preview();
    pnd_app_clean_list();

    pnd_notify_shutdown ( nh );
	pnd_dbusnotify_shutdown ( nh2 );
    doneStatusCalls();

    GLES2D_Quit();

    debug_end();
}
Beispiel #5
0
MainWindow::~MainWindow()
{
    if (cur != NULL) video_quit(cur);
    delete ui;
}
Beispiel #6
0
/* Init video source 
 * file: path to open
 * width: destination frame width in pixels - use 0 for source
 * height: destination frame height in pixels - use 0 for source
 * format: PIX_FMT_GRAY8 or PIX_FMT_RGB24
 * Returns video context on succes, NULL otherwise
 */
video *video_init(char *file, int width, int height, int format)
{
    int i = 0;
	
    video *ret = (video*)malloc(sizeof(video));
    memset(ret, 0, sizeof(video));
    ret->format = format;
	
    /* Init ffmpeg */
    av_register_all();
	
    /* Open file, check usability */
    if(av_open_input_file(&ret->pFormatCtx, file, NULL, 0, NULL) ||
       av_find_stream_info(ret->pFormatCtx) < 0)
	return video_quit(ret);
	
    /* Find the first video stream */
    ret->videoStream = -1;
    for(i = 0; i < ret->pFormatCtx->nb_streams; i++)
	if(ret->pFormatCtx->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
	    ret->videoStream = i;
	    break;
	}
	
    if(ret->videoStream == -1)
	return video_quit(ret);
	
    /* Get context for codec, pin down target width/height, find codec */
    ret->pCtx = ret->pFormatCtx->streams[ret->videoStream]->codec;
    ret->width = width? width: ret->pCtx->width;
    ret->height = height? height: ret->pCtx->height;
    ret->pCodec = avcodec_find_decoder(ret->pCtx->codec_id);
	
    if(!ret->pCodec ||
       avcodec_open(ret->pCtx, ret->pCodec) < 0)
	return video_quit(ret);
	
    /* Frame rate fix for some codecs */
    if(ret->pCtx->time_base.num > 1000 && ret->pCtx->time_base.den == 1)
	ret->pCtx->time_base.den = 1000;
	
    /* Get framebuffers */
    ret->pRaw = avcodec_alloc_frame();
    ret->pDat = avcodec_alloc_frame();
	
    if(!ret->pRaw || !ret->pDat)
	return video_quit(ret);
	
    /* Create data buffer */
    ret->buffer = (uint8_t*)malloc(avpicture_get_size(ret->format, 
					    ret->pCtx->width, ret->pCtx->height));
	
    /* Init buffers */
    avpicture_fill((AVPicture *) ret->pDat, ret->buffer, ret->format, 
		   ret->pCtx->width, ret->pCtx->height);
	
    /* Init scale & convert */
    ret->Sctx = sws_getContext(ret->pCtx->width, ret->pCtx->height, ret->pCtx->pix_fmt,
			       ret->width, ret->height, (PixelFormat)ret->format, SWS_BICUBIC, NULL, NULL, NULL);
	
    if(!ret->Sctx)
	return video_quit(ret);
	
    /* Give some info on stderr about the file & stream */
    //dump_format(ret->pFormatCtx, 0, file, 0);
	
    return ret;
}