identity sh-f11=cam/sh-f12=proj keyframes, odd jpeg fix, zoom submenu, shudmp
authorGood Guy <good1.2guy@gmail.com>
Wed, 13 Feb 2019 04:38:44 +0000 (21:38 -0700)
committerGood Guy <good1.2guy@gmail.com>
Wed, 13 Feb 2019 04:38:44 +0000 (21:38 -0700)
15 files changed:
cinelerra-5.1/cinelerra/Makefile
cinelerra-5.1/cinelerra/autos.C
cinelerra-5.1/cinelerra/autos.h
cinelerra-5.1/cinelerra/canvas.C
cinelerra-5.1/cinelerra/canvas.h
cinelerra-5.1/cinelerra/canvas.inc
cinelerra-5.1/cinelerra/cwindow.C
cinelerra-5.1/cinelerra/cwindow.h
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowgui.h
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/filejpeg.C
cinelerra-5.1/cinelerra/filelist.C
cinelerra-5.1/cinelerra/libmjpeg.C
cinelerra-5.1/cinelerra/shudmp.C [new file with mode: 0644]

index 09ce46e9f03e7b64c8e373e1451d73b525533305..c1f97f1e9af41721f421e5c877b2555e19aa1367 100644 (file)
@@ -555,6 +555,8 @@ ydiff:      ydiff.C $(LIBRARIES)
 
 shdmp: shdmp.C
        @g++ $(CFLAGS) shdmp.C -o $@
+shudmp:        shudmp.C
+       @g++ $(CFLAGS) shudmp.C -o $@ -lusb-1.0
 
 clean:
        rm -rf $(OBJDIR)
index 490094cd368837ca9610d29f864ada4c83b70231..cb5a1bd265eb254ff165bd42a4c501f105614a24 100644 (file)
@@ -280,7 +280,7 @@ Auto* Autos::get_auto_at_position(double position)
 }
 
 
-Auto* Autos::get_auto_for_editing(double position)
+Auto* Autos::get_auto_for_editing(double position, int create)
 {
        if(position < 0) {
                position = edl->local_session->get_selectionstart(1);
@@ -288,7 +288,8 @@ Auto* Autos::get_auto_for_editing(double position)
 
        Auto *result = 0;
        get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result);
-       if( edl->session->auto_keyframes && (!result || result->is_default ||
+       if( create > 0 ) create = edl->session->auto_keyframes;
+       if( create && (!result || result->is_default ||
               !EQUIV(track->from_units(result->position), position)) ) {
 //printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result);
                position = edl->align_to_frame(position, 0);
index 5ce985afa057c75818301e5a9d0302cf59337aad..2e841bfd4cb44611668366bb746bd4c128526253 100644 (file)
@@ -62,8 +62,9 @@ public:
 // Returns auto at exact position, null if non-existent. ignores autokeyframming and align on frames
        Auto* get_auto_at_position(double position = -1);
 
-// Get keyframe for editing with automatic creation if enabled
-       Auto* get_auto_for_editing(double position = -1);
+// Get keyframe for editing with creation
+// create: <0: always new keyframe, =0: no new keyframe, >0: auto keyframe
+       Auto* get_auto_for_editing(double position=-1, int create=1);
 
 // Insert keyframe at the point if it doesn't exist
 // Interpolate its value if possible
index 0997e064dcafd393acce96fadf419b65ad3a2cd9..6b3f65085c920ea3994a224e8007287b4eb59b7a 100644 (file)
@@ -1050,19 +1050,36 @@ CanvasPopup::~CanvasPopup()
 {
 }
 
+CanvasZoomSize::CanvasZoomSize(Canvas *canvas)
+ : BC_MenuItem(_("Zoom..."))
+{
+       this->canvas = canvas;
+}
+
+CanvasSizeSubMenu::CanvasSizeSubMenu(CanvasZoomSize *zoom_size)
+{
+       this->zoom_size = zoom_size;
+}
+
 void CanvasPopup::create_objects()
 {
        add_item(new BC_MenuItem("-"));
        add_item(new CanvasFullScreenItem(canvas));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 25%"), 0.25));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 33%"), 0.33));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 50%"), 0.5));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 75%"), 0.75));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 100%"), 1.0));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 150%"), 1.5));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 200%"), 2.0));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 300%"), 3.0));
-       add_item(new CanvasPopupSize(canvas, _("Zoom 400%"), 4.0));
+
+       CanvasZoomSize *zoom_size = new CanvasZoomSize(canvas);
+       add_item(zoom_size);
+       CanvasSizeSubMenu *submenu = new CanvasSizeSubMenu(zoom_size);
+       zoom_size->add_submenu(submenu);
+
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 25%"), 0.25));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 33%"), 0.33));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 50%"), 0.5));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 75%"), 0.75));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 100%"), 1.0));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 150%"), 1.5));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 200%"), 2.0));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 300%"), 3.0));
+       submenu->add_submenuitem(new CanvasPopupSize(canvas, _("Zoom 400%"), 4.0));
 }
 
 void CanvasPopup::use_cwindow()
