png img proxy fixes, speed zoom segv fix, colapse ins 1frm silence undo, repair rende...
authorGood Guy <good1.2guy@gmail.com>
Thu, 12 Jul 2018 20:33:53 +0000 (14:33 -0600)
committerGood Guy <good1.2guy@gmail.com>
Thu, 12 Jul 2018 20:33:53 +0000 (14:33 -0600)
cinelerra-5.1/cinelerra/assetedit.C
cinelerra-5.1/cinelerra/file.C
cinelerra-5.1/cinelerra/file.h
cinelerra-5.1/cinelerra/filelist.C
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/proxy.C
cinelerra-5.1/cinelerra/renderengine.C
cinelerra-5.1/cinelerra/renderengine.h
cinelerra-5.1/guicast/condition.h
cinelerra-5.1/guicast/mutex.C
cinelerra-5.1/guicast/mutex.h

index 0a417e4bf7175775ec737b7a79e5e3c28445c700..301cf482d94b0e2450acaa9ab6d87ed103340722 100644 (file)
@@ -193,8 +193,8 @@ int AssetEdit::window_height()
                h += 210;
                if( indexable->is_asset ) {
                        Asset *asset = (Asset *)indexable;
-                       if( asset->format == FILE_MPEG ||
-                           asset->format == FILE_FFMPEG ) h += 42;
+                       if( File::can_scale_input(asset) )
+                               h += 42;
                }
        }
        return h;
@@ -498,7 +498,7 @@ void AssetEditWindow::create_objects()
                add_subwindow(win_height);
                y += win_height->get_h() + 5;
 
-               if( asset && (asset->format == FILE_MPEG || asset->format == FILE_FFMPEG )  ) {
+               if( asset && File::can_scale_input(asset) ) {
                        y += 5;
                        x = x1;
                        add_subwindow(new BC_Title(x, y, _("Actual width:")));
index 03348e0a6422f3316a26dc008757157f8ba546f8..13e1b457463a2876c411725d4c6ad2ff700c9336 100644 (file)
@@ -266,13 +266,23 @@ int File::get_options(FormatTools *format,
        return 0;
 }
 
-
-
-
-
-
-
-
+int File::can_scale_input(Asset *asset)
+{
+       switch( asset->format ) {
+       case FILE_MPEG:
+       case FILE_FFMPEG:
+               return 1;
+       case FILE_EXR:
+       case FILE_JPEG:
+       case FILE_PNG:
+       case FILE_PPM:
+       case FILE_TGA:
+       case FILE_TIFF:
+               if( asset->video_length < 0 )
+                       return 1;
+       }
+       return 0;
+}
 
 
 int File::set_processors(int cpus)   // Set the number of cpus for certain codecs
index bb1a80ef9ab0f72c2f76dbc2416aae8a741c1290..2ca1acbe921a62482d4595f3e86519d3189b66ef 100644 (file)
@@ -232,6 +232,8 @@ public:
 // Get best colormodel for hardware accelerated recording.
 // Called by VideoDevice.
        static int get_best_colormodel(Asset *asset, int driver);
+// asset scaling on read_frame
+       static int can_scale_input(Asset *asset);
 // Get nearest colormodel that can be decoded without a temporary frame.
 // Used by read_frame.
        int colormodel_supported(int colormodel);
index b98864f98fcb1ca2ce2561f33a9ce31e1982b23f..dd78cf5726deeeb9924fb46b968bee5a70f40878 100644 (file)
@@ -132,9 +132,15 @@ int FileList::open_file(int rd, int wr)
 //printf("FileList::open_file 2\n", asset->use_header);
 //printf("FileList::open_file %d\n", __LINE__);
                                        asset->format = frame_type;
+                                       int width = asset->width;
+                                       int height = asset->height;
                                        result = read_frame_header(asset->path);
+                                       asset->actual_width = asset->width;
+                                       if( width ) asset->width = width;
+                                       asset->actual_height = asset->height;
+                                       if( height ) asset->height = height;
                                        asset->layers = 1;
-                                       if(!asset->frame_rate)
+                                       if( !asset->frame_rate )
                                                asset->frame_rate = 1;
                                        asset->video_length = -1;
                                }
@@ -371,7 +377,7 @@ int FileList::read_frame(VFrame *frame)
                                                        data->allocate_compressed_data(ostat.st_size);
                                                        data->set_compressed_size(ostat.st_size);
                                                        (void)fread(data->get_data(), ostat.st_size, 1, fd);
-                                                       temp = new VFrame(asset->width, asset->height,
+                                                       temp = new VFrame(asset->actual_width, asset->actual_height,
                                                                        frame->get_color_model(), 0);
                                                        read_frame(temp, data);
                                                        break;
@@ -387,7 +393,8 @@ int FileList::read_frame(VFrame *frame)
                        }
                        else
                        {
-                               temp = new VFrame(asset->width, asset->height, frame->get_color_model(), 0);
+                               temp = new VFrame(asset->actual_width, asset->actual_height,
+                                       frame->get_color_model(), 0);
                                read_frame(temp, asset->path);
                        }
                }
