예제 #1
0
int quicktime_set_video(quicktime_t *file, 
						int tracks, 
						int frame_w, 
						int frame_h,
						double frame_rate,
						char *compressor)
{
	int i;
	quicktime_trak_t *trak;

	if(tracks)
	{
		quicktime_mhvd_init_video(file, &(file->moov.mvhd), frame_rate);
		file->total_vtracks = tracks;
		file->vtracks = (quicktime_video_map_t*)calloc(1, sizeof(quicktime_video_map_t) * file->total_vtracks);
		for(i = 0; i < tracks; i++)
		{
			trak = quicktime_add_track(file);
			quicktime_trak_init_video(file, trak, frame_w, frame_h, frame_rate, compressor);
			quicktime_init_video_map(&(file->vtracks[i]), trak);
		}
	}

	return 0;
}
예제 #2
0
int quicktime_set_video(quicktime_t *file, 
						int tracks, 
						int frame_w, 
						int frame_h,
						float frame_rate,
						int time_scale,
						char *compressor)
{
	int i, j;
	quicktime_trak_t *trak;

	/* delete any existing tracks */
	for(i = 0; i < file->total_vtracks; i++) {
		for (j = 0; j < file->vtracks[i].totalHintTracks; j++) {
			quicktime_delete_trak(&(file->moov), 
				file->vtracks[i].hintTracks[j]);
			file->vtracks[i].hintTracks[j] = NULL;
			file->total_hint_tracks--;
		}
		quicktime_delete_video_map(&(file->vtracks[i]));
		quicktime_delete_trak(&(file->moov), file->vtracks[i].track);
	}
	free(file->vtracks);
	file->vtracks = NULL;	
	file->total_vtracks = 0;

	if (tracks > 0) {
		file->total_vtracks = tracks;
		file->vtracks = (quicktime_video_map_t*)calloc(1, sizeof(quicktime_video_map_t) * file->total_vtracks);
		for(i = 0; i < tracks; i++)
		{
			trak = quicktime_add_track(&(file->moov));
			quicktime_trak_init_video(file, trak, frame_w, frame_h, frame_rate,
				time_scale, compressor);
			quicktime_init_video_map(&(file->vtracks[i]), trak);
		}
	}
	return 0;
}