mltframework / mltframework/mlt
mlt_playlist fixes
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.9k
- Forks
- 387
- Avg merge
- 17h 28m
- Merged PRs (30d)
- 8
Description
I did some tests with a playlist item modification and reordering and found some issues
First issue related to mlt_playlist_move function: current == dest special case is wrong. Fix is next:
From 586fb28531282a8be64286f90e5177ae772d5452 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <verem@m1.tv>
Date: Tue, 25 Dec 2018 17:59:11 +0200
Subject: [PATCH] Fix playlist move current positioning
---
src/framework/mlt_playlist.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c
index 9942e0b..6ed428d 100644
--- a/src/framework/mlt_playlist.c
+++ b/src/framework/mlt_playlist.c
@@ -930,12 +930,10 @@ int mlt_playlist_move( mlt_playlist self, int src, int dest )
if ( current == src )
current = dest;
- else if ( src < current && current < dest )
+ else if ( src < current && current <= dest )
current --;
- else if ( dest < current && current < src )
+ else if ( dest <= current && current < src )
current ++;
- else if ( current == dest )
- current = src;
src_entry = self->list[ src ];
if ( src > dest )
--
1.8.3.1
Next issue related to changing repeat playlist item attribute. After changing it playlist current position become wrong. Fix is follow:
From 31a935681f1d0d7d4ef8780711c84aa02c9a9824 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <verem@m1.tv>
Date: Thu, 27 Dec 2018 12:21:30 +0200
Subject: [PATCH] Keep playlist logical position the same after changing same
---
src/framework/mlt_playlist.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c
index 6ed428d..05b8544 100644
--- a/src/framework/mlt_playlist.c
+++ b/src/framework/mlt_playlist.c
@@ -970,9 +970,17 @@ int mlt_playlist_repeat_clip( mlt_playlist self, int clip, int repeat )
int error = repeat < 1 || clip < 0 || clip >= self->count;
if ( error == 0 )
{
+ int current = mlt_playlist_current_clip( self );
+ mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( self ) );
+ // We need all the details about the current clip
+ mlt_playlist_clip_info current_info;
+ mlt_playlist_get_clip_info( self, ¤t_info, current );
+ position = (int)(position - current_info.start) % (current_info.frame_count / current_info.repeat);
playlist_entry *entry = self->list[ clip ];
entry->repeat = repeat;
mlt_playlist_virtual_refresh( self );
+ mlt_playlist_get_clip_info( self, ¤t_info, current );
+ mlt_producer_seek( MLT_PLAYLIST_PRODUCER( self ), current_info.start + position );
}
return error;
}
--
1.8.3.1
Please review and apply.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/framework/mlt_playlist.c, focusing on mlt_playlist_move and mlt_playlist_repeat_clip and the supplied patch diffs. Review how current positioning is updated during moves and repeat changes, then verify that the current logical position remains correct after both operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100