1 /***************************************************************************
2 * Copyright (C) 2011 by Till Theato (root@ttill.de) *
3 * This file is part of Kdenlive (www.kdenlive.org). *
5 * Kdenlive is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Kdenlive is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Kdenlive. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
22 #include "definitions.h"
23 #include "beziercurve/bpoint.h"
31 class SimpleKeyframeWidget;
37 /** @brief Adjusts keyframes after resizing a clip. */
38 bool adjustRotoDuration(QString *data, int in, int out);
40 class RotoWidget : public QWidget
45 RotoWidget(QString data, Monitor *monitor, ItemInfo info, Timecode t, QWidget* parent = 0);
46 virtual ~RotoWidget();
48 /** @brief Returns the spline(s) in the JSON format used by filter_rotoscoping (MLT). */
51 /** @brief Replaces current data with \param spline (JSON). */
52 void setSpline(QString spline, bool notify = true);
54 /** @brief Passed on to the keyframe timeline. Switches between frames and hh:mm:ss:ff timecode. */
55 void updateTimecodeFormat();
58 /** @brief Switches from normal monitor to monitor scene according to @param show. */
59 void slotShowScene(bool show = true);
60 /** @brief Updates the on-monitor item. */
61 void slotSyncPosition(int relTimelinePos);
65 void checkMonitorPosition(int);
66 void seekToPos(int pos);
70 SimpleKeyframeWidget *m_keyframeWidget;
72 MonitorScene *m_scene;
78 Mlt::Filter *m_filter;
80 /** @brief Returns the list of cubic Bézier points that form the spline at position @param keyframe.
81 * The points are brought from the range [0, 1] into project resolution space.
82 * This function does not do any interpolation and therfore will only return a list when a keyframe at the given postion exists.
83 * Set @param keyframe to -1 if only one keyframe currently exists. */
84 QList <BPoint> getPoints(int keyframe);
86 /** @brief Adds tracking_finished as listener for "tracking-finished" event in MLT rotoscoping filter. */
87 void setupTrackingListen(ItemInfo info);
89 /** @brief Passes list of keyframe positions to keyframe timeline widget. */
90 void keyframeTimelineFullUpdate();
93 /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
94 * @param renderPos Postion of the Monitor / Timeline cursor */
95 void slotCheckMonitorPosition(int renderPos);
97 /** @brief Updates/Creates the spline at @param pos based on the on-monitor items. */
98 void slotUpdateData(int pos = -1, bool editing = false);
99 /** @brief Updates/Creates the spline at the current timeline position based on the on-monitor items. */
100 void slotUpdateData(bool editing);
102 /** @brief Updates the on-monitor items to fit the spline at position @param pos. */
103 void slotPositionChanged(int pos, bool seek = true);
105 void slotAddKeyframe(int pos = -1);
106 void slotRemoveKeyframe(int pos = -1);
107 void slotMoveKeyframe(int oldPos, int newPos);