@@ -1070,6 +1087,8 @@ void CanvasPopup::use_cwindow()
        add_item(new CanvasPopupAuto(canvas));
        add_item(new CanvasPopupResetCamera(canvas));
        add_item(new CanvasPopupResetProjector(canvas));
+       add_item(new CanvasPopupCameraKeyframe(canvas));
+       add_item(new CanvasPopupProjectorKeyframe(canvas));
        add_item(toggle_controls = new CanvasToggleControls(canvas));
 }
 
@@ -1115,7 +1134,7 @@ int CanvasPopupSize::handle_event()
 
 
 CanvasPopupResetCamera::CanvasPopupResetCamera(Canvas *canvas)
- : BC_MenuItem(_("Reset camera"), "F11", KEY_F11)
+ : BC_MenuItem(_("Reset camera"), _("F11"), KEY_F11)
 {
        this->canvas = canvas;
 }
@@ -1125,10 +1144,8 @@ int CanvasPopupResetCamera::handle_event()
        return 1;
 }
 
-
-
 CanvasPopupResetProjector::CanvasPopupResetProjector(Canvas *canvas)
- : BC_MenuItem(_("Reset projector"), "F12", KEY_F12)
+ : BC_MenuItem(_("Reset projector"), _("F12"), KEY_F12)
 {
        this->canvas = canvas;
 }
@@ -1139,6 +1156,31 @@ int CanvasPopupResetProjector::handle_event()
 }
 
 
+CanvasPopupCameraKeyframe::CanvasPopupCameraKeyframe(Canvas *canvas)
+ : BC_MenuItem(_("Camera keyframe"), _("Shift-F11"), KEY_F11)
+{
+       this->canvas = canvas;
+       set_shift(1);
+}
+int CanvasPopupCameraKeyframe::handle_event()
+{
+       canvas->camera_keyframe();
+       return 1;
+}
+
+CanvasPopupProjectorKeyframe::CanvasPopupProjectorKeyframe(Canvas *canvas)
+ : BC_MenuItem(_("Projector keyframe"), _("Shift-F12"), KEY_F12)
+{
+       this->canvas = canvas;
+       set_shift(1);
+}
+int CanvasPopupProjectorKeyframe::handle_event()
+{
+       canvas->projector_keyframe();
+       return 1;
+}
+
+
 
 CanvasPopupResetTranslation::CanvasPopupResetTranslation(Canvas *canvas)
  : BC_MenuItem(_("Reset translation"))
index 1984269560882a1583377cce0ba19fcbb3bfd530..1a65426064bbecc2da026e18dedaf72f97538bd2 100644 (file)
 #ifndef CANVAS_H
 #define CANVAS_H
 
+#include "canvas.inc"
 #include "edl.inc"
 #include "guicast.h"
 #include "mwindow.inc"
 #include "videodevice.inc"
-
 // Output for all X11 video
 
-class CanvasOutput;
-class CanvasFullScreen;
-class CanvasXScroll;
-class CanvasYScroll;
-class CanvasPopup;
-class CanvasFullScreenPopup;
-class CanvasToggleControls;
-
 // The EDL arguments can be set to 0 if the canvas_w and canvas_h are used
 class Canvas
 {
 public:
-       Canvas(MWindow *mwindow,
-               BC_WindowBase *subwindow,
-               int x,
-               int y,
-               int w,
-               int h,
-               int output_w,
-               int output_h,
+       Canvas(MWindow *mwindow, BC_WindowBase *subwindow,
+               int x, int y, int w, int h,
+               int output_w, int output_h,
                int use_scrollbars);
        virtual ~Canvas();
 
        void reset();
 // Get dimensions given a zoom
        void calculate_sizes(float aspect_ratio,
-               int output_w,
-               int output_h,
-               float zoom,
-               int &w,
-               int &h);
+               int output_w, int output_h, float zoom,
+               int &w, int &h);
 // Lock access to the canvas pointer.
 // Must be called before get_canvas or locking the canvas.
        void lock_canvas(const char *location);
@@ -88,21 +72,23 @@ public:
        virtual void status_event() {};
 
 
-       virtual void reset_camera() {};
-       virtual void reset_projector() {};
-       virtual void zoom_resize_window(float percentage) {};
-       virtual void zoom_auto() {};
-       virtual int cursor_leave_event() { return 0; };
-       virtual int cursor_enter_event() { return 0; };
-       virtual int button_release_event() { return 0; };
+       virtual void reset_camera() {}
+       virtual void reset_projector() {}
+       virtual void camera_keyframe() {}
+       virtual void projector_keyframe() {}
+       virtual void zoom_resize_window(float percentage) {}
+       virtual void zoom_auto() {}
+       virtual int cursor_leave_event() { return 0; }
+       virtual int cursor_enter_event() { return 0; }
+       virtual int button_release_event() { return 0; }
        virtual int button_press_event();
-       virtual int cursor_motion_event() { return 0; };
+       virtual int cursor_motion_event() { return 0; }
        virtual int need_overlays() { return 1; }
-       virtual void draw_overlays() { };
-       virtual void toggle_controls() { } ;
-       virtual int get_cwindow_controls() { return 0; };
+       virtual void draw_overlays() {}
+       virtual void toggle_controls() {}
+       virtual int get_cwindow_controls() { return 0; }
        virtual int get_fullscreen() { return 0; }
-       virtual void set_fullscreen(int value) { };
+       virtual void set_fullscreen(int value) {}
 
        int cursor_leave_event_base(BC_WindowBase *caller);
        int cursor_enter_event_base(BC_WindowBase *caller);
@@ -335,6 +321,22 @@ public:
        CanvasToggleControls *toggle_controls;
 };
 
