From: Good Guy Date: Tue, 28 Feb 2017 20:16:18 +0000 (-0700) Subject: bd tweaks, add png browse to titler, ladspa path fix, colorpicker tweaks X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=976d975e458fc1a088bd0cc58e5e483f5fbf7746;p=goodguy%2Fhistory.git bd tweaks, add png browse to titler, ladspa path fix, colorpicker tweaks --- diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index 37d27625..76892b71 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -54,10 +54,10 @@ static struct bd_format { { "1280x720 50p", 1280,720, 50., 1, ILACE_MODE_NOTINTERLACED }, { "1280x720 24p", 1280,720, 24., 1, ILACE_MODE_NOTINTERLACED }, { "1280x720 23.976p", 1280,720, 23.976, 1, ILACE_MODE_NOTINTERLACED }, + { "720x576 25i", 720,576, 25., 0, ILACE_MODE_BOTTOM_FIRST }, { "720x576 25p*", 720,576, 25., 0, ILACE_MODE_NOTINTERLACED }, - { "720x576 25i", 720,576, 25., 0, ILACE_MODE_TOP_FIRST }, - { "720x480 29.97p*", 720,480, 29.97, 0, ILACE_MODE_NOTINTERLACED }, { "720x480 29.97i", 720,480, 29.97, 0, ILACE_MODE_BOTTOM_FIRST }, + { "720x480 29.97p*", 720,480, 29.97, 0, ILACE_MODE_NOTINTERLACED }, }; const int64_t CreateBD_Thread::BD_SIZE = 25000000000; @@ -121,16 +121,17 @@ CreateBD_Thread::~CreateBD_Thread() close_window(); } -void CreateBD_Thread::get_udfs_mount(char *udfs, char *mopts, char *mntpt) +int CreateBD_Thread::get_udfs_mount(char *udfs, char *mopts, char *mntpt) { + int ret = 0; // default: mount -t udf -o loop $1/bd.udfs $1/udfs strcpy(udfs,"$1/bd.udfs"); strcpy(mopts,"-t udf -o loop $1/bd.udfs "); strcpy(mntpt,"$1/udfs"); const char *home = getenv("HOME"); - if( !home ) return; + if( !home ) return ret; FILE *fp = fopen("/etc/fstab","r"); - if( !fp ) return; + if( !fp ) return ret; int len = strlen(home); char line[BCTEXTLEN], typ[BCTEXTLEN], file[BCTEXTLEN]; char mpnt[BCTEXTLEN], opts[BCTEXTLEN]; @@ -158,10 +159,12 @@ void CreateBD_Thread::get_udfs_mount(char *udfs, char *mopts, char *mntpt) strcpy(udfs, file); strcpy(mopts, ""); strcpy(mntpt, mpnt); + ret = 1; break; } } fclose(fp); + return ret; } int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, const char *asset_dir) @@ -218,7 +221,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, const char return 1; } char udfs[BCTEXTLEN], mopts[BCTEXTLEN], mntpt[BCTEXTLEN]; - get_udfs_mount(udfs, mopts, mntpt); + int is_usr_mnt = get_udfs_mount(udfs, mopts, mntpt); const char *exec_path = File::get_cinlib_path(); fprintf(fp,"#!/bin/bash -ex\n"); fprintf(fp,"PATH=$PATH:%s\n",exec_path); @@ -230,9 +233,11 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, const char fprintf(fp,"mount %s%s\n", mopts, mntpt); fprintf(fp,"bdwrite %s $1/bd.m2ts\n",mntpt); fprintf(fp,"umount %s\n",mntpt); + if( is_usr_mnt ) + fprintf(fp,"mv -f %s $1/bd.udfs\n", udfs); fprintf(fp,"echo To burn bluray, load writable media and run:\n"); - fprintf(fp,"echo for WORM: growisofs -dvd-compat -Z /dev/bd=%s\n", udfs); - fprintf(fp,"echo for RW: dd if=%s of=/dev/bd bs=2048000\n",udfs); + fprintf(fp,"echo for WORM: growisofs -dvd-compat -Z /dev/bd=$1/bd.udfs\n"); + fprintf(fp,"echo for RW: dd if=$1/bd.udfs of=/dev/bd bs=2048000\n"); fprintf(fp,"kill $$\n"); fprintf(fp,"\n"); fclose(fp); diff --git a/cinelerra-5.1/cinelerra/bdcreate.h b/cinelerra-5.1/cinelerra/bdcreate.h index 6bcb8e8d..f69ee1aa 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.h +++ b/cinelerra-5.1/cinelerra/bdcreate.h @@ -34,7 +34,7 @@ class CreateBD_Thread : public BC_DialogThread static const int BD_MAX_BITRATE, BD_CHANNELS, BD_WIDE_CHANNELS; static const double BD_FRAMERATE, BD_SAMPLERATE, BD_KAUDIO_RATE; static const int BD_INTERLACE_MODE; - static void get_udfs_mount(char *udfs, char *mopts, char *mntpt); + static int get_udfs_mount(char *udfs, char *mopts, char *mntpt); public: CreateBD_Thread(MWindow *mwindow); ~CreateBD_Thread(); diff --git a/cinelerra-5.1/cinelerra/browsebutton.C b/cinelerra-5.1/cinelerra/browsebutton.C index 00bbe03f..fae5758b 100644 --- a/cinelerra-5.1/cinelerra/browsebutton.C +++ b/cinelerra-5.1/cinelerra/browsebutton.C @@ -26,8 +26,6 @@ #include "theme.h" - - BrowseButton::BrowseButton(Theme *theme, BC_WindowBase *parent_window, BC_TextBox *textbox, @@ -92,7 +90,8 @@ int BrowseButton::handle_event() void BrowseButton::run() { BrowseButtonWindow browsewindow(theme, - this, + get_x() - BC_WindowBase::get_resources()->filebox_w / 2, + get_y() - BC_WindowBase::get_resources()->filebox_h / 2, parent_window, textbox->get_text(), title, @@ -129,31 +128,13 @@ void BrowseButton::run() startup_lock->unlock(); } - - - - - -BrowseButtonWindow::BrowseButtonWindow(Theme *theme, - BrowseButton *button, - BC_WindowBase *parent_window, - const char *init_directory, - const char *title, - const char *caption, - int want_directory) - : BC_FileBox(button->x - - BC_WindowBase::get_resources()->filebox_w / 2, - button->y - - BC_WindowBase::get_resources()->filebox_h / 2, - init_directory, - title, - caption, -// Set to 1 to get hidden files. - want_directory, -// Want only directories - want_directory, - 0, - theme->browse_pad) +BrowseButtonWindow::BrowseButtonWindow(Theme *theme, int x, int y, + BC_WindowBase *parent_window, const char *init_directory, + const char *title, const char *caption, int want_directory) + : BC_FileBox(x, y, init_directory, title, caption, + want_directory, // Set to 1 to get hidden files. + want_directory, // Want only directories + 0, theme->browse_pad) { } diff --git a/cinelerra-5.1/cinelerra/browsebutton.h b/cinelerra-5.1/cinelerra/browsebutton.h index f7cb4c16..0818cdc8 100644 --- a/cinelerra-5.1/cinelerra/browsebutton.h +++ b/cinelerra-5.1/cinelerra/browsebutton.h @@ -62,7 +62,7 @@ class BrowseButtonWindow : public BC_FileBox { public: BrowseButtonWindow(Theme *theme, - BrowseButton *button, + int x, int y, BC_WindowBase *parent_window, const char *init_directory, const char *title, diff --git a/cinelerra-5.1/cinelerra/colorpicker.C b/cinelerra-5.1/cinelerra/colorpicker.C index dce319e9..b3befe77 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.C +++ b/cinelerra-5.1/cinelerra/colorpicker.C @@ -200,9 +200,9 @@ void ColorWindow::create_objects() void ColorWindow::change_values() { - float r = ((thread->output & 0xff0000) >> 16) / 255.; - float g = ((thread->output & 0xff00) >> 8) / 255.; - float b = ((thread->output & 0xff)) / 255.; + float r = ((thread->output>>16) & 0xff) / 255.; + float g = ((thread->output>>8) & 0xff) / 255.; + float b = ((thread->output>>0) & 0xff) / 255.; rgb.r = r; rgb.g = g; rgb.b = b; aph = (float)thread->alpha / 255; update_rgb(rgb.r, rgb.g, rgb.b); @@ -293,10 +293,9 @@ PaletteWheel::~PaletteWheel() int PaletteWheel::button_press_event() { - if(get_cursor_x() >= 0 && get_cursor_x() < get_w() && + if( get_cursor_x() >= 0 && get_cursor_x() < get_w() && get_cursor_y() >= 0 && get_cursor_y() < get_h() && - is_event_win()) - { + is_event_win() ) { button_down = 1; cursor_motion_event(); return 1; @@ -307,17 +306,14 @@ int PaletteWheel::button_press_event() int PaletteWheel::cursor_motion_event() { int x1, y1, distance; - if(button_down && is_event_win()) - { - window->hsv.h = get_angle(get_w() / 2, - get_h() / 2, - get_cursor_x(), - get_cursor_y()); + if( button_down && is_event_win() ) { + float h = get_angle(get_w()/2, get_h()/2, get_cursor_x(), get_cursor_y()); + bclamp(h, 0, 359.999); window->hsv.h = h; x1 = get_w() / 2 - get_cursor_x(); y1 = get_h() / 2 - get_cursor_y(); distance = (int)sqrt(x1 * x1 + y1 * y1); - if(distance > get_w() / 2) distance = get_w() / 2; - window->hsv.s = (float)distance / (get_w() / 2); + float s = (float)distance / (get_w() / 2); + bclamp(s, 0, 1); window->hsv.s = s; window->update_hsv(); window->update_display(); window->handle_event(); @@ -328,8 +324,7 @@ int PaletteWheel::cursor_motion_event() int PaletteWheel::button_release_event() { - if(button_down) - { + if( button_down ) { button_down = 0; return 1; } @@ -340,9 +335,7 @@ void PaletteWheel::create_objects() { // Upper right //printf("PaletteWheel::create_objects 1\n"); - float h; - float s; - float v = 1; + float h, s, v = 1; float r, g, b; float x1, y1, x2, y2; float distance; @@ -359,31 +352,25 @@ void PaletteWheel::create_objects() int highlight_g = (get_resources()->button_light & 0xff00) >> 8; int highlight_b = (get_resources()->button_light & 0xff); - for(y2 = 0; y2 < get_h(); y2++) - { + for( y2 = 0; y2 < get_h(); y2++ ) { unsigned char *row = (unsigned char*)frame.get_rows()[(int)y2]; - for(x2 = 0; x2 < get_w(); x2++) - { + for( x2 = 0; x2 < get_w(); x2++ ) { distance = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); - if(distance > x1) - { + if( distance > x1 ) { row[(int)x2 * 4] = default_r; row[(int)x2 * 4 + 1] = default_g; row[(int)x2 * 4 + 2] = default_b; row[(int)x2 * 4 + 3] = 0; } else - if(distance > x1 - 1) - { + if( distance > x1 - 1 ) { int r_i, g_i, b_i; - if(get_h() - y2 < x2) - { + if( get_h() - y2 < x2 ) { r_i = highlight_r; g_i = highlight_g; b_i = highlight_b; } - else - { + else { r_i = 0; g_i = 0; b_i = 0; @@ -394,8 +381,7 @@ void PaletteWheel::create_objects() row[(int)x2 * 4 + 2] = b_i; row[(int)x2 * 4 + 3] = 255; } - else - { + else { h = get_angle(x1, y1, x2, y2); s = distance / x1; HSV::hsv_to_rgb(r, g, b, h, s, v); @@ -441,50 +427,35 @@ int PaletteWheel::draw(float hue, float saturation) x = w = get_w() / 2; y = h = get_h() / 2; - if(hue > 0 && hue < 90) - { + if( hue > 0 && hue < 90 ) { x = (int)(w - w * cos(torads(90 - hue)) * saturation); y = (int)(h - h * sin(torads(90 - hue)) * saturation); } - else - if(hue > 90 && hue < 180) - { + else if( hue > 90 && hue < 180 ) { x = (int)(w - w * cos(torads(hue - 90)) * saturation); y = (int)(h + h * sin(torads(hue - 90)) * saturation); } - else - if(hue > 180 && hue < 270) - { + else if( hue > 180 && hue < 270 ) { x = (int)(w + w * cos(torads(270 - hue)) * saturation); y = (int)(h + h * sin(torads(270 - hue)) * saturation); } - else - if(hue > 270 && hue < 360) - { + else if( hue > 270 && hue < 360 ) { x = (int)(w + w * cos(torads(hue - 270)) * saturation); y = (int)(h - w * sin(torads(hue - 270)) * saturation); } - else - if(hue == 0) - { + else if( hue == 0 ) { x = w; y = (int)(h - h * saturation); } - else - if(hue == 90) - { + else if( hue == 90 ) { x = (int)(w - w * saturation); y = h; } - else - if(hue == 180) - { + else if( hue == 180 ) { x = w; y = (int)(h + h * saturation); } - else - if(hue == 270) - { + else if( hue == 270 ) { x = (int)(w + w * saturation); y = h; } @@ -499,7 +470,7 @@ int PaletteWheel::draw(float hue, float saturation) int PaletteWheel::get_angle(float x1, float y1, float x2, float y2) { float result = -atan2(x2 - x1, y1 - y2) * (360 / M_PI / 2); - if (result < 0) + if( result < 0 ) result += 360; return (int)result; } @@ -525,10 +496,9 @@ void PaletteWheelValue::create_objects() int PaletteWheelValue::button_press_event() { //printf("PaletteWheelValue::button_press 1 %d\n", is_event_win()); - if(get_cursor_x() >= 0 && get_cursor_x() < get_w() && + if( get_cursor_x() >= 0 && get_cursor_x() < get_w() && get_cursor_y() >= 0 && get_cursor_y() < get_h() && - is_event_win()) - { + is_event_win() ) { //printf("PaletteWheelValue::button_press 2\n"); button_down = 1; cursor_motion_event(); @@ -539,10 +509,10 @@ int PaletteWheelValue::button_press_event() int PaletteWheelValue::cursor_motion_event() { - if(button_down && is_event_win()) - { + if( button_down && is_event_win() ) { //printf("PaletteWheelValue::cursor_motion 1\n"); - window->hsv.v = 1.0 - (float)(get_cursor_y() - 2) / (get_h() - 4); + float v = 1.0 - (float)(get_cursor_y() - 2) / (get_h() - 4); + bclamp(v, 0, 1); window->hsv.v = v; window->update_hsv(); window->update_display(); window->handle_event(); @@ -553,8 +523,7 @@ int PaletteWheelValue::cursor_motion_event() int PaletteWheelValue::button_release_event() { - if(button_down) - { + if( button_down ) { //printf("PaletteWheelValue::button_release 1\n"); button_down = 0; return 1; @@ -567,16 +536,14 @@ int PaletteWheelValue::draw(float hue, float saturation, float value) float r_f, g_f, b_f; int i, j, r, g, b; - for(i = get_h() - 3; i >= 2; i--) - { + for( i = get_h() - 3; i >= 2; i-- ) { unsigned char *row = (unsigned char*)frame->get_rows()[i]; HSV::hsv_to_rgb(r_f, g_f, b_f, hue, saturation, 1.0 - (float)(i - 2) / (get_h() - 4)); r = (int)(r_f * 255); g = (int)(g_f * 255); b = (int)(b_f * 255); - for(j = 0; j < get_w(); j++) - { + for( j = 0; j < get_w(); j++ ) { row[j * 3] = r; row[j * 3 + 1] = g; row[j * 3 + 2] = b; @@ -858,6 +825,7 @@ PalletteNum::PalletteNum(ColorWindow *window, int x, int y, this->window = window; this->output = &output; set_increment(0.01); + set_precision(2); } PalletteNum::~PalletteNum() diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index aee8aadb..1060bb88 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -599,6 +599,7 @@ int MWindow::init_ladspa_plugins(MWindow *mwindow, Preferences *preferences) len = !cp ? strlen(path) : cp-path; char index_path[BCTEXTLEN], plugin_path[BCTEXTLEN]; memcpy(plugin_path, path, len); plugin_path[len] = 0; + if( cp ) ++len; char *plugin_dir = FileSystem::basepath(plugin_path); strcpy(plugin_path, plugin_dir); delete [] plugin_dir; create_defaults_path(index_path, LADSPA_FILE); diff --git a/cinelerra-5.1/ffmpeg/video/bluray_dv_pal.m2ts b/cinelerra-5.1/ffmpeg/video/bluray_dv_pal.m2ts index 8fd4e8a1..14f9ceec 100644 --- a/cinelerra-5.1/ffmpeg/video/bluray_dv_pal.m2ts +++ b/cinelerra-5.1/ffmpeg/video/bluray_dv_pal.m2ts @@ -14,4 +14,4 @@ color_primaries=bt470bg color_trc=gamma28 colorspace=bt470bg # must be last for bdcreate.C -x264opts cabac=1:keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8:tff +x264opts cabac=1:keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8:bff diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.C b/cinelerra-5.1/plugins/titler/titlerwindow.C index 394d82de..9e577a9a 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.C +++ b/cinelerra-5.1/plugins/titler/titlerwindow.C @@ -20,6 +20,7 @@ */ #include "bcdisplayinfo.h" +#include "bcdialog.h" #include "bcsignals.h" #include "browsebutton.h" #include "clip.h" @@ -116,7 +117,8 @@ TitleWindow::TitleWindow(TitleMain *client) TitleWindow::~TitleWindow() { ungrab(client->server->mwindow->cwindow->gui); - delete fonts_popup; + delete color_popup; + delete png_popup; for( int i=0; iget_icon(); @@ -367,7 +369,7 @@ void TitleWindow::create_objects() x += background_path->get_w() + margin; add_tool(background_browse = new BrowseButton( client->server->mwindow->theme, this, background_path, - x, y, 0, _("background media"), _("Select background media path"))); + x, y, "", _("background media"), _("Select background media path"))); x += background_browse->get_w() + 3*margin; add_tool(loop_playback = new TitleLoopPlayback(client, x, y)); y += loop_playback->get_h() + 10; @@ -383,6 +385,7 @@ void TitleWindow::create_objects() cur_popup->create_objects(); add_tool(fonts_popup = new TitleFontsPopup(client, this)); color_popup = new TitleColorPopup(client, this); + png_popup = new TitlePngPopup(client, this); show_window(1); update(); @@ -1437,6 +1440,10 @@ int TitleCurSubMenuItem::handle_event() window->color_popup->activate(); return 1; } + if( !strcmp(item_text, _("png file")) ) { + window->png_popup->activate(); + return 1; + } char txt[BCSTRLEN]; sprintf(txt, "<%s>", item_text); int adv = strlen(txt); @@ -1493,3 +1500,42 @@ void TitleColorPopup::handle_done_event(int result) window->insert_ibeam(txt, strlen(txt)); } +TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window) + : BC_DialogThread() +{ + this->client = client; + this->window = window; +} + +TitlePngPopup::~TitlePngPopup() +{ + close_window(); +} + +void TitlePngPopup::handle_done_event(int result) +{ + if( result ) return; + BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui(); + const char *path = gui->get_submitted_path(); + char txt[BCSTRLEN]; sprintf(txt, "",path); + window->insert_ibeam(txt, strlen(txt)); +} + +BC_Window *TitlePngPopup::new_gui() +{ + BC_DisplayInfo display_info; + int x = display_info.get_abs_cursor_x(); + int y = display_info.get_abs_cursor_y(); + + BC_Window *gui = new BrowseButtonWindow(client->server->mwindow->theme, + x-25, y-100, window, "", _("Png file"), _("Png path"), 0); + gui->create_objects(); + return gui; +} + +int TitlePngPopup::activate() +{ + BC_DialogThread::start(); + return 1; +} + diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.h b/cinelerra-5.1/plugins/titler/titlerwindow.h index 7e73324f..5df373f5 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.h +++ b/cinelerra-5.1/plugins/titler/titlerwindow.h @@ -78,6 +78,7 @@ class TitleCurSubMenu; class TitleCurSubMenuItem; class TitleFontsPopup; class TitleColorPopup; +class TitlePngPopup; class TitleWindow : public PluginClientWindow { @@ -121,6 +122,7 @@ public: TitleCurPopup *cur_popup; TitleFontsPopup *fonts_popup; TitleColorPopup *color_popup; + TitlePngPopup *png_popup; int color_x, color_y; int outline_color_x, outline_color_y; @@ -566,4 +568,18 @@ public: int color_value; }; +class TitlePngPopup : public BC_DialogThread +{ +public: + TitlePngPopup(TitleMain *client, TitleWindow *window); + ~TitlePngPopup(); + + void handle_done_event(int result); + BC_Window* new_gui(); + int activate(); + + TitleMain *client; + TitleWindow *window; +}; + #endif