X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ffileref.C;h=8d9b1ae9f22154bbf976d6eee1128853409bb723;hp=ade91c481613cbf6f9f698935248ebac22c4eeef;hb=HEAD;hpb=f5725c7e12def18fec49a295dad688652edaa4b3 diff --git a/cinelerra-5.1/cinelerra/fileref.C b/cinelerra-5.1/cinelerra/fileref.C index ade91c48..094c44ec 100644 --- a/cinelerra-5.1/cinelerra/fileref.C +++ b/cinelerra-5.1/cinelerra/fileref.C @@ -22,6 +22,7 @@ #include "asset.h" #include "arender.h" #include "cache.h" +#include "edl.h" #include "filebase.h" #include "file.h" #include "fileref.h" @@ -75,8 +76,27 @@ int FileREF::open_file(int rd, int wr) if( ref ) ref->remove_user(); ref = new EDL; ref->create_objects(); - ref->load_xml(&file_xml, LOAD_ALL); - command = new TransportCommand(); + if( ref->load_xml(&file_xml, LOAD_ALL) ) { + ref->remove_user(); + ref = 0; + eprintf(_("Error loading Reference file:\n%s"), asset->path); + return 1; + } + if( !asset->layers ) asset->layers = ref->get_video_layers(); + asset->video_data = asset->layers > 0 ? 1 : 0; + asset->video_length = asset->video_data ? ref->get_video_frames() : 0; + asset->actual_width = asset->video_data ? ref->get_w() : 0; + asset->actual_height = asset->video_data ? ref->get_h() : 0; + if( !asset->width ) asset->width = asset->actual_width; + if( !asset->height ) asset->height = asset->actual_height; + if( !asset->frame_rate ) asset->frame_rate = ref->get_frame_rate(); + strcpy(asset->vcodec, "REF"); + asset->channels = ref->get_audio_channels(); + asset->audio_data = asset->channels > 0 ? 1 : 0; + asset->sample_rate = ref->get_sample_rate(); + asset->audio_length = asset->audio_data ? ref->get_audio_samples() : 0; + strcpy(asset->acodec, "REF"); + command = new TransportCommand(file->preferences); command->reset(); command->get_edl()->copy_all(ref); command->command = NORMAL_FWD;