Fix stream number appearing in clip name of single stream clips

parent 8e5f6bb3
Pipeline #25069 passed with stage
in 9 minutes and 46 seconds
...@@ -592,13 +592,15 @@ int ClipModel::audioChannels() const ...@@ -592,13 +592,15 @@ int ClipModel::audioChannels() const
return pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioChannels(); return pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioChannels();
} }
int ClipModel::audioStream() const bool ClipModel::audioMultiStream() const
{ {
READ_LOCK(); READ_LOCK();
if (pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioStreamsCount() > 1) { return pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioStreamsCount() > 1;
return m_producer->parent().get_int("audio_index"); }
}
return -m_producer->parent().get_int("audio_index"); int ClipModel::audioStream() const
{
return m_producer->parent().get_int("audio_index");
} }
int ClipModel::audioStreamIndex() const int ClipModel::audioStreamIndex() const
......
...@@ -196,6 +196,8 @@ protected: ...@@ -196,6 +196,8 @@ protected:
int audioChannels() const; int audioChannels() const;
/** @brief Returns the active audio stream for this clip (or -1 if we only have 1 stream */ /** @brief Returns the active audio stream for this clip (or -1 if we only have 1 stream */
int audioStream() const; int audioStream() const;
/** @brief Returns true if we have multiple audio streams in the master clip */
bool audioMultiStream() const;
/** @brief Returns the list of available audio stream indexes for the bin clip */ /** @brief Returns the list of available audio stream indexes for the bin clip */
int audioStreamIndex() const; int audioStreamIndex() const;
......
...@@ -212,6 +212,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const ...@@ -212,6 +212,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const
roles[IsAudioRole] = "audio"; roles[IsAudioRole] = "audio";
roles[AudioChannelsRole] = "audioChannels"; roles[AudioChannelsRole] = "audioChannels";
roles[AudioStreamRole] = "audioStream"; roles[AudioStreamRole] = "audioStream";
roles[AudioMultiStreamRole] = "multiStream";
roles[AudioStreamIndexRole] = "audioStreamIndex"; roles[AudioStreamIndexRole] = "audioStreamIndex";
roles[IsCompositeRole] = "composite"; roles[IsCompositeRole] = "composite";
roles[IsLockedRole] = "locked"; roles[IsLockedRole] = "locked";
...@@ -290,6 +291,8 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const ...@@ -290,6 +291,8 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return clip->audioChannels(); return clip->audioChannels();
case AudioStreamRole: case AudioStreamRole:
return clip->audioStream(); return clip->audioStream();
case AudioMultiStreamRole:
return clip->audioMultiStream();
case AudioStreamIndexRole: case AudioStreamIndexRole:
return clip->audioStreamIndex(); return clip->audioStreamIndex();
case HasAudio: case HasAudio:
......
...@@ -141,6 +141,7 @@ public: ...@@ -141,6 +141,7 @@ public:
AudioLevelsRole, /// clip only AudioLevelsRole, /// clip only
AudioChannelsRole, /// clip only AudioChannelsRole, /// clip only
AudioStreamRole, /// clip only AudioStreamRole, /// clip only
AudioMultiStreamRole, /// clip only
AudioStreamIndexRole, /// clip only AudioStreamIndexRole, /// clip only
IsCompositeRole, /// track only IsCompositeRole, /// track only
IsLockedRole, /// track only IsLockedRole, /// track only
......
...@@ -41,6 +41,7 @@ Rectangle { ...@@ -41,6 +41,7 @@ Rectangle {
property bool isAudio: false property bool isAudio: false
property int audioChannels property int audioChannels
property int audioStream: -1 property int audioStream: -1
property bool multiStream: false
property int aStreamIndex: 0 property int aStreamIndex: 0
property bool showKeyframes: false property bool showKeyframes: false
property bool isGrabbed: false property bool isGrabbed: false
...@@ -586,7 +587,7 @@ Rectangle { ...@@ -586,7 +587,7 @@ Rectangle {
Text { Text {
// Clip name text // Clip name text
id: label id: label
property string clipNameString: (clipRoot.isAudio && clipRoot.audioStream > -1) ? ((clipRoot.audioStream > 10000 ? 'Merged' : clipRoot.aStreamIndex) + '|' + clipName ) : clipName property string clipNameString: (clipRoot.isAudio && clipRoot.multiStream) ? ((clipRoot.audioStream > 10000 ? 'Merged' : clipRoot.aStreamIndex) + '|' + clipName ) : clipName
text: (clipRoot.speed != 1.0 ? ('[' + Math.round(clipRoot.speed*100) + '%] ') : '') + clipNameString text: (clipRoot.speed != 1.0 ? ('[' + Math.round(clipRoot.speed*100) + '%] ') : '') + clipNameString
font: miniFont font: miniFont
anchors { anchors {
......
...@@ -45,7 +45,7 @@ Row { ...@@ -45,7 +45,7 @@ Row {
height: waveform.height height: waveform.height
channels: clipRoot.audioChannels channels: clipRoot.audioChannels
binId: clipRoot.binId binId: clipRoot.binId
audioStream: Math.abs(clipRoot.audioStream) audioStream: clipRoot.audioStream
isFirstChunk: index == 0 isFirstChunk: index == 0
showItem: waveform.visible && (index * waveform.maxWidth < (clipRoot.scrollStart + scrollView.width)) && ((index * waveform.maxWidth + width) > clipRoot.scrollStart) showItem: waveform.visible && (index * waveform.maxWidth < (clipRoot.scrollStart + scrollView.width)) && ((index * waveform.maxWidth + width) > clipRoot.scrollStart)
format: timeline.audioThumbFormat format: timeline.audioThumbFormat
......
...@@ -235,6 +235,7 @@ Item{ ...@@ -235,6 +235,7 @@ Item{
item.itemType = model.clipType item.itemType = model.clipType
item.audioChannels = model.audioChannels item.audioChannels = model.audioChannels
item.audioStream = model.audioStream item.audioStream = model.audioStream
item.multiStream = model.multiStream
item.aStreamIndex = model.audioStreamIndex item.aStreamIndex = model.audioStreamIndex
console.log('loaded clip with Astream: ', model.audioStream) console.log('loaded clip with Astream: ', model.audioStream)
// Speed change triggers a new clip insert so no binding necessary // Speed change triggers a new clip insert so no binding necessary
......
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