Пример #1
0
void video_manager::end_recording(movie_format format)
{
	if (format == MF_AVI)
	{
		// close the file if it exists
		if (m_avi_file != nullptr)
		{
			avi_close(m_avi_file);
			m_avi_file = nullptr;

			// reset the state
			m_avi_frame = 0;
		}
	}
	else if (format == MF_MNG)
	{
		// close the file if it exists
		if (m_mng_file != nullptr)
		{
			mng_capture_stop(*m_mng_file);
			m_mng_file.reset();

			// reset the state
			m_mng_frame = 0;
		}
	}
}
Пример #2
0
/* Called at avi capture stop       */
static void
aviClose (struct ALL_DATA *all_data)
{
	float tottime = 0;

	struct GLOBAL *global = all_data->global;
	//struct vdIn *videoIn = all_data->videoIn;
	struct VideoFormatData *videoF = all_data->videoF;
	struct paRecordData *pdata = all_data->pdata;

	if (videoF->avi)
	{
		tottime = (float) ((int64_t) (global->Vidstoptime - global->Vidstarttime) / 1000000); // convert to miliseconds

		if (global->debug) g_print("stop= %llu start=%llu \n",
			(unsigned long long) global->Vidstoptime, (unsigned long long) global->Vidstarttime);
		if (tottime > 0)
		{
			/*try to find the real frame rate*/
			videoF->avi->fps = (double) (global->framecount * 1000) / tottime;
		}
		else
		{
			/*set the hardware frame rate*/
			videoF->avi->fps = global->fps;
		}

		if (global->debug) g_print("VIDEO: %d frames in %f ms = %f fps\n",global->framecount,tottime,videoF->avi->fps);
		/*------------------- close audio stream and clean up -------------------*/
		if (global->Sound_enable > 0)
		{
			if (close_sound (pdata)) g_printerr("Sound Close error\n");
		}
		avi_close(videoF->avi);

		global->framecount = 0;
		global->Vidstarttime = 0;
		if (global->debug) g_print ("close avi\n");
	}

	avi_destroy_context(videoF->avi);
	pdata = NULL;
	global = NULL;
	//videoIn = NULL;
	videoF->avi = NULL;
}
Пример #3
0
/*
 * close the file muxer
 * args:
 *   encoder_ctx - pointer to encoder context
 *
 * asserts:
 *   none
 *
 * returns: none
 */
void encoder_muxer_close(encoder_context_t *encoder_ctx)
{
	switch (encoder_ctx->muxer_id)
	{
		case ENCODER_MUX_AVI:
			if (avi_ctx)
			{
				/*last frame pts*/
				float tottime = (float) ((int64_t) (encoder_ctx->enc_video_ctx->pts) / 1000000); // convert to miliseconds

				if (verbosity > 0)
					printf("ENCODER: (avi) time = %f\n", tottime);

				if (tottime > 0)
				{
					/*try to find the real frame rate*/
					avi_ctx->fps = (double) (encoder_ctx->enc_video_ctx->framecount * 1000) / tottime;
				}

				if (verbosity > 0)
					printf("ENCODER: (avi) %"PRId64" frames in %f ms [ %f fps]\n",
						encoder_ctx->enc_video_ctx->framecount, tottime, avi_ctx->fps);

				//close sound ??

				avi_close(avi_ctx);

				avi_destroy_context(avi_ctx);
				avi_ctx = NULL;
			}
			break;

		default:
		case ENCODER_MUX_MKV:
		case ENCODER_MUX_WEBM:
			if(mkv_ctx != NULL)
			{
				mkv_close(mkv_ctx);

				mkv_destroy_context(mkv_ctx);
				mkv_ctx = NULL;
			}
			break;
	}
}
Пример #4
0
void video_manager::end_recording()
{
	// close the file if it exists
	if (m_avifile != NULL)
	{
		avi_close(m_avifile);
		m_avifile = NULL;
	}

	// close the file if it exists
	if (m_mngfile != NULL)
	{
		mng_capture_stop(*m_mngfile);
		auto_free(machine(), m_mngfile);
		m_mngfile = NULL;
	}

	// reset the state
	m_movie_frame = 0;
}
Пример #5
0
static void close_avi(void *file)
{
	avi_file *avifile = reinterpret_cast<avi_file *>(file);
	avi_close(avifile);
}
Пример #6
0
static void close_avi(void *file)
{
	avi_close((avi_file *)file);
}