+class CanvasZoomSize : public BC_MenuItem
+{
+public:
+       CanvasZoomSize(Canvas *canvas);
+
+       Canvas *canvas;
+};
+
+class CanvasSizeSubMenu : public BC_SubMenu
+{
+public:
+       CanvasSizeSubMenu(CanvasZoomSize *zoom_size);
+
+       CanvasZoomSize *zoom_size;
+};
+
 class CanvasPopupSize : public BC_MenuItem
 {
 public:
@@ -369,6 +371,22 @@ public:
        Canvas *canvas;
 };
 
+class CanvasPopupCameraKeyframe : public BC_MenuItem
+{
+public:
+       CanvasPopupCameraKeyframe(Canvas *canvas);
+       int handle_event();
+       Canvas *canvas;
+};
+
+class CanvasPopupProjectorKeyframe : public BC_MenuItem
+{
+public:
+       CanvasPopupProjectorKeyframe(Canvas *canvas);
+       int handle_event();
+       Canvas *canvas;
+};
+
 class CanvasToggleControls : public BC_MenuItem
 {
 public:
index 4a275d3dd2cdcfb480d4356d07de78bc3dc947d3..899c8e0a6a1da7f62671479f7c9e229ead537fc6 100644 (file)
 #define CANVAS_INC
 
 class Canvas;
+class CanvasOutput;
+class CanvasFullScreen;
+class CanvasXScroll;
+class CanvasYScroll;
+class CanvasFullScreenPopup;
+class CanvasSubWindowItem;
+class CanvasPopup;
+class CanvasZoomSize;
+class CanvasSizeSubMenu;
+class CanvasPopupSize;
+class CanvasPopupAuto;
+class CanvasPopupResetCamera;
+class CanvasPopupResetProjector;
+class CanvasPopupCameraKeyframe;
+class CanvasPopupProjectorKeyframe;
+class CanvasToggleControls;
+class CanvasFullScreenItem;
+class CanvasPopupResetTranslation;
+class CanvasPopupRemoveSource;
 
 #endif
index 1611f7534342100a018fdf8a6ef338ba26b11981..7667690fa78eb235697e9cda713d630926e5d4d5 100644 (file)
@@ -145,24 +145,19 @@ Track* CWindow::calculate_affected_track()
 }
 
 Auto* CWindow::calculate_affected_auto(Autos *autos,
-       int create,
-       int *created,
-       int redraw)
+               int create, int *created, int redraw)
 {
        Auto* affected_auto = 0;
-       if(created) *created = 0;
+       if( created ) *created = 0;
 
-       if(create)
-       {
+       if( create ) {
                int total = autos->total();
-               affected_auto = autos->get_auto_for_editing();
+               affected_auto = autos->get_auto_for_editing(-1, create);
 
 // Got created
-               if(total != autos->total())
-               {
-                       if(created) *created = 1;
-                       if(redraw)
-                       {
+               if( total != autos->total() ) {
+                       if( created ) *created = 1;
+                       if( redraw ) {
 // May have to unlock CWindowGUI here.
                                mwindow->gui->lock_window("CWindow::calculate_affected_auto");
                                mwindow->gui->draw_overlays(1);
@@ -170,8 +165,7 @@ Auto* CWindow::calculate_affected_auto(Autos *autos,
                        }
                }
        }
-       else
-       {
+       else {
                affected_auto = autos->get_prev_auto(PLAY_FORWARD, affected_auto);
        }
 
@@ -180,39 +174,28 @@ Auto* CWindow::calculate_affected_auto(Autos *autos,
 
 
 
-void CWindow::calculate_affected_autos(FloatAuto **x_auto,
-       FloatAuto **y_auto,
-       FloatAuto **z_auto,
-       Track *track,
-       int use_camera,
-       int create_x,
-       int create_y,
-       int create_z)
+void CWindow::calculate_affected_autos(Track *track,
+               FloatAuto **x_auto, FloatAuto **y_auto, FloatAuto **z_auto,
+               int use_camera, int create_x, int create_y, int create_z,
+               int redraw)
 {
-       if(x_auto) (*x_auto) = 0;
-       if(y_auto) (*y_auto) = 0;
-       if(z_auto) (*z_auto) = 0;
-
-       if(!track) return;
-
-       if(use_camera)
-       {
-               if(x_auto) (*x_auto) = (FloatAuto*)calculate_affected_auto(
-                       track->automation->autos[AUTOMATION_CAMERA_X], create_x);
-               if(y_auto) (*y_auto) = (FloatAuto*)calculate_affected_auto(
-                       track->automation->autos[AUTOMATION_CAMERA_Y], create_y);
-               if(z_auto) (*z_auto) = (FloatAuto*)calculate_affected_auto(
-                       track->automation->autos[AUTOMATION_CAMERA_Z], create_z);
-       }
-       else
-       {
-               if(x_auto) (*x_auto) = (FloatAuto*)calculate_affected_auto(
-                       track->automation->autos[AUTOMATION_PROJECTOR_X], create_x);
-               if(y_auto) (*y_auto) = (FloatAuto*)calculate_affected_auto(
-                       track->automation->autos[AUTOMATION_PROJECTOR_Y], create_y);
-               if(z_auto) (*z_auto) = (FloatAuto*)calculate_affected_auto(
-                       track->automation->autos[AUTOMATION_PROJECTOR_Z], create_z);
-       }
+       if( x_auto ) *x_auto = 0;
+       if( y_auto ) *y_auto = 0;
+       if( z_auto ) *z_auto = 0;
+       if( !track ) return;
+
+       int ix = use_camera ? AUTOMATION_CAMERA_X : AUTOMATION_PROJECTOR_X, x_created = 0;
+       int iy = use_camera ? AUTOMATION_CAMERA_Y : AUTOMATION_PROJECTOR_Y, y_created = 0;
+       int iz = use_camera ? AUTOMATION_CAMERA_Z : AUTOMATION_PROJECTOR_Z, z_created = 0;
+
+       if( x_auto )
+               *x_auto = (FloatAuto*) calculate_affected_auto(track->automation->autos[ix],
+                               create_x, &x_created, redraw);
+       if( y_auto )
+               *y_auto = (FloatAuto*) calculate_affected_auto(track->automation->autos[iy],
+                               create_y, &y_created, redraw);
+       if( z_auto ) *z_auto = (FloatAuto*) calculate_affected_auto(track->automation->autos[iz],
+                               create_z, &z_created, redraw);
 }
 
 void CWindow::stop_playback(int wait)
index 28bfa9780f6afd4a216e2e4d0c24e8e310dfd428..e6a9b9448a572d9f57e3f5d5e72a13e7fd85bfca 100644 (file)
@@ -59,14 +59,10 @@ public:
                int *created = 0,
                int redraw = 1);
 // Same as before.  Provide 0 to Auto arguments to have them ignored.
-       void calculate_affected_autos(FloatAuto **x_auto,
-               FloatAuto **y_auto,
-               FloatAuto **z_auto,
-               Track *track,
-               int use_camera,
-               int create_x,
-               int create_y,
-               int create_z);
+       void calculate_affected_autos( Track *track,
+               FloatAuto **x_auto, FloatAuto **y_auto, FloatAuto **z_auto,
+               int use_camera, int create_x, int create_y, int create_z,
+               int redraw=1);
        void show_window();
        void hide_window();
        int update_position(double position);
index 610d4e7c9400d17540f7de5ba320afe85f6fad28..2150e061e6738a7aa7eddc2dd9fff892f08d1095 100644 (file)
@@ -609,8 +609,24 @@ int CWindowGUI::keypress_event()
                case KEY_F8:    cwindow_operation = CWINDOW_EYEDROP;    break;
                case KEY_F9:    cwindow_operation = CWINDOW_TOOL_WINDOW; break;
                case KEY_F10:   cwindow_operation = CWINDOW_TITLESAFE;  break;
-               case KEY_F11:   canvas->reset_camera();    result = 1;  break;
-               case KEY_F12:   canvas->reset_projector(); result = 1;  break;
+               }
+       }
+       if( !result && cwindow_operation < 0 && !ctrl_down() ) {
+               switch( get_keypress() ) {
+               case KEY_F11:
+                       if( !shift_down() )
+                               canvas->reset_camera();
+                       else
+                               canvas->camera_keyframe();
+                       result = 1;
+                       break;
+               case KEY_F12:
+                       if( !shift_down() )
+                               canvas->reset_projector();
+                       else
+                               canvas->projector_keyframe();
+                       result = 1;
+                       break;
                }
        }
 
@@ -2499,25 +2515,52 @@ void CWindowCanvas::draw_safe_regions()
        get_canvas()->set_opaque();
 }
 
-void CWindowCanvas::reset_keyframe(int do_camera)
-{
-       FloatAuto *x_keyframe = 0;
-       FloatAuto *y_keyframe = 0;
-       FloatAuto *z_keyframe = 0;
-       Track *affected_track = 0;
 
-       affected_track = gui->cwindow->calculate_affected_track();
+void CWindowCanvas::create_keyframe(int do_camera)
+{
+       Track *affected_track = gui->cwindow->calculate_affected_track();
+       if( affected_track ) {
+               double pos = mwindow->edl->local_session->get_selectionstart(1);
+               int64_t position = affected_track->to_units(pos, 0);
+               int ix = do_camera ? AUTOMATION_CAMERA_X : AUTOMATION_PROJECTOR_X;
+               int iy = do_camera ? AUTOMATION_CAMERA_Y : AUTOMATION_PROJECTOR_Y;
+               int iz = do_camera ? AUTOMATION_CAMERA_Z : AUTOMATION_PROJECTOR_Z;
+               FloatAuto *prev, *next;
+               FloatAutos **autos = (FloatAutos**)affected_track->automation->autos;
+               FloatAutos *x_autos = autos[ix];  prev = 0;  next = 0;
+               float x_value = x_autos->get_value(position, PLAY_FORWARD, prev, next);
+               FloatAutos *y_autos = autos[iy];  prev = 0;  next = 0;
+               float y_value = y_autos->get_value(position, PLAY_FORWARD, prev, next);
+               FloatAutos *z_autos = autos[iz];  prev = 0;  next = 0;
+               float z_value = z_autos->get_value(position, PLAY_FORWARD, prev, next);
+               FloatAuto *x_keyframe = 0, *y_keyframe = 0, *z_keyframe = 0;
+
+               gui->cwindow->calculate_affected_autos(affected_track,
+                       &x_keyframe, &y_keyframe, &z_keyframe,
+                       do_camera, -1, -1, -1, 0);
+               x_keyframe->set_value(x_value);
+               y_keyframe->set_value(y_value);
+               z_keyframe->set_value(z_value);
 
-       if(affected_track)
-       {
-               gui->cwindow->calculate_affected_autos(&x_keyframe,
-                       &y_keyframe,
-                       &z_keyframe,
-                       affected_track,
-                       do_camera,
-                       1,
-                       1,
-                       1);
+               mwindow->sync_parameters(CHANGE_PARAMS);
+               gui->update_tool();
+               mwindow->gui->lock_window("CWindow::camera_keyframe");
+               mwindow->gui->draw_overlays(1);
+               mwindow->gui->unlock_window();
+       }
+}
+
+void CWindowCanvas::camera_keyframe() { create_keyframe(1); }
+void CWindowCanvas::projector_keyframe() { create_keyframe(0); }
+
+void CWindowCanvas::reset_keyframe(int do_camera)
+{
+       Track *affected_track = gui->cwindow->calculate_affected_track();
+       if( affected_track ) {
+               FloatAuto *x_keyframe = 0, *y_keyframe = 0, *z_keyframe = 0;
+               gui->cwindow->calculate_affected_autos(affected_track,
+                       &x_keyframe, &y_keyframe, &z_keyframe,
+                       do_camera, 1, 1, 1);
 
                x_keyframe->set_value(0);
                y_keyframe->set_value(0);
@@ -2525,18 +2568,15 @@ void CWindowCanvas::reset_keyframe(int do_camera)
 
                mwindow->sync_parameters(CHANGE_PARAMS);
                gui->update_tool();
+               mwindow->gui->lock_window("CWindow::camera_keyframe");
+               mwindow->gui->draw_overlays(1);
+               mwindow->gui->unlock_window();
        }
 }
 
-void CWindowCanvas::reset_camera()
-{
-       reset_keyframe(1);
-}
+void CWindowCanvas::reset_camera() { reset_keyframe(1); }
+void CWindowCanvas::reset_projector() { reset_keyframe(0); }
 
-void CWindowCanvas::reset_projector()
-{
-       reset_keyframe(0);
-}
 
 int CWindowCanvas::test_crop(int button_press, int &redraw)
 {
index 0e120c8b64907673672f2780cbfcb8a8402ddcbf..ff323cfc910c7782ae04fc663e6f2dc0d9e5bb90 100644 (file)
@@ -303,9 +303,12 @@ public:
                int do_camera);
        int do_ruler(int draw, int motion, int button_press, int button_release);
        int test_zoom(int &redraw);
+       void create_keyframe(int do_camera);
+       void camera_keyframe();
+       void projector_keyframe();
+       void reset_keyframe(int do_camera);
        void reset_camera();
        void reset_projector();
-       void reset_keyframe(int do_camera);
        void draw_crophandle(int x, int y);
        void zoom_auto();
 
index f0f372a5aba2f82315f2ee38d7a232af060e21a8..5f7c41657874cf49379e8c354164fb0db2987c5f 100644 (file)
@@ -696,16 +696,14 @@ void CWindowCurveToggle::check_toggle_state(FloatAuto *x, FloatAuto *y, FloatAut
 
 int CWindowCurveToggle::handle_event()
 {
-       FloatAuto *x=0, *y=0, *z=0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-
-       if(track)
-       {       mwindow->cwindow->calculate_affected_autos(&x, &y, &z,
-                       track, cfg.use_camera, 0,0,0); // don't create new keyframe
-
-               if(x)   x->change_curve_mode(cfg.mode);
-               if(y)   y->change_curve_mode(cfg.mode);
-               if(z)   z->change_curve_mode(cfg.mode);
+       if(track) {
+               FloatAuto *x=0, *y=0, *z=0;
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x, &y, &z, cfg.use_camera, 0,0,0); // don't create new keyframe
+               if( x ) x->change_curve_mode(cfg.mode);
+               if( y ) y->change_curve_mode(cfg.mode);
+               if( z ) z->change_curve_mode(cfg.mode);
 
                gui->update();
                gui->update_preview();
@@ -748,17 +746,14 @@ void CWindowCameraGUI::create_objects()
 {
        int x = 10, y = 10, x1;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       FloatAuto *x_auto = 0;
-       FloatAuto *y_auto = 0;
-       FloatAuto *z_auto = 0;
+       FloatAuto *x_auto = 0, *y_auto = 0, *z_auto = 0;
        BC_Title *title;
        BC_Button *button;
 
        lock_window("CWindowCameraGUI::create_objects");
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       &y_auto, &z_auto, track, 1, 0, 0, 0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, &y_auto, &z_auto, 1, 0, 0, 0);
        }
 
        add_subwindow(title = new BC_Title(x, y, "X:"));
@@ -893,17 +888,9 @@ void CWindowCameraGUI::update()
        FloatAuto *y_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       1,
-                       0,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, &y_auto, &z_auto, 1, 0, 0, 0);
        }
 
        if(x_auto)
@@ -940,16 +927,9 @@ int CWindowCameraLeft::handle_event()
        FloatAuto *x_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       0,
-                       &z_auto,
-                       track,
-                       1,
-                       1,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, 0, &z_auto, 1, 1, 0, 0);
        }
 
        if(x_auto && z_auto)
@@ -1017,16 +997,9 @@ int CWindowCameraRight::handle_event()
        FloatAuto *x_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       0,
-                       &z_auto,
-                       track,
-                       1,
-                       1,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, 0, &z_auto, 1, 1, 0, 0);
        }
 
        if(x_auto && z_auto)
@@ -1064,16 +1037,9 @@ int CWindowCameraTop::handle_event()
        FloatAuto *y_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(0,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       1,
-                       0,
-                       1,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       0, &y_auto, &z_auto, 1, 0, 1, 0);
        }
 
        if(y_auto && z_auto)
