From 0203ce208b49c52915df6c9f7ee48922db7e385e Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Thu, 6 Oct 2011 14:13:12 +0300 Subject: [PATCH] fix item normalization during CUE --- src/omnplay.cpp | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/omnplay.cpp b/src/omnplay.cpp index 5119cc9..718ff74 100644 --- a/src/omnplay.cpp +++ b/src/omnplay.cpp @@ -788,24 +788,30 @@ static void omnplay_ctl(omnplay_instance_t* app, control_buttons_t button) if(!r) { - unsigned int l; + unsigned int l = 0; g_warning("OmPlrClipGetInfo(%s): firstFrame=%d, lastFrame=%d\n", app->playlist.item[i].id, clip.firstFrame, clip.lastFrame); - /* should we fix playlist clip timings */ - if(!( - app->playlist.item[i].in >= clip.firstFrame && - app->playlist.item[i].in + app->playlist.item[i].dur <= clip.lastFrame) || - !app->playlist.item[i].dur) + /* fix IN */ + if(app->playlist.item[i].in < clip.firstFrame || app->playlist.item[i].in > clip.lastFrame) { - g_warning("cue: item [%s] will be updated [%d;%d]->[%d;%d]\n", - app->playlist.item[i].id, - app->playlist.item[i].in, app->playlist.item[i].dur, - clip.firstFrame, clip.lastFrame - clip.firstFrame); - app->playlist.item[i].in = clip.firstFrame; - app->playlist.item[i].dur = clip.lastFrame - clip.firstFrame; + l++; + }; + + /* fix DUR */ + if(app->playlist.item[i].in + app->playlist.item[i].dur > clip.lastFrame || !app->playlist.item[i].dur) + { + app->playlist.item[i].dur = clip.firstFrame - app->playlist.item[i].in; + l++; + }; + + /* notify */ + if(l) + { + g_warning("cue: item [%s] will be updated to [%d;%d]\n", + app->playlist.item[i].id, app->playlist.item[i].in, app->playlist.item[i].dur); omnplay_playlist_draw_item(app, i); }; -- 1.7.4.4