From 08284a3a20b2cc8606dd90c3c147e2c31d301a61 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 10 Jul 2018 18:49:04 -0600 Subject: [PATCH] proxy images, add beep on proxy auto_load, fix unnest proxy bug, vwin in/out to_clip bug --- cinelerra-5.1/cinelerra/clippopup.C | 4 +++- cinelerra-5.1/cinelerra/mwindow.C | 5 ++++- cinelerra-5.1/cinelerra/mwindowedit.C | 14 ++++++++------ cinelerra-5.1/cinelerra/proxy.C | 23 +++++++++++++++++------ 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/cinelerra-5.1/cinelerra/clippopup.C b/cinelerra-5.1/cinelerra/clippopup.C index ad1bdbcc..df439311 100644 --- a/cinelerra-5.1/cinelerra/clippopup.C +++ b/cinelerra-5.1/cinelerra/clippopup.C @@ -492,7 +492,9 @@ int ClipPopupUnNest::handle_event() nested_edl = edit && !edit->next && !edit->asset ? edit->nested_edl : 0; while( nested_edl && (track=track->next)!=0 ) { Edit *edit = track->edits->first; - if( !edit || edit->next || edit->nested_edl != nested_edl ) + if( !edit || edit->next || + ( edit->nested_edl != nested_edl && + strcmp(edit->nested_edl->path, nested_edl->path) ) ) nested_edl = 0; } if( nested_edl ) { diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 565f3328..2e590c66 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -2256,6 +2256,7 @@ int MWindow::render_proxy(ArrayList &new_idxbls) int MWindow::enable_proxy() { + int ret = 0; if( edl->session->proxy_scale == 1 && edl->session->proxy_disabled_scale != 1 ) { int new_scale = edl->session->proxy_disabled_scale; @@ -2263,8 +2264,10 @@ int MWindow::enable_proxy() Asset *asset = new Asset; asset->format = FILE_FFMPEG; asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0); - to_proxy(asset, new_scale); + ret = to_proxy(asset, new_scale); asset->remove_user(); + if( ret > 0 ) + beep(2000., 1.5, 0.5); } return 1; } diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index e5d90c6b..4e5ec288 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -2091,14 +2091,16 @@ void MWindow::save_clip(EDL *new_edl, const char *txt) void MWindow::to_clip(EDL *edl, const char *txt, int all) { FileXML file; - double start, end; + LocalSession *src = edl->local_session; gui->lock_window("MWindow::to_clip 1"); - start = all ? 0 : - edl->local_session->get_selectionstart(); - end = all ? edl->tracks->total_length() : - edl->local_session->get_selectionend(); - + double start = all ? 0 : + src->inpoint_valid() ? src->get_inpoint() : + src->outpoint_valid() ? 0 : src->get_selectionstart(); + double end = all ? edl->tracks->total_length() : + src->outpoint_valid() ? src->get_outpoint() : + src->inpoint_valid() ? edl->tracks->total_length() : + src->get_selectionend(); if( EQUIV(end, start) ) { start = 0; end = edl->tracks->total_length(); diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index 3acfa422..fc1380ed 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -194,9 +194,11 @@ void ProxyRender::to_proxy_path(char *new_path, Indexable *indexable, int scale) sfx = ep; ep += n; } for( char *cp=prxy; --n>=0; ++cp ) *sfx++ = *cp; - const char *ext = format_asset->format == FILE_FFMPEG ? - format_asset->fformat : File::get_tag(format_asset->format); *ep++ = '.'; + const char *ext = indexable->get_video_frames() < 0 ? "png" : + format_asset->format == FILE_FFMPEG ? + format_asset->fformat : + File::get_tag(format_asset->format); while( *ext ) *ep++ = *ext++; *ep = 0; //printf("ProxyRender::to_proxy_path %d %s %s\n", __LINE__, new_path), asset->path); @@ -242,7 +244,6 @@ ProxyRender::~ProxyRender() Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale) { if( !idxbl->have_video() ) return 0; - if( idxbl->get_video_frames() <= 0 ) return 0; // don't proxy proxies if( strstr(idxbl->path,".proxy") ) return 0; char new_path[BCTEXTLEN]; @@ -259,7 +260,16 @@ Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale) if( !proxy ) { proxy = new Asset(new_path); // new compression parameters - proxy->copy_format(format_asset, 0); + int64_t video_length = idxbl->get_video_frames(); + if( video_length < 0 ) { + proxy->format = FILE_PNG; + proxy->png_use_alpha = 1; + proxy->video_length = 1; + } + else { + proxy->copy_format(format_asset, 0); + proxy->video_length = video_length; + } proxy->awindow_folder = AW_PROXY_FOLDER; proxy->audio_data = 0; proxy->video_data = 1; @@ -271,7 +281,6 @@ Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale) if( proxy->height & 1 ) ++proxy->height; proxy->actual_height = proxy->height; proxy->frame_rate = idxbl->get_frame_rate(); - proxy->video_length = idxbl->get_video_frames(); edl_assets->append(proxy); } proxy->add_user(); @@ -660,8 +669,10 @@ void ProxyClient::process_package(LoadPackage *ptr) VFrame src_frame(src_w,src_h, edl->session->color_model); OverlayFrame scaler(processors); + int64_t video_length = orig->get_video_frames(); + if( video_length < 0 ) video_length = 1; - for( int64_t i=0, length=orig->get_video_frames(); ifailed && !proxy_render->is_canceled(); ++i ) { if( orig->is_asset ) { src_file->set_video_position(i, 0); -- 2.26.2