proxy images, add beep on proxy auto_load, fix unnest proxy bug, vwin in/out to_clip bug
[goodguy/history.git] / cinelerra-5.1 / cinelerra / proxy.C
index 3acfa42247b0a12118d0d53d065d45dfe8efb10f..fc1380edfc9b32391fcef17707543b427322daea 100644 (file)
@@ -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(); i<length &&
+       for( int64_t i=0; i<video_length &&
             !proxy_render->failed && !proxy_render->is_canceled(); ++i ) {
                if( orig->is_asset ) {
                        src_file->set_video_position(i, 0);