Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
256
Issues
256
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
fb82eabe
Commit
fb82eabe
authored
Feb 07, 2020
by
Vincent Pinon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate OTIO convertions
parent
3d26bd55
Pipeline
#14717
passed with stage
in 16 minutes and 40 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
213 additions
and
0 deletions
+213
-0
src/kdenliveui.rc
src/kdenliveui.rc
+2
-0
src/mainwindow.cpp
src/mainwindow.cpp
+11
-0
src/mainwindow.h
src/mainwindow.h
+2
-0
src/utils/CMakeLists.txt
src/utils/CMakeLists.txt
+1
-0
src/utils/otioconvertions.cpp
src/utils/otioconvertions.cpp
+145
-0
src/utils/otioconvertions.h
src/utils/otioconvertions.h
+52
-0
No files found.
src/kdenliveui.rc
View file @
fb82eabe
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
<Menu
name=
"file"
>
<Menu
name=
"file"
>
<Action
name=
"dvd_wizard"
/>
<Action
name=
"dvd_wizard"
/>
<Action
name=
"transcode_clip"
/>
<Action
name=
"transcode_clip"
/>
<Action
name=
"export_project"
/>
<Action
name=
"import_project"
/>
</Menu>
</Menu>
<Menu
name=
"edit"
>
<Menu
name=
"edit"
>
<Action
name=
"paste_effects"
/>
<Action
name=
"paste_effects"
/>
...
...
src/mainwindow.cpp
View file @
fb82eabe
...
@@ -64,6 +64,7 @@
...
@@ -64,6 +64,7 @@
#include "transitions/transitionsrepository.hpp"
#include "transitions/transitionsrepository.hpp"
#include "utils/resourcewidget.h"
#include "utils/resourcewidget.h"
#include "utils/thememanager.h"
#include "utils/thememanager.h"
#include "utils/otioconvertions.h"
#include "profiles/profilerepository.hpp"
#include "profiles/profilerepository.hpp"
#include "widgets/progressbutton.h"
#include "widgets/progressbutton.h"
...
@@ -428,6 +429,7 @@ void MainWindow::init()
...
@@ -428,6 +429,7 @@ void MainWindow::init()
new
HideTitleBars
(
this
);
new
HideTitleBars
(
this
);
m_extraFactory
=
new
KXMLGUIClient
(
this
);
m_extraFactory
=
new
KXMLGUIClient
(
this
);
buildDynamicActions
();
buildDynamicActions
();
m_otioConvertions
.
getOtioConverters
();
// Create Effect Basket (dropdown list of favorites)
// Create Effect Basket (dropdown list of favorites)
m_effectBasket
=
new
EffectBasket
(
this
);
m_effectBasket
=
new
EffectBasket
(
this
);
...
@@ -1291,6 +1293,15 @@ void MainWindow::setupActions()
...
@@ -1291,6 +1293,15 @@ void MainWindow::setupActions()
addAction
(
QStringLiteral
(
"dvd_wizard"
),
i18n
(
"DVD Wizard"
),
this
,
SLOT
(
slotDvdWizard
()),
QIcon
::
fromTheme
(
QStringLiteral
(
"media-optical"
)));
addAction
(
QStringLiteral
(
"dvd_wizard"
),
i18n
(
"DVD Wizard"
),
this
,
SLOT
(
slotDvdWizard
()),
QIcon
::
fromTheme
(
QStringLiteral
(
"media-optical"
)));
addAction
(
QStringLiteral
(
"transcode_clip"
),
i18n
(
"Transcode Clips"
),
this
,
SLOT
(
slotTranscodeClip
()),
QIcon
::
fromTheme
(
QStringLiteral
(
"edit-copy"
)));
addAction
(
QStringLiteral
(
"transcode_clip"
),
i18n
(
"Transcode Clips"
),
this
,
SLOT
(
slotTranscodeClip
()),
QIcon
::
fromTheme
(
QStringLiteral
(
"edit-copy"
)));
QAction
*
exportAction
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-export"
)),
i18n
(
"E&xport project"
),
this
);
connect
(
exportAction
,
&
QAction
::
triggered
,
&
m_otioConvertions
,
&
OtioConvertions
::
slotExportProject
);
exportAction
->
setEnabled
(
false
);
addAction
(
QStringLiteral
(
"export_project"
),
exportAction
);
QAction
*
importAction
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-import"
)),
i18n
(
"&Import project"
),
this
);
connect
(
importAction
,
&
QAction
::
triggered
,
&
m_otioConvertions
,
&
OtioConvertions
::
slotImportProject
);
importAction
->
setEnabled
(
false
);
addAction
(
QStringLiteral
(
"import_project"
),
importAction
);
addAction
(
QStringLiteral
(
"archive_project"
),
i18n
(
"Archive Project"
),
this
,
SLOT
(
slotArchiveProject
()),
addAction
(
QStringLiteral
(
"archive_project"
),
i18n
(
"Archive Project"
),
this
,
SLOT
(
slotArchiveProject
()),
QIcon
::
fromTheme
(
QStringLiteral
(
"document-save-all"
)));
QIcon
::
fromTheme
(
QStringLiteral
(
"document-save-all"
)));
addAction
(
QStringLiteral
(
"switch_monitor"
),
i18n
(
"Switch monitor"
),
this
,
SLOT
(
slotSwitchMonitors
()),
QIcon
(),
Qt
::
Key_T
);
addAction
(
QStringLiteral
(
"switch_monitor"
),
i18n
(
"Switch monitor"
),
this
,
SLOT
(
slotSwitchMonitors
()),
QIcon
(),
Qt
::
Key_T
);
...
...
src/mainwindow.h
View file @
fb82eabe
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
#include "kdenlive_debug.h"
#include "kdenlive_debug.h"
#include "kdenlivecore_export.h"
#include "kdenlivecore_export.h"
#include "statusbarmessagelabel.h"
#include "statusbarmessagelabel.h"
#include "utils/otioconvertions.h"
class
AssetPanel
;
class
AssetPanel
;
class
AudioGraphSpectrum
;
class
AudioGraphSpectrum
;
...
@@ -153,6 +154,7 @@ private:
...
@@ -153,6 +154,7 @@ private:
/** @brief Sets up all the actions and attaches them to the collection. */
/** @brief Sets up all the actions and attaches them to the collection. */
void
setupActions
();
void
setupActions
();
OtioConvertions
m_otioConvertions
;
KColorSchemeManager
*
m_colorschemes
;
KColorSchemeManager
*
m_colorschemes
;
QDockWidget
*
m_projectBinDock
;
QDockWidget
*
m_projectBinDock
;
...
...
src/utils/CMakeLists.txt
View file @
fb82eabe
...
@@ -7,6 +7,7 @@ set(kdenlive_SRCS
...
@@ -7,6 +7,7 @@ set(kdenlive_SRCS
utils/flowlayout.cpp
utils/flowlayout.cpp
utils/freesound.cpp
utils/freesound.cpp
utils/openclipart.cpp
utils/openclipart.cpp
utils/otioconvertions.cpp
utils/resourcewidget.cpp
utils/resourcewidget.cpp
utils/thememanager.cpp
utils/thememanager.cpp
utils/thumbnailcache.cpp
utils/thumbnailcache.cpp
...
...
src/utils/otioconvertions.cpp
0 → 100644
View file @
fb82eabe
/*
* this file is part of Kdenlive, the Libre Video Editor by KDE
* Copyright 2019 Vincent Pinon <vpinon@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "otioconvertions.h"
#include "mainwindow.h"
#include "core.h"
#include "doc/kdenlivedoc.h"
#include "project/projectmanager.h"
#include <KMessageBox>
OtioConvertions
::
OtioConvertions
()
{
}
void
OtioConvertions
::
getOtioConverters
()
{
connect
(
&
m_otioProcess
,
static_cast
<
void
(
QProcess
::*
)(
int
,
QProcess
::
ExitStatus
)
>
(
&
QProcess
::
finished
),
this
,
&
OtioConvertions
::
slotGotOtioConverters
);
m_otioProcess
.
start
(
QStringLiteral
(
"python3"
));
m_otioProcess
.
write
(
QStringLiteral
(
"from opentimelineio import *
\n
"
"for a in plugins.ActiveManifest().adapters:
\n
"
" if a.has_feature('read') and a.has_feature('write'):
\n
"
" print('*.'+' *.'.join(a.suffixes), end=' ')"
).
toUtf8
());
m_otioProcess
.
closeWriteChannel
();
}
void
OtioConvertions
::
slotGotOtioConverters
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
)
{
m_otioProcess
.
disconnect
();
if
(
exitStatus
!=
QProcess
::
NormalExit
||
exitCode
!=
0
)
{
qInfo
(
"OpenTimelineIO python module is not available"
);
return
;
}
m_adapters
=
m_otioProcess
.
readAll
();
if
(
!
m_adapters
.
contains
(
"kdenlive"
))
{
qInfo
()
<<
"Kdenlive not supported by OTIO: "
<<
m_adapters
;
return
;
}
QAction
*
exportAction
=
pCore
->
window
()
->
actionCollection
()
->
action
(
"export_project"
);
QAction
*
importAction
=
pCore
->
window
()
->
actionCollection
()
->
action
(
"import_project"
);
exportAction
->
setEnabled
(
true
);
importAction
->
setEnabled
(
true
);
}
void
OtioConvertions
::
slotExportProject
()
{
auto
exportFile
=
QFileDialog
::
getSaveFileName
(
pCore
->
window
(),
i18n
(
"Export Project"
),
pCore
->
currentDoc
()
->
projectDataFolder
(),
i18n
(
"OpenTimelineIO adapters (%1)"
,
m_adapters
));
if
(
exportFile
.
isNull
())
{
return
;
}
QByteArray
xml
=
pCore
->
projectManager
()
->
projectSceneList
(
""
).
toUtf8
();
if
(
xml
.
isNull
())
{
KMessageBox
::
error
(
pCore
->
window
(),
i18n
(
"Project file could not be saved for export."
));
return
;
}
m_otioTempFile
.
setFileTemplate
(
QStringLiteral
(
"XXXXXX.kdenlive"
));
if
(
!
m_otioTempFile
.
open
()
||
!
(
m_otioTempFile
.
write
(
xml
)
>
0
))
{
pCore
->
displayMessage
(
i18n
(
"Unable to write to temporary kdenlive file for export: %1"
,
m_otioTempFile
.
fileName
()),
ErrorMessage
);
return
;
}
connect
(
&
m_otioProcess
,
static_cast
<
void
(
QProcess
::*
)(
int
,
QProcess
::
ExitStatus
)
>
(
&
QProcess
::
finished
),
this
,
&
OtioConvertions
::
slotProjectExported
);
m_otioProcess
.
start
(
QStringLiteral
(
"otioconvert"
),
{
"-i"
,
m_otioTempFile
.
fileName
(),
"-o"
,
exportFile
});
}
void
OtioConvertions
::
slotImportProject
()
{
// Select foreign project to import
auto
importFile
=
QFileDialog
::
getOpenFileName
(
pCore
->
window
(),
i18n
(
"Project to import"
),
pCore
->
currentDoc
()
->
projectDataFolder
(),
i18n
(
"OpenTimelineIO adapters (%1)"
,
m_adapters
));
if
(
importFile
.
isNull
()
||
!
QFile
::
exists
(
importFile
))
{
return
;
}
// Select converted project file
m_importedFile
=
QFileDialog
::
getSaveFileName
(
pCore
->
window
(),
i18n
(
"Imported Project"
),
pCore
->
currentDoc
()
->
projectDataFolder
(),
i18n
(
"Kdenlive project (*.kdenlive)"
));
if
(
m_importedFile
.
isNull
())
{
return
;
}
// Start convertion process
connect
(
&
m_otioProcess
,
static_cast
<
void
(
QProcess
::*
)(
int
,
QProcess
::
ExitStatus
)
>
(
&
QProcess
::
finished
),
this
,
&
OtioConvertions
::
slotProjectImported
);
m_otioProcess
.
start
(
QStringLiteral
(
"otioconvert"
),
{
"-i"
,
importFile
,
"-o"
,
m_importedFile
});
}
void
OtioConvertions
::
slotProjectExported
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
)
{
m_otioProcess
.
disconnect
();
m_otioTempFile
.
remove
();
if
(
exitStatus
!=
QProcess
::
NormalExit
||
exitCode
!=
0
)
{
pCore
->
displayMessage
(
i18n
(
"Project convertion failed"
),
ErrorMessage
);
qWarning
()
<<
exitCode
<<
exitStatus
<<
QString
(
m_otioProcess
.
readAllStandardError
());
return
;
}
pCore
->
displayMessage
(
i18n
(
"Project convertion complete"
),
InformationMessage
);
}
void
OtioConvertions
::
slotProjectImported
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
)
{
m_otioProcess
.
disconnect
();
if
(
exitStatus
!=
QProcess
::
NormalExit
||
exitCode
!=
0
||
!
QFile
::
exists
(
m_importedFile
))
{
pCore
->
displayMessage
(
i18n
(
"Project convertion failed"
),
ErrorMessage
);
qWarning
()
<<
exitCode
<<
exitStatus
<<
QString
(
m_otioProcess
.
readAllStandardError
());
return
;
}
pCore
->
displayMessage
(
i18n
(
"Project convertion complete"
),
InformationMessage
);
// Verify current project can be closed
if
(
pCore
->
currentDoc
()
->
isModified
()
&&
KMessageBox
::
warningContinueCancel
(
pCore
->
window
(),
i18n
(
"The current project has not been saved
\n
"
"Do you want to load imported project abandoning latest changes?"
)
)
!=
KMessageBox
::
Continue
)
{
return
;
}
pCore
->
projectManager
()
->
openFile
(
QUrl
::
fromLocalFile
(
m_importedFile
));
}
src/utils/otioconvertions.h
0 → 100644
View file @
fb82eabe
/*
* this file is part of Kdenlive, the Libre Video Editor by KDE
* Copyright 2019 Vincent Pinon <vpinon@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OTIOCONVERTIONS_H
#define OTIOCONVERTIONS_H
#include <QObject>
#include <QProcess>
#include <QTemporaryFile>
class
OtioConvertions
:
public
QObject
{
Q_OBJECT
public:
OtioConvertions
();
void
getOtioConverters
();
private:
QProcess
m_otioProcess
;
QString
m_adapters
;
QTemporaryFile
m_otioTempFile
;
QString
m_importedFile
;
public
slots
:
void
slotExportProject
();
void
slotImportProject
();
private
slots
:
void
slotGotOtioConverters
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
);
void
slotProjectExported
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
);
void
slotProjectImported
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
);
};
#endif // OTIOCONVERTIONS_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment