actual_width = width = 0;
actual_height = height = 0;
proxy_scale = 0; // not a proxy
+ proxy_edl = 0; // not proxy from edl
video_length = 0;
single_frame = 0;
vmpeg_cmodel = BC_YUV420P;
actual_width = asset->actual_width;
actual_height = asset->actual_height;
proxy_scale = asset->proxy_scale;
+ proxy_edl = asset->proxy_edl;
strcpy(vcodec, asset->vcodec);
strcpy(acodec, asset->acodec);
height = file->tag.get_property("HEIGHT", height);
width = file->tag.get_property("WIDTH", width);
proxy_scale = file->tag.get_property("PROXY_SCALE", 0);
+ proxy_edl = file->tag.get_property("PROXY_EDL", 0);
layers = file->tag.get_property("LAYERS", layers);
program = file->tag.get_property("PROGRAM", program);
// This is loaded from the index file after the EDL but this
file->tag.set_property("HEIGHT", height);
file->tag.set_property("WIDTH", width);
file->tag.set_property("PROXY_SCALE", proxy_scale);
+ file->tag.set_property("PROXY_EDL", proxy_edl);
file->tag.set_property("LAYERS", layers);
file->tag.set_property("PROGRAM", program);
file->tag.set_property("FRAMERATE", frame_rate);
actual_height = GET_DEFAULT("ACTUAL_HEIGHT", actual_height);
actual_width = GET_DEFAULT("ACTUAL_WIDTH", actual_width);
proxy_scale = GET_DEFAULT("PROXY_SCALE", proxy_scale);
+ proxy_edl = GET_DEFAULT("PROXY_SCALE", proxy_edl);
program = GET_DEFAULT("PROGRAM", program);
layers = GET_DEFAULT("LAYERS", layers);
if(EQUIV(frame_rate, 0)) frame_rate = GET_DEFAULT("FRAMERATE", frame_rate);
UPDATE_DEFAULT("ACTUAL_HEIGHT", actual_height);
UPDATE_DEFAULT("ACTUAL_WIDTH", actual_width);
UPDATE_DEFAULT("PROXY_SCALE", proxy_scale);
+ UPDATE_DEFAULT("PROXY_EDL", proxy_edl);
UPDATE_DEFAULT("PROGRAM", program);
UPDATE_DEFAULT("LAYERS", layers);
UPDATE_DEFAULT("FRAMERATE", frame_rate);
" height %d vcodec %s aspect_ratio %f ilace_mode %s\n",
video_data, layers, program, frame_rate, width, height,
vcodec, aspect_ratio,string);
- fprintf(fp," actual_width %d actual_height %d proxy_scale %d"
+ fprintf(fp," actual_width %d actual_height %d proxy_scale %d proxy_edl %d"
" video_length %jd repeat %d\n",
- actual_width, actual_height, proxy_scale, video_length,
+ actual_width, actual_height, proxy_scale, proxy_edl, video_length,
single_frame);
fprintf(fp," video_length %jd repeat %d\n", video_length, single_frame);
fprintf(fp," mov_sphere=%d jpeg_sphere=%d\n", mov_sphere, jpeg_sphere);
int actual_width, actual_height;
int width, height;
-// scale factor or 0 if not proxy
- int proxy_scale;
+// scale factor or 0 if not proxy, proxy_edl if proxyed from nested_edl
+ int proxy_scale, proxy_edl;
// String or FourCC describing compression
char vcodec[BCTEXTLEN];
update_assets();
}
-EDL *AWindowGUI::collect_proxy(Indexable *indexable)
+EDL *AWindowGUI::collect_proxy(Asset *proxy_asset)
{
- Asset *proxy_asset = (Asset *)indexable;
char path[BCTEXTLEN];
int proxy_scale = mwindow->edl->session->proxy_scale;
ProxyRender::from_proxy_path(path, proxy_asset, proxy_scale);
- Asset *unproxy_asset = mwindow->edl->assets->get_asset(path);
- if( !unproxy_asset || !unproxy_asset->layers ) return 0;
+ Indexable *unproxy_idxbl =
+ proxy_asset->proxy_edl ?
+ (Indexable *) mwindow->edl->get_nested_edl(path) :
+ (Indexable *) mwindow->edl->assets->get_asset(path);
+ if( !unproxy_idxbl || !unproxy_idxbl->get_video_layers() ) return 0;
// make a clip from proxy video tracks and unproxy audio tracks
EDL *proxy_edl = new EDL(mwindow->edl);
proxy_edl->create_objects();
strcpy(proxy_edl->local_session->clip_title, path);
strcpy(proxy_edl->local_session->clip_notes, _("Proxy clip"));
proxy_edl->session->video_tracks = proxy_asset->layers;
- proxy_edl->session->audio_tracks = unproxy_asset->channels;
+ proxy_edl->session->audio_tracks = unproxy_idxbl->get_audio_channels();
proxy_edl->create_default_tracks();
double length = proxy_asset->frame_rate > 0 ?
( proxy_asset->video_length >= 0 ?
if( current->data_type != TRACK_VIDEO ) continue;
current->insert_asset(proxy_asset, 0, length, 0, vtrack++);
}
- length = (double)unproxy_asset->audio_length / unproxy_asset->sample_rate;
+ int64_t samples = unproxy_idxbl->get_audio_samples();
+ int sample_rate = unproxy_idxbl->get_sample_rate();
+ length = sample_rate > 0 ? (double)samples / sample_rate : 0;
current = proxy_edl->tracks->first;
for( int atrack=0; current; current=NEXT ) {
if( current->data_type != TRACK_AUDIO ) continue;
- current->insert_asset(unproxy_asset, 0, length, 0, atrack++);
+ Asset *asset = unproxy_idxbl->is_asset ? (Asset *)unproxy_idxbl : 0;
+ EDL *nested_edl = unproxy_idxbl->is_asset ? 0 : (EDL *)unproxy_idxbl;
+ current->insert_asset(asset, nested_edl, length, 0, atrack++);
}
proxy_edl->folder_no = AW_PROXY_FOLDER;
return proxy_edl;
Indexable *indexable = result->indexable;
if( proxy && indexable && indexable->is_asset &&
indexable->folder_no == AW_PROXY_FOLDER ) {
- EDL *drag_edl = collect_proxy(indexable);
+ EDL *drag_edl = collect_proxy((Asset*)indexable);
if( drag_edl ) mwindow->session->drag_clips->append(drag_edl);
continue;
}
break;
}
if( !vwindow || !vwindow->is_running() ) return 1;
- if( proxy && picon_idxbl ) {
- picon_edl = gui->collect_proxy(picon_idxbl);
+ if( proxy && picon_idxbl && picon_idxbl->is_asset ) {
+ picon_edl = gui->collect_proxy((Asset*)picon_idxbl);
picon_idxbl = 0;
}
int drag_stop();
// Collect items into the drag vectors of MainSession
void collect_assets(int proxy=0);
- EDL *collect_proxy(Indexable *indexable);
+ EDL *collect_proxy(Asset *asset);
void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
int do_audio,
int do_video,
}
}
-EDL *EDL::new_nested_edl(EDL *edl, const char *path)
+EDL *EDL::new_nested_clip(EDL *edl, const char *path)
{
EDL *nested = new EDL; // no parent for nested edl
nested->create_objects();
return nested;
}
-EDL *EDL::get_nested_edl()
+EDL *EDL::get_nested_edl(const char *path)
{
- Track *track = tracks->first;
- Edit *edit = track ? track->edits->first : 0;
- EDL *nested = edit && !edit->next && !edit->asset ? edit->nested_edl : 0;
- while( nested && (track=track->next)!=0 ) {
- Edit *edit = track->edits->first;
- if( !edit || edit->next ||
- ( edit->nested_edl != nested &&
- strcmp(edit->nested_edl->path, nested->path) ) )
- nested = 0;
+ for( int i=0; i<nested_edls.size(); ++i ) {
+ EDL *nested_edl = nested_edls[i];
+ if( !strcmp(path, nested_edl->path) )
+ return nested_edl;
}
- return nested;
+ return 0;
}
{
int video_tracks = 0, audio_tracks = 0;
for( Track *track=nested->tracks->first; track!=0; track=track->next ) {
- if( track->data_type == TRACK_VIDEO && track->is_armed() ) ++video_tracks;
- if( track->data_type == TRACK_AUDIO && track->is_armed() ) ++audio_tracks;
+ if( track->data_type == TRACK_VIDEO && track->play ) ++video_tracks;
+ if( track->data_type == TRACK_AUDIO && track->play ) ++audio_tracks;
}
// renderengine properties
if( video_tracks > 0 )
int copy_assets(int copy_flags, double start, double end,
FileXML *file, const char *output_path);
void copy_indexables(EDL *edl);
- EDL *new_nested_edl(EDL *edl, const char *path);
- EDL *get_nested_edl();
+ EDL *new_nested_clip(EDL *edl, const char *path);
+ EDL *get_nested_edl(const char *path);
EDL *create_nested_clip(EDL *nested);
void create_nested(EDL *nested);
void overwrite_clip(EDL *clip);
for( int i=0,n=edl->nested_edls.size(); i<n; ++i ) {
EDL *orig_nested = edl->nested_edls[i];
char new_path[BCTEXTLEN];
- if( !ProxyRender::from_proxy_path(new_path, orig_nested, proxy_scale) )
- continue;
proxy_render.to_proxy_path(new_path, orig_nested, proxy_scale);
// test if proxy asset was already added to proxy_assets
int got_it = 0;
char path[BCTEXTLEN];
if( !edit->asset || edit->track->data_type != TRACK_VIDEO ||
edl->session->proxy_scale == 1 ||
- ProxyRender::from_proxy_path(path, idxbl, edl->session->proxy_scale) )
+ ProxyRender::from_proxy_path(path, (Asset*)idxbl, edl->session->proxy_scale) )
strcpy(path, idxbl->path);
char *cp = strrchr(path, '/');
cp = !cp ? path : cp+1;
char *bp = strrchr(clip->local_session->clip_title, '/');
bp = bp ? bp+1 : clip->local_session->clip_title;
cp += snprintf(cp, ep-cp, "%s", bp);
- EDL *nested = edl->new_nested_edl(clip, path);
+ EDL *nested = edl->new_nested_clip(clip, path);
edl->clips.remove(clip);
clip->remove_user();
mainindexes->add_indexable(nested);
//printf("ProxyRender::to_proxy_path %d %s %s\n", __LINE__, new_path), asset->path);
}
-int ProxyRender::from_proxy_path(char *new_path, Indexable *indexable, int scale)
+int ProxyRender::from_proxy_path(char *new_path, Asset *asset, int scale)
{
char prxy[BCTEXTLEN];
int n = sprintf(prxy, ".proxy%d", scale);
- strcpy(new_path, indexable->path);
+ strcpy(new_path, asset->path);
char *ptr = strstr(new_path, prxy);
if( !ptr || (ptr[n] != '-' && ptr[n] != '.') ) return 1;
// remove proxy, path.proxy#-sfx.ext => path.sfx
char *cp = ptr + n;
for( *cp='.'; cp<ext; ++cp ) *ptr++ = *cp;
*ptr = 0;
+ if( asset->proxy_edl ) {
+ if( (cp = strrchr(new_path, '/')) != 0 ) {
+ for( ptr=new_path; *++cp; ) *ptr++ = *cp;
+ *ptr = 0;
+ }
+ }
return 0;
}
proxy->video_length = video_frames;
}
proxy->folder_no = AW_PROXY_FOLDER;
+ proxy->proxy_edl = !idxbl->is_asset ? 1 : 0;
proxy->audio_data = 0;
proxy->video_data = 1;
proxy->layers = 1;
ProxyRender(MWindow *mwindow, Asset *format_asset, int asset_scale);
~ProxyRender();
void to_proxy_path(char *new_path, Indexable *indexable, int scale);
- static int from_proxy_path(char *new_path, Indexable *indexable, int scale);
+ static int from_proxy_path(char *new_path, Asset *asset, int scale);
ArrayList<Indexable *> orig_idxbls; // originals which match the proxy assets
ArrayList<Indexable *> orig_proxies; // proxy assets