@@ -1139,16 +1105,9 @@ int CWindowCameraBottom::handle_event()
        FloatAuto *y_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(0,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       1,
-                       0,
-                       1,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       0, &y_auto, &z_auto, 1, 0, 1, 0);
        }
 
        if(y_auto && z_auto)
@@ -1196,16 +1155,9 @@ void CWindowProjectorGUI::create_objects()
        BC_Button *button;
 
        lock_window("CWindowProjectorGUI::create_objects");
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       0,
-                       0,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, &y_auto, &z_auto, 0, 0, 0, 0);
        }
 
        add_subwindow(title = new BC_Title(x, y, "X:"));
@@ -1337,17 +1289,9 @@ void CWindowProjectorGUI::update()
        FloatAuto *y_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       0,
-                       0,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, &y_auto, &z_auto, 0, 0, 0, 0);
        }
 
        if(x_auto)
@@ -1381,16 +1325,9 @@ int CWindowProjectorLeft::handle_event()
        FloatAuto *x_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       0,
-                       &z_auto,
-                       track,
-                       0,
-                       1,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, 0, &z_auto, 0, 1, 0, 0);
        }
        if(x_auto && z_auto)
        {
@@ -1447,16 +1384,9 @@ int CWindowProjectorRight::handle_event()
        FloatAuto *x_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(&x_auto,
-                       0,
-                       &z_auto,
-                       track,
-                       0,
-                       1,
-                       0,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       &x_auto, 0, &z_auto, 0, 1, 0, 0);
        }
 
        if(x_auto && z_auto)
