Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

differentiate audio and video clips

parent 3297ef4a
......@@ -123,6 +123,14 @@ const QString ClipModel::getProperty(const QString &name) const
return QString::fromUtf8(service()->get(name.toUtf8().constData()));
}
int ClipModel::getIntProperty(const QString &name) const
{
if (service()->parent().is_valid()) {
return service()->parent().get_int(name.toUtf8().constData());
}
return service()->get_int(name.toUtf8().constData());
}
Mlt::Producer* ClipModel::service() const
{
return m_producer.get();
......@@ -143,3 +151,10 @@ bool ClipModel::hasAudio() const
QString service = getProperty("mlt_service");
return service.contains(QStringLiteral("avformat"));
}
bool ClipModel::isAudioOnly() const
{
QString service = getProperty("mlt_service");
return service.contains(QStringLiteral("avformat")) && (getIntProperty(QStringLiteral("video_index")) == -1);
}
......@@ -62,6 +62,7 @@ public:
/* @brief returns a property of the clip, or from it's parent if it's a cut
*/
const QString getProperty(const QString &name) const override;
int getIntProperty(const QString &name) const;
friend class TrackModel;
friend class TimelineModel;
......@@ -85,6 +86,7 @@ protected:
*/
void setTimelineEffectsEnabled(bool enabled);
bool hasAudio() const;
bool isAudioOnly() const;
protected:
std::shared_ptr<Mlt::Producer> m_producer;
......
......@@ -247,9 +247,11 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return QVariant();
case HasAudio:
return clip->hasAudio();
case IsAudioRole:
return clip->isAudioOnly();
case MarkersRole: {
QVariantList markersList;
markersList << QStringLiteral("10") << QStringLiteral("Marker 1") << QStringLiteral("50") << QStringLiteral("M2");
//markersList << QStringLiteral("10") << QStringLiteral("Marker 1") << QStringLiteral("50") << QStringLiteral("M2");
return markersList;
}
case StartRole:
......
......@@ -100,7 +100,7 @@ Rectangle {
return '#' + clipResource.substring(2, 8)
}
}
return isAudio? 'darkseagreen' : 'blue'
return isAudio? '#8cc6c0' : '#416e8c'
//root.shotcutBlue
}
......@@ -136,7 +136,7 @@ Rectangle {
clip: true
Image {
id: outThumbnail
visible: timeline.showThumbnails && mltService != 'color'
visible: timeline.showThumbnails && mltService != 'color' && !isAudio
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
......@@ -148,7 +148,7 @@ Rectangle {
Image {
id: inThumbnail
visible: timeline.showThumbnails && mltService != 'color'
visible: timeline.showThumbnails && mltService != 'color' && !isAudio
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
......
......@@ -133,7 +133,7 @@ Column{
item.clipResource= model.resource
item.clipId= model.item
item.binId= model.binId
item.isAudio= false //model.audio
item.isAudio= model.audio
item.isComposition= model.isComposition
if (!model.isComposition) {
item.audioLevels= model.audioLevels
......
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