Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add video support #7534

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Conversation

regulus79
Copy link
Contributor

@regulus79 regulus79 commented Oct 5, 2024

Description

This PR adds a new track and clip type, VideoTrack and VideoClip, for playing videos in sync with the music, primarily to make composing music for videos easier. The videos are played in dedicated VideoClipWindows which can be opened by double-clicking on the VideoClip after a video file has been loaded.

Partially fixes #2079
And #6837.

Implementation

This PR creates 5 new classes:

  • VideoTrack: A minimal new track for video clips.
  • VideoTrackView: Gui view class for VideoTrack.
  • VideoClip: Contains the video file path and a reference to a VideoClipWindow.
  • VideoClipView: Gui view class for VideoClip. As of writing this, the view is very minimal. I am planning to try adding frame previews over the length of the clip as a basic visualization.
  • VideoClipWindow: Window for playing videos. Uses Qt's QMediaPlayer and QVideoWidget to play the video file stored in its corresponding VideoClip. The implementation is still minimal, but I am planning to add at least a volume slider.

TODO

  • Add volume slider to VideoClipWindow.
  • Add a meaningful visualization to VideoClipView.
  • Prevent user from selecting non-video files which causes errors to be spammed.

Note

This PR makes use of Qt's Multimedia and MultimediaWidgets modules, which required adding them to CMakeLists.txt. I understand importing extra modules is not great, but I would love to hear your opinions on it.

Also, I added some code to get video clip splitting to work which is redundant with #7477. Once that PR is merged, some changes in ClipView.cpp can be removed.

Also, I required the ability for VideoClipWindow to receive a signal when the timeline position changed, but oddly enough, the playbackPositionChanged signal was only emitted by setPlayPos, not setToTime or setToTimeByTicks, which means that it is not triggered when the user drags the playhead. I fixed this by making setToTime and setToTimeByTicks also emit playbackPositionChanged.

And just for anyone wondering, the video clip audio is not routed through the mixer or exported with the song.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Video Support to LMMS
1 participant