/*
* CINELERRA
* Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
*/
#include "asset.h"
assets = parent_edl->assets;
session = parent_edl->session;
}
-
+
local_session = new LocalSession(this);
labels = new Labels(this, "LABELS");
nested_edls = new NestedEDLs;
{
if(!parent_edl)
session->save_defaults(defaults);
-
+
local_session->save_defaults(defaults);
return 0;
}
return 0;
}
-int EDL::load_xml(FileXML *file,
+int EDL::load_xml(FileXML *file,
uint32_t load_flags)
{
int result = 0;
// Clear objects
folders.remove_all_objects();
- if((load_flags & LOAD_ALL) == LOAD_ALL)
+ if((load_flags & LOAD_ALL) == LOAD_ALL)
{
remove_vwindow_edls();
}
{
do{
result = file->read_tag();
- }while(!result &&
- !file->tag.title_is("XML") &&
+ }while(!result &&
+ !file->tag.title_is("XML") &&
!file->tag.title_is("EDL"));
}
else
if(file->tag.title_is("CLIPBOARD"))
{
- local_session->clipboard_length =
+ local_session->clipboard_length =
file->tag.get_property("LENGTH", (double)0);
}
else
if((load_flags & LOAD_ALL) == LOAD_ALL)
{
-// if(vwindow_edl && !vwindow_edl_shared)
+// if(vwindow_edl && !vwindow_edl_shared)
// vwindow_edl->Garbage::remove_user();
// vwindow_edl_shared = 0;
// vwindow_edl = new_edl;
// It is a "" if complete names should be used.
// Called recursively by copy for clips, thus the string can't be terminated.
// The string is not terminated in this call.
-int EDL::save_xml(FileXML *file,
+int EDL::save_xml(FileXML *file,
const char *output_path,
int is_clip,
int is_vwindow)
{
- copy(0,
- tracks->total_length(),
- 1,
+ copy(0,
+ tracks->total_length(),
+ 1,
is_clip,
is_vwindow,
- file,
+ file,
output_path,
0);
return 0;
remove_vwindow_edls();
-// if(vwindow_edl && !vwindow_edl_shared)
+// if(vwindow_edl && !vwindow_edl_shared)
// vwindow_edl->Garbage::remove_user();
// vwindow_edl = 0;
// vwindow_edl_shared = 0;
}
}
-int EDL::copy_assets(double start,
- double end,
- FileXML *file,
- int all,
+int EDL::copy_assets(double start,
+ double end,
+ FileXML *file,
+ int all,
const char *output_path)
{
ArrayList<Asset*> asset_list;
else
// Copy just the ones being used.
{
- for(current = tracks->first;
- current;
+ for(current = tracks->first;
+ current;
current = NEXT)
{
if(current->record)
{
- current->copy_assets(start,
- end,
+ current->copy_assets(start,
+ end,
&asset_list);
}
}
// Paths relativised here
for(int i = 0; i < asset_list.total; i++)
{
- asset_list.values[i]->write(file,
- 0,
+ asset_list.values[i]->write(file,
+ 0,
output_path);
}
return 0;
}
-int EDL::copy(double start,
- double end,
- int all,
+int EDL::copy(double start,
+ double end,
+ int all,
int is_clip,
int is_vwindow,
- FileXML *file,
+ FileXML *file,
const char *output_path,
int rewind_it)
{
// Don't replicate all assets for every clip.
// The assets for the clips are probably in the mane EDL.
if(!is_clip)
- copy_assets(start,
- end,
- file,
- all,
+ copy_assets(start,
+ end,
+ file,
+ all,
output_path);
// Clips
{
for(int i = 0; i < total_vwindow_edls(); i++)
{
- get_vwindow_edl(i)->save_xml(file,
+ get_vwindow_edl(i)->save_xml(file,
output_path,
0,
1);
}
for(int i = 0; i < clips.total; i++)
- clips.values[i]->save_xml(file,
+ clips.values[i]->save_xml(file,
output_path,
1,
0);
void EDL::synchronize_params(EDL *edl)
{
local_session->synchronize_params(edl->local_session);
- for(Track *this_track = tracks->first, *that_track = edl->tracks->first;
- this_track && that_track;
+ for(Track *this_track = tracks->first, *that_track = edl->tracks->first;
+ this_track && that_track;
this_track = this_track->next,
that_track = that_track->next)
{
}
}
-int EDL::trim_selection(double start,
+int EDL::trim_selection(double start,
double end,
int edit_labels,
int edit_plugins,
if(start != end)
{
// clear the data
- clear(0,
+ clear(0,
start,
edit_labels,
edit_plugins,
edit_autos);
- clear(end - start,
+ clear(end - start,
tracks->total_length(),
edit_labels,
edit_plugins,
int EDL::equivalent(double position1, double position2)
{
double threshold = (double).5 / session->frame_rate;
- if(session->cursor_on_frames)
+ if(session->cursor_on_frames)
threshold = (double).5 / session->frame_rate;
else
threshold = (double)1 / session->sample_rate;
void EDL::set_inpoint(double position)
{
- if(equivalent(local_session->get_inpoint(), position) &&
+ if(equivalent(local_session->get_inpoint(), position) &&
local_session->get_inpoint() >= 0)
{
local_session->unset_inpoint();
else
{
local_session->set_inpoint(align_to_frame(position, 0));
- if(local_session->get_outpoint() <= local_session->get_inpoint())
+ if(local_session->get_outpoint() <= local_session->get_inpoint())
local_session->unset_outpoint();
}
}
void EDL::set_outpoint(double position)
{
- if(equivalent(local_session->get_outpoint(), position) &&
+ if(equivalent(local_session->get_outpoint(), position) &&
local_session->get_outpoint() >= 0)
{
local_session->unset_outpoint();
else
{
local_session->set_outpoint(align_to_frame(position, 0));
- if(local_session->get_inpoint() >= local_session->get_outpoint())
+ if(local_session->get_inpoint() >= local_session->get_outpoint())
local_session->unset_inpoint();
}
}
-int EDL::clear(double start,
- double end,
+int EDL::clear(double start,
+ double end,
int clear_labels,
int clear_plugins,
int edit_autos)
if(start == end)
{
double distance = 0;
- tracks->clear_handle(start,
+ tracks->clear_handle(start,
end,
- distance,
+ distance,
clear_labels,
clear_plugins,
edit_autos);
if(clear_labels && distance > 0)
- labels->paste_silence(start,
+ labels->paste_silence(start,
start + distance);
}
else
{
- tracks->clear(start,
+ tracks->clear(start,
end,
clear_plugins,
edit_autos);
- if(clear_labels)
- labels->clear(start,
- end,
+ if(clear_labels)
+ labels->clear(start,
+ end,
1);
}
return 0;
}
-void EDL::modify_edithandles(double oldposition,
- double newposition,
+void EDL::modify_edithandles(double oldposition,
+ double newposition,
int currentend,
int handle_mode,
int edit_labels,
int edit_plugins,
int edit_autos)
{
- tracks->modify_edithandles(oldposition,
- newposition,
+ tracks->modify_edithandles(oldposition,
+ newposition,
currentend,
handle_mode,
- edit_labels,
+ edit_labels,
edit_plugins,
edit_autos);
- labels->modify_handles(oldposition,
- newposition,
+ labels->modify_handles(oldposition,
+ newposition,
currentend,
handle_mode,
edit_labels);
}
-void EDL::modify_pluginhandles(double oldposition,
- double newposition,
- int currentend,
+void EDL::modify_pluginhandles(double oldposition,
+ double newposition,
+ int currentend,
int handle_mode,
int edit_labels,
int edit_autos,
Edits *trim_edits)
{
- tracks->modify_pluginhandles(oldposition,
- newposition,
- currentend,
+ tracks->modify_pluginhandles(oldposition,
+ newposition,
+ currentend,
handle_mode,
edit_labels,
edit_autos,
optimize();
}
-void EDL::paste_silence(double start,
- double end,
- int edit_labels,
+void EDL::paste_silence(double start,
+ double end,
+ int edit_labels,
int edit_plugins,
int edit_autos)
{
- if(edit_labels)
+ if(edit_labels)
labels->paste_silence(start, end);
- tracks->paste_silence(start,
- end,
+ tracks->paste_silence(start,
+ end,
edit_plugins,
edit_autos);
}
// int EDL::calculate_output_w(int single_channel)
// {
// if(single_channel) return session->output_w;
-//
+//
// int widest = 0;
// for(int i = 0; i < session->video_channels; i++)
// {
// }
// return widest;
// }
-//
+//
// int EDL::calculate_output_h(int single_channel)
// {
// if(single_channel) return session->output_h;
-//
+//
// int tallest = 0;
// for(int i = 0; i < session->video_channels; i++)
// {
if((float)session->output_w / session->output_h > get_aspect_ratio())
{
- h = (float)h *
+ h = (float)h *
(session->output_w / get_aspect_ratio() / session->output_h);
}
else
{
- w = (float)w *
+ w = (float)w *
(h * get_aspect_ratio() / session->output_w);
}
}
fprintf(fp,"EDL\n");
fprintf(fp," clip_title: %s\n"
" parent_edl: %p\n", local_session->clip_title, parent_edl);
- fprintf(fp," selectionstart %f\n selectionend %f\n loop_start %f\n loop_end %f\n",
- local_session->get_selectionstart(1),
+ fprintf(fp," selectionstart %f\n selectionend %f\n loop_start %f\n loop_end %f\n",
+ local_session->get_selectionstart(1),
local_session->get_selectionend(1),
local_session->loop_start,
local_session->loop_end);
" output_w: %d\n"
" output_h: %d\n"
" aspect_w: %f\n"
- " aspect_h %f\n"
- " color_model %d\n",
+ " aspect_h: %f\n"
+ " color_model: %d\n",
session->video_channels,
session->video_tracks,
session->frame_rate,
fprintf(fp," CLIPS\n");
fprintf(fp," total: %d\n", clips.total);
-
+
for(int i = 0; i < clips.total; i++)
{
fprintf(fp,"\n\n");
fprintf(fp," VWINDOW EDLS\n");
fprintf(fp," total: %d\n", total_vwindow_edls());
-
+
for(int i = 0; i < total_vwindow_edls(); i++)
{
fprintf(fp," %s\n", get_vwindow_edl(i)->local_session->clip_title);
}
-
+
fprintf(fp," ASSETS\n");
assets->dump(fp);
}
return new_edl;
}
-void EDL::insert_asset(Asset *asset,
+void EDL::insert_asset(Asset *asset,
EDL *nested_edl,
- double position,
- Track *first_track,
+ double position,
+ Track *first_track,
RecordLabels *labels)
{
// Insert asset into asset table
if(new_asset)
{
// Insert 1 frame for undefined length
- if(new_asset->video_length < 0)
- length = 1.0 / session->frame_rate;
+ if(new_asset->video_length < 0)
+ length = 1.0 / session->frame_rate;
else
if(new_asset->frame_rate > 0)
length = ((double)new_asset->video_length / new_asset->frame_rate);
current && vtrack < layers;
current = NEXT)
{
- if(!current->record ||
+ if(!current->record ||
current->data_type != TRACK_VIDEO)
continue;
- current->insert_asset(new_asset,
+ current->insert_asset(new_asset,
new_nested_edl,
- length,
- position,
+ length,
+ position,
vtrack);
vtrack++;
length = 1.0;
}
else
- length = (double)new_asset->audio_length /
+ length = (double)new_asset->audio_length /
new_asset->sample_rate;
}
current->data_type != TRACK_AUDIO)
continue;
- current->insert_asset(new_asset,
+ current->insert_asset(new_asset,
new_nested_edl,
- length,
- position,
+ length,
+ position,
atrack);
return result;
}
-void EDL::get_shared_plugins(Track *source,
+void EDL::get_shared_plugins(Track *source,
ArrayList<SharedLocation*> *plugin_locations,
int omit_recordable,
int data_type)
{
if(!track->record || !omit_recordable)
{
- if(track != source &&
+ if(track != source &&
track->data_type == data_type)
{
for(int i = 0; i < track->plugin_set.total; i++)
{
Plugin *plugin = track->get_current_plugin(
- local_session->get_selectionstart(1),
- i,
- PLAY_FORWARD,
+ local_session->get_selectionstart(1),
+ i,
+ PLAY_FORWARD,
1,
0);
if(plugin && plugin->plugin_type == PLUGIN_STANDALONE)
}
}
-void EDL::get_shared_tracks(Track *track,
+void EDL::get_shared_tracks(Track *track,
ArrayList<SharedLocation*> *module_locations,
int omit_recordable,
int data_type)
{
if(!omit_recordable || !current->record)
{
- if(current != track &&
+ if(current != track &&
current->data_type == data_type)
{
module_locations->append(new SharedLocation(tracks->number_of(current), 0));
// Round frames
// Always round down negative numbers
// but round up only if requested
- if(round)
+ if(round)
{
temp = Units::round(temp);
}
}
int EDL::get_use_vconsole(VEdit* *playable_edit,
- int64_t position,
+ int64_t position,
int direction,
PlayableTracks *playable_tracks)
{
// Total number of playable tracks is 1
- if(playable_tracks->size() != 1)
+ if(playable_tracks->size() != 1)
{
result = 1;
}
delete playable_tracks;
}
-if(debug) printf("EDL::get_use_vconsole %d playable_tracks->size()=%d\n",
+if(debug) printf("EDL::get_use_vconsole %d playable_tracks->size()=%d\n",
__LINE__,
playable_tracks->size());
if(result) return 1;
// Test mutual conditions between direct copy rendering and this.
- if(!playable_track->direct_copy_possible(position,
+ if(!playable_track->direct_copy_possible(position,
direction,
1))
return 1;
if(debug) printf("EDL::get_use_vconsole %d\n", __LINE__);
- *playable_edit = (VEdit*)playable_track->edits->editof(position,
+ *playable_edit = (VEdit*)playable_track->edits->editof(position,
direction,
0);
// No edit at current location
{
// Test nested EDL
EDL *nested_edl = (*playable_edit)->nested_edl;
- int64_t nested_position = (int64_t)((position -
+ int64_t nested_position = (int64_t)((position -
(*playable_edit)->startproject +
- (*playable_edit)->startsource) *
+ (*playable_edit)->startsource) *
nested_edl->session->frame_rate /
session->frame_rate);
if(session->output_w != nested_edl->session->output_w ||
session->output_h != nested_edl->session->output_h ||
nested_edl->get_use_vconsole(&playable_edit_temp,
- nested_position,
+ nested_position,
direction,
- 0))
+ 0))
return 1;
-
+
return 0;
}
if(vwindow_edls.number_of(edl) >= 0)
{
edl->Garbage::remove_user();
+
vwindow_edls.remove(edl);
}
}