@@ -1485,16 +1415,9 @@ int CWindowProjectorTop::handle_event()
        FloatAuto *y_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(0,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       0,
-                       0,
-                       1,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       0, &y_auto, &z_auto, 0, 0, 1, 0);
        }
 
        if(y_auto && z_auto)
@@ -1551,16 +1474,9 @@ int CWindowProjectorBottom::handle_event()
        FloatAuto *y_auto = 0;
        FloatAuto *z_auto = 0;
        Track *track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
-               mwindow->cwindow->calculate_affected_autos(0,
-                       &y_auto,
-                       &z_auto,
-                       track,
-                       0,
-                       0,
-                       1,
-                       0);
+       if( track ) {
+               mwindow->cwindow->calculate_affected_autos(track,
+                       0, &y_auto, &z_auto, 0, 0, 1, 0);
        }
 
        if(y_auto && z_auto)
index d35e9bd49ba30512511f7a1d26f8028f8e6f5abd..65dc0e3b1c59e41716794e63597f84fc2d002486 100644 (file)
@@ -279,38 +279,22 @@ int FileJPEG::read_header(FILE *fp, int &w, int &h)
 
 int FileJPEG::read_frame(VFrame *output, VFrame *input)
 {
-       if(input->get_compressed_size() < 2 ||
-               input->get_data()[0] != 0xff ||
-               input->get_data()[1] != 0xd8)
+       if( input->get_compressed_size() < 2 ||
+           input->get_data()[0] != 0xff ||
+           input->get_data()[1] != 0xd8 )
                return 1;
 
-       if(!decompressor) decompressor = mjpeg_new(asset->width,
-               asset->height,
-               1);
-// printf("FileJPEG::read_frame %d %p %d %d %d %p %p %p %p %d\n",
-// __LINE__,
-// input->get_data(),
-// input->get_compressed_size(),
-// output->get_w(),
-// output->get_h(),
-// output->get_rows(),
-// output->get_y(),
-// output->get_u(),
-// output->get_v(),
+       if( !decompressor )
+               decompressor = mjpeg_new(asset->width, asset->height, 1);
+// printf("FileJPEG::read_frame %d %p %d %d %d %p %p %p %p %d\n", __LINE__,
+// input->get_data(), input->get_compressed_size(), output->get_w(), output->get_h(),
+// output->get_rows(), output->get_y(), output->get_u(), output->get_v(),
 // output->get_color_model());
-       mjpeg_decompress((mjpeg_t*)decompressor,
-               input->get_data(),
-               input->get_compressed_size(),
-               0,
-               output->get_rows(),
-               output->get_y(),
-               output->get_u(),
-               output->get_v(),
-               output->get_color_model(),
-               1);
-//     PRINT_TRACE
-
+       mjpeg_decompress((mjpeg_t*)decompressor, input->get_data(), input->get_compressed_size(), 0,
+               output->get_rows(), output->get_y(), output->get_u(), output->get_v(),
+               output->get_color_model(), 1);
 //printf("FileJPEG::read_frame %d\n", __LINE__);
+//
        return 0;
 }
 
