void VideoManager::initialize() { reset(); apeg_ignore_audio(true); frameData = create_bitmap_ex(32, 320, 192); clear_to_color(frameData, 0); videoBuffer = NULL; }
void play_theora_video(const char *name, int skip, int flags) { apeg_set_display_depth(bitmap_color_depth(screen)); // we must disable length detection, otherwise it takes ages to start // playing if the file is large because it seeks through the whole thing apeg_disable_length_detection(TRUE); apeg_enable_framedrop(TRUE); update_polled_stuff(); stretch_flc = (flags % 10); canabort = skip; apeg_ignore_audio((flags >= 10) ? 1 : 0); int videoWidth, videoHeight; APEG_STREAM *oggVid = get_theora_size(name, &videoWidth, &videoHeight); if (videoWidth == 0) { Display("Unable to load theora video '%s'", name); return; } if (flags < 10) { stop_all_sound_and_music(); } fli_target = NULL; //fli_buffer = create_bitmap_ex(final_col_dep, videoWidth, videoHeight); calculate_destination_size_maintain_aspect_ratio(videoWidth, videoHeight, &fliTargetWidth, &fliTargetHeight); if ((fliTargetWidth == videoWidth) && (fliTargetHeight == videoHeight) && (stretch_flc)) { // don't need to stretch after all stretch_flc = 0; } if ((stretch_flc) && (!gfxDriver->HasAcceleratedStretchAndFlip())) { fli_target = create_bitmap_ex(final_col_dep, scrnwid, scrnhit); clear(fli_target); fli_ddb = gfxDriver->CreateDDBFromBitmap(fli_target, false, true); } else { fli_ddb = NULL; } update_polled_stuff(); clear(virtual_screen); if (apeg_play_apeg_stream(oggVid, NULL, 0, theora_playing_callback) == APEG_ERROR) { Display("Error playing theora video '%s'", name); } apeg_close_stream(oggVid); //destroy_bitmap(fli_buffer); if (fli_target != NULL) destroy_bitmap(fli_target); gfxDriver->DestroyDDB(fli_ddb); fli_ddb = NULL; invalidate_screen(); }