add drag edit render_handle_frame
authorGood Guy <[email protected]>
Tue, 2 Oct 2018 23:22:00 +0000 (17:22 -0600)
committerGood Guy <[email protected]>
Tue, 2 Oct 2018 23:22:00 +0000 (17:22 -0600)
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/trackcanvas.h
cinelerra-5.1/thirdparty/src/ffmpeg-4.0.patch0 [new file with mode: 0644]

index 198a0fdfc0f62e435cb7cf2347f1132858c1f82e..34157b1fc4472fef297baad683dfe01d8843ff57 100644 (file)
@@ -553,7 +553,6 @@ int Edit::shift_start_out(int edit_mode,
                                startproject -= cut_length;
                                startsource -= cut_length;
                                length += cut_length;
-printf("Edit::shift_start_out 2\n");
                        }
                        else
                        {   // Clear entire previous edit
index 4de073e34a281231075b3e7c69a71f5aca5db171..cbc62e1f1a7f4b3055594077b68ae5486e538fe9 100644 (file)
@@ -27,6 +27,8 @@
 #include "bctimer.h"
 #include "clip.h"
 #include "bccolors.h"
+#include "cache.h"
+#include "canvas.h"
 #include "cplayback.h"
 #include "cursors.h"
 #include "cwindowgui.h"
@@ -67,6 +69,7 @@
 #include "pluginset.h"
 #include "plugintoggles.h"
 #include "preferences.h"
+#include "renderengine.h"
 #include "resourcepixmap.h"
 #include "resourcethread.h"
 #include "swindow.h"
@@ -80,6 +83,7 @@
 #include "transportque.h"
 #include "vframe.h"
 #include "vpatchgui.inc"
+#include "vrender.h"
 #include "zoombar.h"
 
 #include <string.h>
@@ -3597,14 +3601,85 @@ void TrackCanvas::update_drag_handle()
        {
                mwindow->session->drag_position = new_position;
                gui->mainclock->update(new_position);
-
-
                timebar_position = new_position;
                gui->update_timebar(0);
-// Que the CWindow.  Doesn't do anything if selectionstart and selection end
-// aren't changed.
-//             mwindow->cwindow->update(1, 0, 0);
+
+               EDL *edl = new EDL;
+               edl->create_objects();
+               edl->copy_all(mwindow->edl);
+               MainSession *session = mwindow->session;
+               int edit_mode = mwindow->edl->session->edit_handle_mode[session->drag_button];
+               edl->modify_edithandles(session->drag_start,
+                       session->drag_position,
+                       session->drag_handle,
+                       edit_mode,
+                       edl->session->labels_follow_edits,
+                       edl->session->plugins_follow_edits,
+                       edl->session->autos_follow_edits);
+               double position = edit_mode != MOVE_NO_EDITS &&
+                       ( session->drag_handle || edit_mode == MOVE_ONE_EDIT ) ?
+                               session->drag_position : session->drag_start;
+               Track *track = session->drag_edit->edits->track;
+               int64_t pos = track->to_units(position, 0);
+               render_handle_frame(edl, pos, shift_down() ? 0 :
+                       session->drag_handle ? 1 : 2);
+               edl->remove_user();
+       }
+}
+
+int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode)
+{
+       int result = 0;
+       int64_t left = pos-1;
+       if( left < 0 ) left = 0;
+       switch( mode ) {
+       case 0: {
+               VFrame vlt(edl->get_w(), edl->get_h(), edl->session->color_model);
+               VFrame vrt(edl->get_w(), edl->get_h(), edl->session->color_model);
+               TransportCommand command;
+               command.command = CURRENT_FRAME;
+               command.get_edl()->copy_all((EDL *)edl);
+               command.change_type = CHANGE_ALL;
+               command.realtime = 0;
+               Preferences *preferences = mwindow->preferences;
+               RenderEngine *render_engine = new RenderEngine(0, preferences, 0, 0);
+               CICache *video_cache = new CICache(preferences);
+               render_engine->set_vcache(video_cache);
+               render_engine->arm_command(&command);
+               int64_t left = pos-1;
+               if( left < 0 ) left = 0;
+               VRender *vrender = render_engine->vrender;
+               result = vrender &&
+                       !vrender->process_buffer(&vlt, left, 0) &&
+                       !vrender->process_buffer(&vrt, pos , 0) ? 0 : 1;
+               delete render_engine;
+               delete video_cache;
+               mwindow->cwindow->gui->lock_window("TrackCanvas::render_handle_frame 0");
+               Canvas *canvas = mwindow->cwindow->gui->canvas;
+               canvas->lock_canvas("TrackCanvas::render_handle_frame 1");
+               int w = canvas->w, h = canvas->h, w2 = w/2, h2 = h/2;
+               int lx = 0, ly = h2/2, rx = w2, ry = h2/2;
+               BC_WindowBase *window = canvas->get_canvas();
+               window->draw_vframe(&vlt, lx,ly, w2,h2, 0,0,vlt.get_w(),vlt.get_h());
+               window->draw_vframe(&vrt, rx,ry, w2,h2, 0,0,vrt.get_w(),vrt.get_h());
+               window->flash(1);
+               canvas->unlock_canvas();
+               mwindow->cwindow->gui->unlock_window();
+               break; }
+       case 1:
+       case 2: {
+               Track *track = mwindow->session->drag_edit->edits->track;
+               double position = track->from_units(mode == 1 ? left : pos);
+               if( position < 0 ) position = 0;
+               edl->local_session->set_selectionstart(position);
+               edl->local_session->set_selectionend(position);
+               PlaybackEngine *playback_engine = mwindow->cwindow->playback_engine;
+               if( playback_engine->is_playing_back )
+                       playback_engine->stop_playback(1);
+               mwindow->cwindow->playback_engine->refresh_frame(CHANGE_EDL, edl, 0);
+               break; }
        }
+       return result;
 }
 
 int TrackCanvas::update_drag_edit()
index a5d007e56bcefdeac63b8188881de2280281106d..59f58c308e7f90ab6a1600225d691803402422c4 100644 (file)
@@ -352,6 +352,7 @@ public:
        double time_visible();
        void update_drag_handle();
        int update_drag_edit();
+       int render_handle_frame(EDL *edl, int64_t pos, int mode);
        int update_drag_floatauto(int cursor_x, int cursor_y);
        int update_drag_toggleauto(int cursor_x, int cursor_y);
        int update_drag_auto(int cursor_x, int cursor_y);
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-4.0.patch0 b/cinelerra-5.1/thirdparty/src/ffmpeg-4.0.patch0
new file mode 100644 (file)
index 0000000..5dd3110
--- /dev/null
@@ -0,0 +1,11 @@
+diff -urN a/fftools/cmdutils.c b/fftools/cmdutils.c
+--- a/fftools/cmdutils.c       2018-10-01 10:52:48.866784675 -0600
++++ b/fftools/cmdutils.c       2018-10-01 10:52:55.550799827 -0600
+@@ -1179,6 +1179,7 @@
+ void show_banner(int argc, char **argv, const OptionDef *options)
+ {
++    return;
+     int idx = locate_option(argc, argv, options, "version");
+     if (hide_banner || idx)
+         return;