index dd78cf5726deeeb9924fb46b968bee5a70f40878..d04ee5ab30d08e7d8431546ab40bf5bc9a571dfc 100644 (file)
@@ -352,49 +352,51 @@ int FileList::read_frame(VFrame *frame)
                asset->single_frame = 1;
 // Allocate and decompress single frame into new temporary
 //printf("FileList::read_frame %d\n", frame->get_color_model());
-               if(!temp || temp->get_color_model() != frame->get_color_model())
-               {
-                       if(temp) delete temp;
-                       temp = 0;
-
-
-                       if(!use_path() || frame->get_color_model() == BC_COMPRESSED)
-                       {
+               if( !temp || temp->get_color_model() != frame->get_color_model() ) {
+                       delete temp;  temp = 0;
+                       int aw = asset->actual_width, ah = asset->actual_height;
+                       int color_model = frame->get_color_model();
+                       switch( color_model ) {
+                       case BC_YUV420P:
+                       case BC_YUV420PI:
+                       case BC_YUV422P:
+                               aw = (aw+1) & ~1;  ah = (ah+1) & ~1;
+                               break;
+                       case BC_YUV410P:
+                       case BC_YUV411P:
+                               aw = (aw+3) & ~3;  ah = (ah+3) & ~3;
+                               break;
+                       }
+                       if( !use_path() || color_model == BC_COMPRESSED ) {
                                FILE *fd = fopen(asset->path, "rb");
-                               if(fd)
-                               {
+                               if( fd ) {
                                        struct stat ostat;
                                        stat(asset->path, &ostat);
 
-                                       switch(frame->get_color_model())
-                                       {
-                                               case BC_COMPRESSED:
-                                                       frame->allocate_compressed_data(ostat.st_size);
-                                                       frame->set_compressed_size(ostat.st_size);
-                                                       (void)fread(frame->get_data(), ostat.st_size, 1, fd);
-                                                       break;
-                                               default:
-                                                       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->actual_width, asset->actual_height,
-                                                                       frame->get_color_model(), 0);
-                                                       read_frame(temp, data);
-                                                       break;
+                                       switch(frame->get_color_model()) {
+                                       case BC_COMPRESSED:
+                                               frame->allocate_compressed_data(ostat.st_size);
+                                               frame->set_compressed_size(ostat.st_size);
+                                               (void)fread(frame->get_data(), ostat.st_size, 1, fd);
+                                               break;
+                                       default:
+                                               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(aw, ah, color_model);
+                                               read_frame(temp, data);
+                                               break;
                                        }
 
                                        fclose(fd);
                                }
-                               else
-                               {
+                               else {
                                        eprintf(_("Error while opening \"%s\" for reading. \n%m\n"), asset->path);
                                        result = 1;
                                }
                        }
-                       else
-                       {
-                               temp = new VFrame(asset->actual_width, asset->actual_height,
-                                       frame->get_color_model(), 0);
+                       else {
+                               temp = new VFrame(aw, ah, color_model);
                                read_frame(temp, asset->path);
                        }
                }
index f2df6ddc4631c0a002a817941126acca66c67af1..6e71b0c0cde151062a137d5d3fd0910eb417c0d7 100644 (file)
@@ -1077,27 +1077,13 @@ int mjpeg_compress(mjpeg_t *mjpeg,
  * printf("mjpeg_compress %d %d %d %d\n",
  * mjpeg->output_w, mjpeg->output_h, mjpeg->coded_w, mjpeg->coded_h);
  */
-               BC_CModels::transfer(0,
-                       row_pointers,
-                       mjpeg->temp_rows[0][0],
-                       mjpeg->temp_rows[1][0],
-                       mjpeg->temp_rows[2][0],
-                       y_plane,
-                       u_plane,
-                       v_plane,
-                       0,
-                       0,
-                       mjpeg->output_w,
-                       mjpeg->output_h,
-                       0,
-                       0,
-                       mjpeg->output_w,
-                       mjpeg->output_h,
-                       mjpeg->color_model,
-                       mjpeg->jpeg_color_model,
-                       0,
-                       mjpeg->output_w,
-                       mjpeg->coded_w);
+               BC_CModels::transfer(0, row_pointers,
+                       mjpeg->temp_rows[0][0], mjpeg->temp_rows[1][0], mjpeg->temp_rows[2][0],
+                       y_plane, u_plane, v_plane,
+                       0, 0, mjpeg->output_w, mjpeg->output_h,
+                       0, 0, mjpeg->output_w, mjpeg->output_h,
+                       mjpeg->color_model, mjpeg->jpeg_color_model, 0,
+                       mjpeg->output_w, mjpeg->coded_w);
        }
 
 /* Start the compressors on the image fields */
@@ -1245,27 +1231,12 @@ int mjpeg_decompress(mjpeg_t *mjpeg,
  * mjpeg->color_model);
  */
 
-               BC_CModels::transfer(row_pointers,
-                       0,
-                       y_plane,
-                       u_plane,
-                       v_plane,
-                       y_in,
-                       u_in,
-                       v_in,
-                       0,
-                       0,
-                       mjpeg->output_w,
-                       mjpeg->output_h,
-                       0,
-                       0,
-                       mjpeg->output_w,
-                       mjpeg->output_h,
-                       mjpeg->jpeg_color_model,
-                       mjpeg->color_model,
-                       0,
-                       mjpeg->coded_w,
-                       mjpeg->rowspan ? mjpeg->rowspan : mjpeg->output_w);
+               BC_CModels::transfer(row_pointers, 0,
+                       y_plane, u_plane, v_plane, y_in, u_in, v_in,
+                       0, 0, mjpeg->output_w, mjpeg->output_h,
+                       0, 0, mjpeg->output_w, mjpeg->output_h,
+                       mjpeg->jpeg_color_model, mjpeg->color_model, 0,
+                       mjpeg->coded_w, mjpeg->rowspan ? mjpeg->rowspan : mjpeg->output_w);
 //printf("mjpeg_decompress 8\n");
        }
        return 0;
diff --git a/cinelerra-5.1/cinelerra/shudmp.C b/cinelerra-5.1/cinelerra/shudmp.C
new file mode 100644 (file)
index 0000000..fbb85cf
--- /dev/null
@@ -0,0 +1,77 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <error.h>
+#include <signal.h>
+
+#include <libusb-1.0/libusb.h>
+
+#define SHUTTLE_INTERFACE 0
+
+libusb_device_handle *devsh = 0;
+int claimed = -1;
+
+void usb_done()
+{
+       if( devsh ) {
+               if( claimed > 0 ) {
+                       int sh_iface = SHUTTLE_INTERFACE;
+                       libusb_release_interface(devsh, sh_iface);
+                       libusb_attach_kernel_driver(devsh, sh_iface);
+                       claimed = 0;
+               }
+               libusb_close(devsh);
+               devsh = 0;
+       }
+       if( claimed >= 0 ) {
+               libusb_exit(0);
+               claimed = -1;
+       }
+}
+
+void usb_probe()
+{
+       int ret = libusb_init(0);
+       if( ret < 0 ) return;
+       claimed = 0;
+       devsh = libusb_open_device_with_vid_pid(0, 0x0b33, 0x0030);
+       if( devsh ) {
+               int sh_iface = SHUTTLE_INTERFACE;
+               libusb_detach_kernel_driver(devsh, sh_iface);
+               ret = libusb_claim_interface(devsh, sh_iface);
+               if( ret >= 0 ) claimed = 1;
+       }
+       if( !claimed )
+               usb_done();
+}
+
+int done = 0;
+void sigint(int n) { done = 1; }
+
+int main(int ac, char **av)
+{
+       setbuf(stdout, 0);
+       usb_probe();
+       if( claimed > 0 ) {
+               signal(SIGINT, sigint);
+               while( !done ) {
+                       int len = 0;
+                       static const int IN_ENDPOINT = 0x81;
+                       unsigned char dat[64];
+                       int ret = libusb_interrupt_transfer(devsh,
+                                       IN_ENDPOINT, dat, sizeof(dat), &len, 100);
+                       if( ret != 0 ) {
+                               if( ret == LIBUSB_ERROR_TIMEOUT ) continue;
+                               printf("error: %s\n", libusb_strerror((libusb_error)ret));
+                               sleep(1);  continue;
+                       }
+                       printf("shuttle: ");
+                       for( int i=0; i<len; ++i ) printf(" %02x", dat[i]);
+                       printf("\n");
+               }
+       }
+       usb_done();
+       return 0;
+}
+