#include "exportedl.h"
#include "tracks.h"
#include "transition.h"
-
+#if defined (__FreeBSD__)
+#include <libgen.h>
+#endif
#include <ctype.h>
#include <string.h>
TIME_HMSF,
0, // sample_rate ... unnecessary
frame_rate,
- 0); // frames per foot
+ 0); // frames per foot
if ((int)(seconds / 3600) <= 9)
{
str[0]='0';
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;
}
{
// 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;
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 ";
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
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 --;
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
{
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");
}
}
+#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
};
{
this->mwindow = mwindow;
this->exportasset = exportasset;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Export to EDL");
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]);
}
}
}
-
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();
}
- 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")));
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;
}
return 1;
}
-
-