Fix incorrect stream or no audio on insert.

Fixes #786
parent 055abf4d
......@@ -1148,11 +1148,16 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
}
}
} else if (audioDrop) {
// Using our targets
// Drag & drop, use our first audio target
audioStream = m_audioTarget.first();
} else {
// Using target tracks
if (m_audioTarget.contains(trackId)) {
audioStream = m_audioTarget.value(trackId);
}
}
res = requestClipCreation(binIdWithInOut, id, getTrackById_const(trackId)->trackType(), audioDrop ? audioStream : -1, 1.0, false, local_undo, local_redo);
res = requestClipCreation(binIdWithInOut, id, getTrackById_const(trackId)->trackType(), audioStream, 1.0, false, local_undo, local_redo);
res = res && requestClipMove(id, trackId, position, true, refreshView, logUndo, logUndo, local_undo, local_redo);
QList <int> target_track;
if (audioDrop) {
......
......@@ -2213,7 +2213,13 @@ int TimelineController::insertZone(const QString &binId, QPoint zone, bool overw
int aTrack = -1;
int vTrack = -1;
if (clip->hasAudio() && !m_model->m_audioTarget.isEmpty()) {
aTrack = m_model->m_audioTarget.firstKey();
QList<int> audioTracks = m_model->m_audioTarget.keys();
for (int tid : audioTracks) {
if (m_model->getTrackById_const(tid)->shouldReceiveTimelineOp()) {
aTrack = tid;
break;
}
}
}
if (clip->hasVideo()) {
vTrack = videoTarget();
......
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