From: Good Guy Date: Sun, 13 Sep 2020 01:11:32 +0000 (-0600) Subject: add asset max wxh and max texture tests, fix position clamp for single frame assets X-Git-Tag: 2020-09~9 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=b75d1938e1d08c7f3ac49b19bb69bbeec5053aab;p=goodguy%2Fcinelerra.git add asset max wxh and max texture tests, fix position clamp for single frame assets --- diff --git a/cinelerra-5.1/cinelerra/asset.C b/cinelerra-5.1/cinelerra/asset.C index 2828fe31..23586a06 100644 --- a/cinelerra-5.1/cinelerra/asset.C +++ b/cinelerra-5.1/cinelerra/asset.C @@ -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); } diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index c9a9a898..3960340a 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -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); + } + } } } diff --git a/cinelerra-5.1/cinelerra/edl.inc b/cinelerra-5.1/cinelerra/edl.inc index ff56d686..966eef59 100644 --- a/cinelerra-5.1/cinelerra/edl.inc +++ b/cinelerra-5.1/cinelerra/edl.inc @@ -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 diff --git a/cinelerra-5.1/cinelerra/vmodule.C b/cinelerra-5.1/cinelerra/vmodule.C index 56444190..f3cc19c6 100644 --- a/cinelerra-5.1/cinelerra/vmodule.C +++ b/cinelerra-5.1/cinelerra/vmodule.C @@ -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); diff --git a/cinelerra-5.1/guicast/bcdisplayinfo.C b/cinelerra-5.1/guicast/bcdisplayinfo.C index fcee2066..62d58338 100644 --- a/cinelerra-5.1/guicast/bcdisplayinfo.C +++ b/cinelerra-5.1/guicast/bcdisplayinfo.C @@ -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(); diff --git a/cinelerra-5.1/guicast/bcdisplayinfo.h b/cinelerra-5.1/guicast/bcdisplayinfo.h index 63c06b98..86564d9b 100644 --- a/cinelerra-5.1/guicast/bcdisplayinfo.h +++ b/cinelerra-5.1/guicast/bcdisplayinfo.h @@ -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;