add asset max wxh and max texture tests, fix position clamp for single frame assets
authorGood Guy <[email protected]>
Sun, 13 Sep 2020 01:11:32 +0000 (19:11 -0600)
committerGood Guy <[email protected]>
Sun, 13 Sep 2020 01:11:32 +0000 (19:11 -0600)
cinelerra-5.1/cinelerra/asset.C
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/edl.inc
cinelerra-5.1/cinelerra/vmodule.C
cinelerra-5.1/guicast/bcdisplayinfo.C
cinelerra-5.1/guicast/bcdisplayinfo.h

index 2828fe31df7a535088d45da3713a084bd22edbd0..23586a06e4031f9702ee673f5543700940c3ead6 100644 (file)
@@ -182,8 +182,8 @@ void Asset::boundaries()
 //     CLAMP(sample_rate, 1, 1000000);
 //     CLAMP(frame_rate, 0.001, 1000000);
        CLAMP(channels, 0, MAX_CHANNELS-1);
-       CLAMP(width, 0, 32767);
-       CLAMP(height, 0, 32767);
+       CLAMP(width, 0, ASSET_MAX_WIDTH);
+       CLAMP(height, 0, ASSET_MAX_HEIGHT);
 //printf("Asset::boundaries %d %d %f\n", __LINE__, sample_rate, frame_rate);
 }
 
index c9a9a898ec33ba473d1690df138d127f541a7a24..3960340ac93f0b0638712d698af52633509e2aa4 100644 (file)
@@ -29,6 +29,7 @@
 #include "awindow.h"
 #include "awindowgui.h"
 #include "bccmodels.h"
+#include "bcdisplayinfo.h"
 #include "bchash.h"
 #include "bcsignals.h"
 #include "bctimer.h"
@@ -2073,6 +2074,21 @@ void AWindowGUI::update_asset_list()
                        AssetPicon *picon = new AssetPicon(mwindow,
                                this, current);
                        new_assets.append(picon);
+                       if( current->width > ASSET_MAX_WIDTH || current->height > ASSET_MAX_HEIGHT ) {
+                               eprintf(_("Warning: %s\n"
+                                       " dimensions %dx%d exceed asset maximum limits %dx%d\n"),
+                                       current->path, current->width, current->height,
+                                               ASSET_MAX_WIDTH, ASSET_MAX_HEIGHT);
+                       }
+                       else if( mwindow->edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
+                               int texture_limit = BC_DisplayInfo::get_gl_max_texture_size();
+                               if( texture_limit >= 0 &&
+                                   (current->width >= texture_limit || current->height >= texture_limit) ) {
+                                       eprintf(_("Warning: %s\n"
+                                               " dimensions %dx%d exceed OpenGL texture limit %d\n"),
+                                               current->path, current->width, current->height, texture_limit);
+                               }
+                       }
                }
        }
 
index ff56d686877ff6244529ea407acd07044304a67a..966eef59816ee7d524a895402b3da18041f31ea5 100644 (file)
@@ -125,6 +125,8 @@ class EDL;
 #define ASSETS_ICON_LIST 3
 #define FOLDERS_TEXT 0
 #define FOLDERS_ICONS 1
+#define ASSET_MAX_WIDTH 32767
+#define ASSET_MAX_HEIGHT 32767
 
 #define ASSET_COLUMNS 2
 
index 5644419070e68b754238378fca4c86b281287fa1..f3cc19c6874dc8f92a64988295f480c7ebc6ff98 100644 (file)
@@ -250,6 +250,7 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit,
                                max_position = Units::to_int64(nested_edl->tracks->total_length() *
                                        frame_rate - 1);
                        }
+                       if( max_position < 0 ) max_position = 0;
 // if we hit the end of stream, freeze at last frame
                        CLAMP(position, 0, max_position);
 
index fcee206668d6e7b1e65893d5a97e9e9a06fb6210..62d58338fd648ba13844e17b19b7c5c3189b9608 100644 (file)
@@ -41,6 +41,7 @@ int BC_DisplayInfo::bottom_border = -1;
 int BC_DisplayInfo::right_border = -1;
 int BC_DisplayInfo::auto_reposition_x = -1;
 int BC_DisplayInfo::auto_reposition_y = -1;
+int BC_DisplayInfo::gl_max_texture_size = -1;
 char BC_DisplayInfo::gl_shader_version[64] = { 0, };
 
 BC_DisplayInfo::BC_DisplayInfo(const char *display_name, int show_error)
@@ -240,6 +241,8 @@ int BC_DisplayInfo::gl_probe(Window win)
                if( shader_version )
                        strncpy(gl_shader_version, shader_version, sizeof(gl_shader_version));
        }
+       gl_max_texture_size = 0;
+       glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max_texture_size);
        glXMakeContextCurrent(display, None, None, 0);
        if( glx_ctx ) glXDestroyContext(display, glx_ctx);
        if( glx_win ) glXDestroyWindow(display, glx_win);
@@ -388,6 +391,12 @@ int BC_DisplayInfo::get_bottom_border()
        return bottom_border;
 }
 
+int BC_DisplayInfo::get_gl_max_texture_size()
+{
+       init_borders();
+       return gl_max_texture_size;
+}
+
 const char *BC_DisplayInfo::get_gl_shader_version()
 {
        init_borders();
index 63c06b98ae6cd6a68e4a326f43b55705198dc210..86564d9bb24ef2f770830d90a11de7f69f6e4049 100644 (file)
@@ -52,6 +52,7 @@ public:
        static int get_right_border();
        static int get_bottom_border();
        static const char *get_gl_shader_version();
+       static int get_gl_max_texture_size();
        int get_screen_count();
        void test_window(int &x_out, int &y_out, int &x_out2, int &y_out2, int x_in, int y_in);
        static const char *host_display_name(const char *name);
@@ -80,6 +81,7 @@ private:
        static int right_border;
        static int auto_reposition_x;
        static int auto_reposition_y;
+       static int gl_max_texture_size;
        static char gl_shader_version[64];
        int depth;
        char *display_name;