-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0100f0b
commit 93a43d0
Showing
11 changed files
with
172 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright (C) 2024 Andrew Wason | ||
// | ||
// This file is part of mediaFX. | ||
// | ||
// mediaFX 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 3 of the License, or (at your option) any later version. | ||
// | ||
// mediaFX 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 mediaFX. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import QtQuick | ||
import QtMultimedia | ||
import MediaFX | ||
import "sequence.js" as Sequence | ||
|
||
Item { | ||
id: root | ||
|
||
required default property VideoOutput videoOutput | ||
required property list<MediaClip> mediaClips | ||
required property list<MediaMixer> mediaMixers | ||
property int mixDuration: 2500 //XXX ms duration of each mixer | ||
|
||
signal mediaSequenceEnded() | ||
|
||
Item { | ||
id: internal | ||
|
||
property int currentClipIndex: 0 | ||
property int currentMixerIndex: 0 | ||
property interval mixInterval: MediaManager.createInterval(-1, -1) | ||
|
||
anchors.fill: parent | ||
|
||
VideoOutput { | ||
id: auxVideo | ||
parent: root.videoOutput.parent | ||
x: root.videoOutput.x | ||
y: root.videoOutput.y | ||
width: root.videoOutput.width | ||
height: root.videoOutput.height | ||
fillMode: root.videoOutput.fillMode | ||
visible: false | ||
} | ||
states: [ | ||
State { | ||
name: "video" | ||
PropertyChanges { | ||
Media.clip: root.mediaClips[currentClipIndex] | ||
target: root.videoOutput | ||
} | ||
}, | ||
State { | ||
name: "mixer" | ||
PropertyChanges { | ||
Media.clip: root.mediaClips[currentClipIndex] | ||
layer.enabled: true | ||
visible: false | ||
target: root.videoOutput | ||
} | ||
PropertyChanges { | ||
Media.clip: (currentClipIndex + 1 >= root.mediaClips.length) ? null : root.mediaClips[currentClipIndex + 1] | ||
layer.enabled: true | ||
target: auxVideo | ||
} | ||
PropertyChanges { | ||
source: root.videoOutput | ||
dest: auxVideo | ||
target: root.mediaMixers[currentMixerIndex] | ||
} | ||
} | ||
] | ||
|
||
Component.onCompleted: Sequence.initializeClip() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2024 Andrew Wason | ||
// | ||
// This file is part of mediaFX. | ||
// | ||
// mediaFX 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 3 of the License, or (at your option) any later version. | ||
// | ||
// mediaFX 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 mediaFX. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import QtQuick | ||
import MediaFX | ||
|
||
MediaMixer { | ||
fragmentShader: "shaders/crossfade.frag.qsb" | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (C) 2024 Andrew Wason | ||
// | ||
// This file is part of mediaFX. | ||
// | ||
// mediaFX 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 3 of the License, or (at your option) any later version. | ||
// | ||
// mediaFX 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 mediaFX. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
function onClipEnded() { | ||
if (internal.currentClipIndex + 1 < root.mediaClips.length) { | ||
internal.currentClipIndex += 1; | ||
initializeClip(); | ||
} | ||
internal.currentMixerIndex = (internal.currentMixerIndex + 1) % root.mediaMixers.length; | ||
root.mediaMixers[internal.currentMixerIndex].time = 0; | ||
}; | ||
|
||
function onClipCurrentTimeChanged() { | ||
var clip = root.mediaClips[internal.currentClipIndex]; | ||
if (internal.mixInterval.contains(clip.clipCurrentTime)) { | ||
internal.state = "mixer"; | ||
root.mediaMixers[internal.currentMixerIndex].time = internal.mixInterval.duration / (clip.clipCurrentTime.start - internal.mixInterval.start); | ||
} | ||
}; | ||
|
||
function initializeClip() { | ||
var clip = root.mediaClips[internal.currentClipIndex]; | ||
// Last clip | ||
if (internal.currentClipIndex >= root.mediaClips.length - 1) { | ||
clip.onClipEnded.connect(root.mediaSequenceEnded) | ||
} | ||
else { | ||
var clampedMixDuration = Math.min(Math.min(root.mixDuration, clip.duration), root.mediaClips[internal.currentClipIndex + 1].duration); | ||
internal.mixInterval = MediaManager.createInterval(clip.clipEnd - clampedMixDuration, clip.clipEnd); | ||
clip.onClipCurrentTimeChanged = onClipCurrentTimeChanged; | ||
clip.onClipEnded = onClipEnded; | ||
} | ||
internal.state = "video"; | ||
}; |
This file was deleted.
Oops, something went wrong.