shdmp: shdmp.C
@g++ $(CFLAGS) shdmp.C -o $@
+shudmp: shudmp.C
+ @g++ $(CFLAGS) shudmp.C -o $@ -lusb-1.0
clean:
rm -rf $(OBJDIR)
}
-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);
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);
// 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
{
}
+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()
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));
}
CanvasPopupResetCamera::CanvasPopupResetCamera(Canvas *canvas)
- : BC_MenuItem(_("Reset camera"), "F11", KEY_F11)
+ : BC_MenuItem(_("Reset camera"), _("F11"), KEY_F11)
{
this->canvas = canvas;
}
return 1;
}
-
-
CanvasPopupResetProjector::CanvasPopupResetProjector(Canvas *canvas)
- : BC_MenuItem(_("Reset projector"), "F12", KEY_F12)
+ : BC_MenuItem(_("Reset projector"), _("F12"), KEY_F12)
{
this->canvas = canvas;
}
}
+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"))
#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);
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);
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:
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:
#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
}
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);
}
}
}
- else
- {
+ else {
affected_auto = autos->get_prev_auto(PLAY_FORWARD, affected_auto);
}
-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)
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);
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;
}
}
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);
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)
{
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();
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();
{
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:"));
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)
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)
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)
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)
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)
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:"));
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)
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)
{
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)
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)
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)
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;
}
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);
}
}
* 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 */
* 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;
--- /dev/null
+#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;
+}
+