X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fproxy.C;h=45feb5951354a36d5e668f73080483ddc6ababba;hp=3acfa42247b0a12118d0d53d065d45dfe8efb10f;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hpb=540f653df26e5e2d1249de1f7a1a3d888dddf341 diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index 3acfa422..45feb595 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -161,6 +161,10 @@ void ProxyDialog::calculate_sizes() void ProxyDialog::handle_close_event(int result) { if( result ) return; + if( !File::renders_video(asset) ) { + eprintf("Specified format does not render video"); + return; + } mwindow->edl->session->proxy_use_scaler = use_scaler; mwindow->edl->session->proxy_auto_scale = auto_scale; mwindow->edl->session->proxy_beep = beep; @@ -194,9 +198,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 +248,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 +264,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_frames = idxbl->get_video_frames(); + if( video_frames < 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_frames; + } proxy->awindow_folder = AW_PROXY_FOLDER; proxy->audio_data = 0; proxy->video_data = 1; @@ -271,10 +285,7 @@ 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(); orig_proxies.append(proxy); idxbl->add_user(); orig_idxbls.append(idxbl); @@ -463,6 +474,7 @@ void ProxyUseScaler::update() int ProxyUseScaler::handle_event() { + pwindow->dialog->new_scale = 1; pwindow->dialog->use_scaler = get_value(); pwindow->scale_factor->update_sizes(); pwindow->update(); @@ -650,6 +662,7 @@ void ProxyClient::process_package(LoadPackage *ptr) result = dst_file.open_file(preferences, proxy, 0, 1); if( result ) { proxy_render->failed = 1; + ::remove(proxy->path); return; } @@ -660,8 +673,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); @@ -697,6 +712,8 @@ void ProxyClient::process_package(LoadPackage *ptr) mwindow->mainindexes->add_next_asset(0, asset); mwindow->mainindexes->start_build(); } + else + ::remove(proxy->path); }