Commit ff1fa2fd authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Reintroduce extract clip zone to cut a clip whithout re-encoding

Fixes #237
CCBUG: 408402
parent 969c699c
Pipeline #5132 passed with stage
in 24 minutes and 19 seconds
......@@ -10,7 +10,7 @@ set(kdenlive_SRCS
# jobs/cutclipjob.cpp
This diff is collapsed.
......@@ -23,51 +23,45 @@
#include "abstractclipjob.h"
class ProjectClip;
* @class CutClipJob
* @brief This job class will either transcode or render a part of a clip through FFmpeg or LibAV
class JobManager;
class CutClipJob : public AbstractClipJob
/** @brief Creates the Job.
* @param cType the Clip Type (AV, PLAYLIST, AUDIO, ...) as defined in definitions.h. Some jobs will act differently depending on clip type
* @param id the id of the clip that requested this clip job
* @param parameters StringList that should contain: destination file << source file << in point (optional) << out point (optional)
* */
CutClipJob(ClipType cType, const QString &id, const QStringList &parameters);
virtual ~CutClipJob();
const QString destination() const override;
void startJob() override;
stringMap cancelProperties() override;
const QString statusMessage() override;
bool isExclusive() override;
static QHash<ProjectClip *, AbstractClipJob *> prepareTranscodeJob(double fps, const QList<ProjectClip *> &ids, const QStringList &parameters);
static QHash<ProjectClip *, AbstractClipJob *> prepareCutClipJob(double fps, double originalFps, ProjectClip *clip);
static QHash<ProjectClip *, AbstractClipJob *> prepareAnalyseJob(double fps, const QList<ProjectClip *> &clips, const QStringList &parameters);
static QList<ProjectClip *> filterClips(const QList<ProjectClip *> &clips, const QStringList &params);
/** @brief Extract part of a clip with ffmpeg whithout re-encoding
CutClipJob(const QString &binId, const QString sourcePath, GenTime inTime, GenTime outTime, const QString destPath, QStringList encodingParams);
QString m_dest;
QString m_src;
QString m_start;
QString m_end;
QString m_cutExtraParams;
int m_jobDuration;
// This is a special function that prepares the stabilize job for a given list of clips.
// Namely, it displays the required UI to configure the job and call startJob with the right set of parameters
bool startJob() override;
// Then the job is automatically put in queue. Its id is returned
static int prepareJob(const std::shared_ptr<JobManager> &ptr, const std::vector<QString> &binIds, int parentId, QString undoString, GenTime inTime, GenTime outTime);
void processLogInfo() override;
void analyseLogInfo();
void processAnalyseLog();
bool commitResult(Fun &undo, Fun &redo) override;
const QString getDescription() const override;
/** @brief When user requested a to process an Mlt::Filter, this will send back all necessary infos. */
void gotFilterJobResults(const QString &id, int startPos, int track, const stringMap &result, const stringMap &extra);
private slots:
void processLogInfo();
QString m_sourceUrl;
QString m_destUrl;
bool m_done;
GenTime m_in;
GenTime m_out;
QStringList m_encodingParams;
int m_jobDuration;
......@@ -138,7 +138,7 @@ int SpeedJob::prepareJob(const std::shared_ptr<JobManager> &ptr, const std::vect
// Filter several clips, destination points to a folder
if (QFile::exists(mltfile)) {
KIO::RenameDialog renameDialog(qApp->activeWindow(), QString(), /*i18n("File already exists"), */QUrl::fromLocalFile(mltfile), QUrl::fromLocalFile(mltfile), KIO::RenameDialog_Option::RenameDialog_Overwrite );
KIO::RenameDialog renameDialog(qApp->activeWindow(), i18n("File already exists"), QUrl::fromLocalFile(mltfile), QUrl::fromLocalFile(mltfile), KIO::RenameDialog_Option::RenameDialog_Overwrite );
if (renameDialog.exec() != QDialog::Rejected) {
QUrl final = renameDialog.newDestUrl();
if (final.isValid()) {
......@@ -259,9 +259,6 @@ void MainWindow::init()
connect(m_projectList, SIGNAL(refreshClip(QString,bool)), pCore->monitorManager(), SLOT(slotRefreshCurrentMonitor(QString)));
connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_projectList, SLOT(slotUpdateClipCut(QPoint)));*/
// TODO refac : reimplement ?
// connect(m_clipMonitor, &Monitor::extractZone, pCore->bin(), &Bin::slotStartCutJob);
connect(m_clipMonitor, &Monitor::passKeyPress, this, &MainWindow::triggerKey);
m_projectMonitor = new Monitor(Kdenlive::ProjectMonitor, pCore->monitorManager(), this);
......@@ -34,6 +34,8 @@
#include "project/projectmanager.h"
#include "qmlmanager.h"
#include "recmanager.h"
#include "jobs/jobmanager.h"
#include "jobs/cutclipjob.h"
#include "scopes/monitoraudiolevel.h"
#include "timeline2/model/snapmodel.hpp"
#include "transitions/transitionsrepository.hpp"
......@@ -1005,7 +1007,9 @@ void Monitor::slotExtractCurrentZone()
if (m_controller == nullptr) {
emit extractZone(m_controller->AbstractProjectItem::clipId());
GenTime inPoint(getZoneStart(), pCore->getCurrentFps());
GenTime outPoint(getZoneEnd(), pCore->getCurrentFps());
pCore->jobManager()->startJob<CutClipJob>({m_controller->clipId()}, -1, QString(), inPoint, outPoint);
std::shared_ptr<ProjectClip> Monitor::currentController() const
......@@ -338,8 +338,6 @@ signals:
/** @brief Editing transitions / effects over the monitor requires the renderer to send frames as QImage.
* This causes a major slowdown, so we only enable it if required */
void requestFrameForAnalysis(bool);
/** @brief Request a zone extraction (ffmpeg transcoding). */
void extractZone(const QString &id);
void effectChanged(const QRect &);
void effectPointsChanged(const QVariantList &);
void addRemoveKeyframe();
......@@ -6,8 +6,8 @@
<property name="windowTitle">
......@@ -39,15 +39,24 @@
<item row="1" column="0">
<widget class="QLabel" name="destination_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<property name="text">
<string>Save to</string>
<item row="1" column="1" colspan="3">
<widget class="KUrlRequester" name="file_url">
<property name="mode">
<widget class="KUrlRequester" name="file_url" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
......@@ -135,5 +144,21 @@
<hint type="sourcelabel">
<hint type="destinationlabel">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment