[GSoC] Implementing Range Marker Support in Kdenlive

Wait 5 sec.

Who am I?I'm Ajay Chauhan (Matrix: hisir:matrix.org), currently in my third year of undergraduate studies in Computer Science & Engineering. I'll be working on improving Kdenlive timeline markers for my Google Summer of Code project. I have previously worked on Kdenlive as part of the Season of KDE '24.What am I working on for this year's GSoC?Kdenlive currently supports single-point timeline markers, which limits efficiency for workflows that require marking time ranges, such as highlight editing or collaborative annotations. This project proposes enhancing Kdenlive's marker system by introducing duration-based markers that define a clear start and end time.The project will extend the marker data model to support a duration attribute while maintaining backward compatibility. The UI will be updated to visualize range markers as colored regions on the timeline, with interactive handles for resizing and editing.These markers will be integrated with key features like zone-to-marker conversion, search and navigation, rendering specific ranges, and import/export capabilities.The problem that this project aims to solve is the need for efficient range-based marking functionality in Kdenlive's timeline (see issue #614). By implementing duration-based markers, the project will ensure that video editors can work more efficiently with time ranges for various workflows like highlight editing, collaborative annotations, and section-based organization.My mentor for the project is Jean-Baptiste Mardelle, and I appreciate the opportunity to collaborate with and learn from him during this process.Work CompletedDuration Handling in CommentedTime ClassThe CommentedTime class, which represents individual markers, has been extended to support duration information. This change enables the range marker functionality throughout the application.Implementation ApproachI added several new methods and properties to the CommentedTime class:duration(): Returns the marker's duration as a GenTime objectsetDuration(): Sets the marker's durationhasRange(): Boolean check to determine if a marker is a range marker (duration > 0)endTime(): Calculates and returns the end position (start + duration)The class now includes a new constructor that accepts duration as a parameter, while maintaining backward compatibility with existing point marker creation.// New constructor with duration supportCommentedTime(const GenTime &time, QString comment, int markerType, const GenTime &duration);// New member variableGenTime m_duration{GenTime(0)}; // Defaults to 0 for point markers🔗 Commit: Add duration handling to CommentedTime classRange Marker Support in MarkerListModelPreviously, Kdenlive only supported point markers - simple markers that existed at a specific timestamp without any duration. I've now implemented range marker support, allowing users to create markers that span across time intervals.Implementation ApproachThe core changes involved extending the MarkerListModel class with several new methods:addRangeMarker(): A new public method that creates markers with both position and durationaddOrUpdateRangeMarker_lambda(): An internal helper function that handles both creating new range markers and updating existing onesExtended editMarker(): Added an overloaded version that preserves duration when editing markersThe implementation uses a lambda-based approach for undo/redo functionality, ensuring that range marker operations integrate seamlessly with Kdenlive's existing command pattern. When updating existing markers, the system intelligently determines whether to preserve the current duration or apply a new one.// New method signature for range markersbool addRangeMarker(GenTime pos, GenTime duration, const QString &comment, int type = -1);// Extended edit method with duration supportbool editMarker(GenTime oldPos, GenTime pos, QString comment, int type, GenTime duration);The model now emits appropriate data change signals for duration-related roles (DurationRole, EndPosRole, HasRangeRole) when range markers are modified, ensuring the UI stays synchronized.🔗 Commit: Implement range marker support in MarkerListModelHow These Changes Improve KdenliveImproved User ExperienceFlexible Marking: Users can now create markers that represent time ranges, not just specific pointsBetter Organization: Range markers help users mark sections like "intro," "main content," or "outro" with clear visual boundariesPreserved Workflows: Existing point marker functionality remains unchanged, ensuring no disruption to current usersBackward CompatibilityAll existing marker functionality continues to work exactly as before. Point markers are simply range markers with zero duration, ensuring a smooth transition for existing projects and workflows.Next StepsIn the upcoming weeks, with the core range marker backend in place, the next phase will focus on:Integration with export and rendering workflowsUI components for creating and editing range markersVisual representation of range markers in the timeline