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
return pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioChannels();
}
int ClipModel::audioStream() const
bool ClipModel::audioMultiStream() const
{
READ_LOCK();
if (pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioStreamsCount() > 1) {
return m_producer->parent().get_int("audio_index");
}
return -m_producer->parent().get_int("audio_index");
return pCore->projectItemModel()->getClipByBinID(m_binClipId)->audioStreamsCount() > 1;
}
int ClipModel::audioStream() const
{
return m_producer->parent().get_int("audio_index");
}
int ClipModel::audioStreamIndex() const
......
......@@ -196,6 +196,8 @@ protected:
int audioChannels() const;
/** @brief Returns the active audio stream for this clip (or -1 if we only have 1 stream */
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 */
int audioStreamIndex() const;
......
......@@ -212,6 +212,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const
roles[IsAudioRole] = "audio";
roles[AudioChannelsRole] = "audioChannels";
roles[AudioStreamRole] = "audioStream";
roles[AudioMultiStreamRole] = "multiStream";
roles[AudioStreamIndexRole] = "audioStreamIndex";
roles[IsCompositeRole] = "composite";
roles[IsLockedRole] = "locked";
......@@ -290,6 +291,8 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return clip->audioChannels();
case AudioStreamRole:
return clip->audioStream();
case AudioMultiStreamRole:
return clip->audioMultiStream();
case AudioStreamIndexRole:
return clip->audioStreamIndex();
case HasAudio:
......
......@@ -141,6 +141,7 @@ public:
AudioLevelsRole, /// clip only
AudioChannelsRole, /// clip only
AudioStreamRole, /// clip only
AudioMultiStreamRole, /// clip only
AudioStreamIndexRole, /// clip only
IsCompositeRole, /// track only
IsLockedRole, /// track only
......
......@@ -41,6 +41,7 @@ Rectangle {
property bool isAudio: false
property int audioChannels
property int audioStream: -1
property bool multiStream: false
property int aStreamIndex: 0
property bool showKeyframes: false
property bool isGrabbed: false
......@@ -586,7 +587,7 @@ Rectangle {
Text {
// Clip name text
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
font: miniFont
anchors {
......
......@@ -45,7 +45,7 @@ Row {
height: waveform.height
channels: clipRoot.audioChannels
binId: clipRoot.binId
audioStream: Math.abs(clipRoot.audioStream)
audioStream: clipRoot.audioStream
isFirstChunk: index == 0
showItem: waveform.visible && (index * waveform.maxWidth < (clipRoot.scrollStart + scrollView.width)) && ((index * waveform.maxWidth + width) > clipRoot.scrollStart)
format: timeline.audioThumbFormat
......
......@@ -235,6 +235,7 @@ Item{
item.itemType = model.clipType
item.audioChannels = model.audioChannels
item.audioStream = model.audioStream
item.multiStream = model.multiStream
item.aStreamIndex = model.audioStreamIndex
console.log('loaded clip with Astream: ', model.audioStream)
// 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