X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fexportedl.C;h=d4d670eb624786c5280b201e1873f114187d4544;hp=73e51cf16167bc165afb9e6af5cca1df6dca459c;hb=c0251c4aa0754d808fdf454534b32de8175b6fa0;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/exportedl.C b/cinelerra-5.1/cinelerra/exportedl.C index 73e51cf1..d4d670eb 100644 --- a/cinelerra-5.1/cinelerra/exportedl.C +++ b/cinelerra-5.1/cinelerra/exportedl.C @@ -65,7 +65,7 @@ void ExportEDLAsset::double_to_CMX3600(double seconds, double frame_rate, char * TIME_HMSF, 0, // sample_rate ... unnecessary frame_rate, - 0); // frames per foot + 0); // frames per foot if ((int)(seconds / 3600) <= 9) { str[0]='0'; @@ -92,18 +92,25 @@ int ExportEDLAsset::edit_to_timecodes(Edit *edit, double edit_sourceend; double edit_deststart; double edit_destend; - + double timecode_offset; + + // timecode_offset in seconds + timecode_offset = edit->track->edl->session->timecode_offset; + //printf("tc offset %f, \n", timecode_offset); + + + if(!strcmp(reel_name,"")) strcpy(reel_name, " BL "); - edit_sourcestart = 0; - edit_sourceend = track->from_units(edit->length); - + edit_sourcestart = track->from_units(edit->startsource); + edit_sourceend = track->from_units(edit->length + edit->startsource); + edit_deststart = track->from_units(edit->startproject); edit_destend = track->from_units(edit->startproject + edit->length); double_to_CMX3600(edit_sourcestart, frame_rate, sourceinpoint); double_to_CMX3600(edit_sourceend, frame_rate, sourceoutpoint); - double_to_CMX3600(edit_deststart, frame_rate, destinpoint); - double_to_CMX3600(edit_destend, frame_rate, destoutpoint); + double_to_CMX3600(edit_deststart + timecode_offset, frame_rate, destinpoint); + double_to_CMX3600(edit_destend + timecode_offset, frame_rate, destoutpoint); return 0; } @@ -138,8 +145,32 @@ void ExportEDLAsset::export_it() { // TODO: Find docs about exact header for CMX3600 - fprintf(fh, "TITLE: Cinproj FORMAT: CMX 3600 4-Ch\n"); - + // https://xmil.biz/EDL-X/CMX3600.pdf + double frame_rate = edl->session->frame_rate; + int frame_rate_int = (int)frame_rate; + char proj_title[BCTEXTLEN]; + strcpy(proj_title,basename(mwindow->session->filename)); + fprintf(fh, "TITLE: %s fps: %f\n", proj_title, frame_rate); + switch(frame_rate_int) { + case 24: + case 25: + case 50: + case 60: + case 30: + { + if (frame_rate - frame_rate_int < 0.001) + fprintf(fh, "FCM: NON-DROP FRAME\n"); // fixme: select depending on fps + break; + } + default: + { + if ((frame_rate - frame_rate_int) > 0.001) + fprintf(fh, "FCM: DROP FRAME\n"); + } + } + // newline after FCM + fprintf(fh, "\n"); + int colnum = 1; @@ -147,6 +178,11 @@ void ExportEDLAsset::export_it() edit; edit = edit->next) { + + // max number of entries in cmx3600 + if (colnum > 999) + return; + char reel_name[BCTEXTLEN]; char avselect[5]; char edittype[5] = "C "; @@ -155,6 +191,16 @@ void ExportEDLAsset::export_it() char sourceoutpoint[12]; char destinpoint[12]; char destoutpoint[12]; + + char filename[1024]; + if (edit->asset) + strcpy(filename,basename(edit->asset->path)); + + if(!edit->asset) + strcpy(reel_name,"BL "); + else + strcpy(reel_name,"AX "); + if (track->data_type == TRACK_AUDIO) strcpy(avselect, "A "); else @@ -174,6 +220,8 @@ void ExportEDLAsset::export_it() fprintf(fh, " %s %s", last_sourceout, last_sourceout); fprintf(fh, " %s %s", destinpoint, destinpoint); fprintf(fh,"\n"); + if(edit->asset) + fprintf(fh,"* FROM CLIP NAME: %s\n", filename); } else { colnum --; @@ -183,6 +231,8 @@ void ExportEDLAsset::export_it() fprintf(fh, " %s %s", sourceinpoint, sourceoutpoint); fprintf(fh, " %s %s", destinpoint, destoutpoint); fprintf(fh,"\n"); + if(edit->asset) + fprintf(fh,"* FROM CLIP NAME: %s\n", filename); last_dissolve = 1; } else { @@ -191,12 +241,22 @@ void ExportEDLAsset::export_it() fprintf(fh, " %s %s", sourceinpoint, sourceoutpoint); fprintf(fh, " %s %s", destinpoint, destoutpoint); fprintf(fh,"\n"); + if(edit->asset) + fprintf(fh,"* FROM CLIP NAME: %s\n", filename); last_dissolve = 0; } colnum ++; } + + fprintf(fh, "\n"); + + // file end for final cut pro 1.2.5 ? + fprintf(fh, "\x0D"); + fprintf(fh, "\x0A"); + fprintf(fh, "\x1A"); + fprintf(fh, "\x1A"); } @@ -319,24 +379,15 @@ void ExportEDL::run() } +#define WIDTH xS(410) +#define HEIGHT yS(400) - - - - - - -#define WIDTH 410 -#define HEIGHT 400 - -static const char *default_list_titles[] = -{ +static const char *default_list_titles[] = { N_("No."), N_("Track name") }; -static int default_list_widths[] = -{ +static int default_list_widths[] = { 40, 200 }; @@ -352,7 +403,7 @@ ExportEDLWindow::ExportEDLWindow(MWindow *mwindow, ExportEDL *exportedl, ExportE this->exportasset = exportasset; for( int i=0; i<2; ++i ) { list_titles[i] = _(default_list_titles[i]); - list_widths[i] = default_list_widths[i]; + list_widths[i] = xS(default_list_widths[i]); } } @@ -363,32 +414,33 @@ ExportEDLWindow::~ExportEDLWindow() } - void ExportEDLWindow::create_objects() { + int xs5 = xS(5); + int ys5 = yS(5), ys25 = yS(25); lock_window("ExportEDLWindow::create_objects"); - int x = 5, y = 5; + int x = xs5, y = ys5; add_subwindow(new BC_Title(x, y, _("Select a file to export to:"))); - y += 25; + y += ys25; add_subwindow(path_textbox = new ExportEDLPathText(x, y, this)); - x += 300; + x += xS(300); path_recent = new BC_RecentList("EDLPATH", mwindow->defaults, - path_textbox, 10, x, y, 300, 100); + path_textbox, 10, x, y, xS(300), yS(100)); add_subwindow(path_recent); // FIX path_recent->load_items("EDLPATH"); - x += 24; + x += xS(24); add_subwindow(path_button = new BrowseButton( mwindow->theme, this, path_textbox, x, y - 4, exportasset->path, _("Output to file"), _("Select a file to write to:"), 0)); - y += 34; - x = 5; + y += xS(34); + x = xs5; add_subwindow(new BC_Title(x, y, _("Select track to be exported:"))); - y += 25; + y += ys25; items_tracks[0].remove_all_objects(); @@ -414,7 +466,7 @@ void ExportEDLWindow::create_objects() } - add_subwindow(track_list = new ExportEDLWindowTrackList(this, x, y, 400, 200)); + add_subwindow(track_list = new ExportEDLWindowTrackList(this, x, y, xS(400), yS(200))); y += 5 + track_list->get_h(); add_subwindow(new BC_Title(x, y, _("Currently only CMX 3600 format is supported"))); @@ -428,7 +480,7 @@ void ExportEDLWindow::create_objects() ExportEDLPathText::ExportEDLPathText(int x, int y, ExportEDLWindow *window) - : BC_TextBox(x, y, 300, 1, window->exportasset->path) + : BC_TextBox(x, y, xS(300), 1, window->exportasset->path) { this->window = window; } @@ -461,5 +513,3 @@ int ExportEDLWindowTrackList::handle_event() return 1; } - -