Example #1
0
static void
capture_avi (GtkButton * CapAVIButt, GtkWidget * AVIFNameEntry)
{
	char *filename = gtk_entry_get_text(GTK_ENTRY(AVIFNameEntry));
	char *compression="YUY2";

	switch (AVIFormat) {
	 case 1:
		compression="YUY2";
		break;
	 case 2:
		compression="DIB ";
		break;
	 default:
		compression="YUY2";
	}	
	if(videoIn->capAVI) {
	 printf("stoping AVI capture\n");
	 gtk_button_set_label(CapAVIButt,"Capture");
	 AVIstoptime = ms_time();
	 printf("AVI stop time:%d\n",AVIstoptime);	
	 videoIn->capAVI = FALSE;
	 aviClose();		
	} 
	else {
	 if (!(videoIn->signalquit)) {
		/*thread exited while in AVI capture mode*/
        /* we have to close AVI                  */
     printf("close AVI since thread as exited\n");
	 gtk_button_set_label(CapAVIButt,"Capture");
	 printf("AVI stop time:%d\n",AVIstoptime);	
	 aviClose(); 		 
	 } 
	 else {
	   /* thread is running so start AVI capture*/	 
	   printf("starting AVI capture to %s\n",filename);
	   gtk_button_set_label(CapAVIButt,"Stop");  
	   AviOut = AVI_open_output_file(filename);
	   /*4CC compression "YUY2" (YUV) or "DIB " (RGB24)  or  whathever*/	
	   
	   AVI_set_video(AviOut, videoIn->width, videoIn->height, videoIn->fps,compression);		
	 
	   videoIn->AVIFName = filename;
	   AVIstarttime = ms_time();
       printf("AVI start time:%d\n",AVIstarttime);		
	   videoIn->capAVI = TRUE;
	 }
	}	
}
Example #2
0
void aviStopRender()
{
    if (!rendering) {
        return;
    }
    rendering = 0;

    aviClose();

    // Restore sound driver
    soundDriverConfig(hwnd, properties->sound.driver);
    emulatorRestartSound();

    // Restore sync method
    properties->emulation.syncMethod = syncMethod;
    switch(properties->emulation.syncMethod) {
    case P_EMU_SYNCNONE:
        frameBufferSetFrameCount(1);
        break;
    case P_EMU_SYNCTOVBLANK:
    case P_EMU_SYNCTOVBLANKASYNC:
        frameBufferSetFrameCount(4);
        break;
    default:
        frameBufferSetFrameCount(3);
    }

    // Restore emu speed
    mixerSetBoardFrequencyFixed(0);
    actionEmuSpeedSet(emuSpeed);

    // Remove board timer
    boardSetPeriodicCallback(NULL, NULL, 0);
}
Example #3
0
static void closeVideoFile(struct ALL_DATA *all_data)
{
	struct GLOBAL *global = all_data->global;
	struct vdIn *videoIn = all_data->videoIn;
	struct paRecordData *pdata = all_data->pdata;
	
	int i=0;
	/*we are streaming so we need to lock a mutex*/
	gboolean capVid = FALSE;
	__LOCK_MUTEX(__VMUTEX);
		videoIn->capVid = capVid; /*flag video thread to stop recording frames*/
	__UNLOCK_MUTEX(__VMUTEX);
	__LOCK_MUTEX(__AMUTEX);
		pdata->capVid = capVid;
	__UNLOCK_MUTEX(__AMUTEX);
	/*wait for flag from video thread that recording has stopped    */
	/*wait on videoIn->VidCapStop by sleeping for 200 loops of 10 ms*/
	/*(test VidCapStop == TRUE on every loop)*/
	int stall = wait_ms(&(videoIn->VidCapStop), TRUE, __VMUTEX, 10, 200);
	if( !(stall > 0) )
	{
		g_printerr("video capture stall on exit(%d) - timeout\n",
			videoIn->VidCapStop);
	}
	
	/*free video buffer allocations*/
	__LOCK_MUTEX(__GMUTEX);
		//reset the indexes
		global->r_ind=0;
		global->w_ind=0;
		if (global->videoBuff != NULL)
		{
			/*free video frames to videoBuff*/
			for(i=0;i<global->video_buff_size;i++)
			{
				g_free(global->videoBuff[i].frame);
				global->videoBuff[i].frame = NULL;
			}
			g_free(global->videoBuff);
			global->videoBuff = NULL;
		}
	__UNLOCK_MUTEX(__GMUTEX);
	
	switch (global->VidFormat)
	{
		case AVI_FORMAT:
			aviClose(all_data);
			break;
			
		case MKV_FORMAT:
			if(clean_FormatContext ((void*) all_data))
				g_printerr("matroska close returned a error\n");
			break;
			
		default:
			
			break;
	}
	
	global->Vidstoptime = 0;
	global->Vidstarttime = 0;
	global->framecount = 0;
}
Example #4
0
void R_MME_Shutdown(void) {
	aviClose( &shotData.main.avi );
	aviClose( &shotData.depth.avi );
	aviClose( &shotData.stencil.avi );
}