index 4e5ec2886b7a617577c261a83f9c9350672746b6..53cb4c338e00a42faf6309ff531b57b76dc8ed9f 100644 (file)
@@ -1608,7 +1608,7 @@ void MWindow::paste_silence()
                if( edl->session->frame_rate > 0 )
                        end += 1./edl->session->frame_rate;
        }
-       undo->update_undo_before();
+       undo->update_undo_before(_("silence"), this);
        edl->paste_silence(start, end,
                edl->session->labels_follow_edits,
                edl->session->plugins_follow_edits,
@@ -2400,11 +2400,13 @@ void MWindow::speed_before()
 int MWindow::speed_after(int done)
 {
        int result = 0;
-       if( speed_edl && done >= 0 )
-               result = normalize_speed(speed_edl, edl);
-       if( done ) {
-               speed_edl->remove_user();
-               speed_edl = 0;
+       if( speed_edl ) {
+               if( done >= 0 )
+                       result = normalize_speed(speed_edl, edl);
+               if( done != 0 ) {
+                       speed_edl->remove_user();
+                       speed_edl = 0;
+               }
        }
        return result;
 }
index fc1380edfc9b32391fcef17707543b427322daea..b534a10e174e0fe5b72a2b29ac8d21ef579b4d6f 100644 (file)
@@ -260,15 +260,13 @@ Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale)
        if( !proxy ) {
                proxy = new Asset(new_path);
 // new compression parameters
-               int64_t video_length = idxbl->get_video_frames();
-               if( video_length < 0 ) {
+               if( idxbl->get_video_frames() < 0 ) {
                        proxy->format = FILE_PNG;
                        proxy->png_use_alpha = 1;
-                       proxy->video_length = 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;
@@ -472,6 +470,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();
index c2bfb365c57c9f07e059fe52a2e6873af1bf9fd9..721e3be85c9e77759604a12742bc37828004d906 100644 (file)
@@ -73,7 +73,7 @@ RenderEngine::RenderEngine(PlaybackEngine *playback_engine,
        start_lock = new Condition(1, "RenderEngine::start_lock");
        output_lock = new Condition(1, "RenderEngine::output_lock");
        render_active = new Condition(1,"RenderEngine::render_active");
-       interrupt_lock = new Mutex("RenderEngine::interrupt_lock");
+       interrupt_lock = new Condition(1, "RenderEngine::interrupt_lock");
        first_frame_lock = new Condition(1, "RenderEngine::first_frame_lock");
 }
 
@@ -499,7 +499,7 @@ void RenderEngine::run()
        render_active->lock("RenderEngine::run");
        start_render_threads();
        start_lock->unlock();
-       interrupt_lock->reset();
+       interrupt_lock->unlock();
 
        wait_render_threads();
 
index 5e3ed940dbd917f400f146e8e5ae2ce046425833..4e9c9689df18ae57e5ba4904890dbe6cd4d72933 100644 (file)
@@ -111,7 +111,7 @@ public:
 // Lock out audio and synchronization timers until first frame is done
        Condition *first_frame_lock;
 // Lock out interrupts before and after renderengine is active
-       Mutex *interrupt_lock;
+       Condition *interrupt_lock;
 
        int done;
        int is_nested;
index 1143ef03df7e16ebebc048543ff0fa28e512e3de..22b38a6b73063df0f6a164117d6d502e96819e92 100644 (file)
@@ -51,4 +51,41 @@ public:
        const char *title;
 };
 
+#if 0
+#include <stdio.h>
+
+class TCondition : public Condition
+{
+public:
+       TCondition(int init_value = 0, const char *title = 0, int is_binary = 0)
+        : Condition(init_value, title, is_binary) {
+               printf("new TCondition(%s) = %p\n", title, this);
+       }
+       ~TCondition() {
+               printf("del TCondition(%s) = %p\n", title, this);
+       }
+       void lock(const char *location = 0) {
+               printf("Locking %p: %s\n", this, title);  Condition::lock(location);
+               printf("Locked %p: %s\n", this, title);
+       }
+       void unlock() {
+               printf("Unlocking %p: %s\n", this, title);  Condition::unlock();
+       }
+       int timed_lock(int microseconds, const char *location = 0) {
+               printf("timed locking %p: %s\n", this, title);
+               int ret = Condition::timed_lock(microseconds, location);
+               printf("timed locked %p:%d %s\n", this, ret,  title);  return ret;
+       }
+       void reset() {
+               printf("Reset %p: %s\n", this, title);
+               Condition::reset();
+       }
+       int get_value() {
+               int ret = Condition::get_value();
+               printf("get_value %p:%d %s\n", this, ret, title);
+               return ret;
+       }
+};
+
+#endif
 #endif
index c6cddd7639827ea6ddb89df9629d02a16a58dc04..6ac188d5e2c7222f1d3af68c02430ff2c6cfeba1 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include <errno.h>
 
 #include "bcsignals.h"
@@ -115,7 +116,8 @@ int Mutex::unlock()
 
        UNSET_LOCK(this);
 
-       if(pthread_mutex_unlock(&mutex)) perror("Mutex::unlock");
+       int ret = pthread_mutex_unlock(&mutex);
+       if( ret ) fprintf(stderr, "Mutex::unlock: %s\n",strerror(ret));
        return 0;
 }
 
index c61317eed575155ce5174fbfa427ec62a9b2f8ac..4a1052cdaf68221777bf54f99c61c622287a1e69 100644 (file)
@@ -53,4 +53,40 @@ public:
        const char *title;
 };
 
+#if 0
+#include <stdio.h>
+
+class TMutex : public Mutex
+{ // logged
+public:
+       TMutex(const char *title = 0, int recursive = 0)
+         : Mutex(title, recursive) {
+               printf("new TMutex(%s) = %p\n", title, this);
+       }
+       ~TMutex() {
+               printf("del TMutex(%s) = %p\n", title, this);
+       }
+       int lock(const char *location = 0) {
+               printf("locking %p: %s\n", this, title);  int ret = Mutex::lock(location);
+               printf("locked %p:%d %s\n", this, ret,  title);  return ret;
+       }
+       int unlock() {
+               printf("unlocking %p: %s\n", this, title);  return Mutex::unlock();
+       }
+       int trylock(const char *location = 0) {
+               printf("try locking %p: %s\n", this, title);  int ret = Mutex::trylock(location);
+               printf("try locked %p:%d %s\n", this, ret, title);  return ret;
+       }
+       int reset() {
+               printf("reset %p: %s\n", this, title);
+               return Mutex::reset();
+       }
+       int is_locked() {
+               int ret = Mutex::is_locked();
+               printf("is_locked %p:%d %s\n", this, ret, title);
+               return ret;
+       }
+};
+
+#endif
 #endif