Not yet, I'll have to hurry because I've got to get up half an hour ago
OK, done the findTrim() thing, you can now jump about on the timeline.
Code:
#ASYNTHER Test
############################################
#Global G_FILECOUNT=___FILECNT___ # Total clips being processed, filled in by Avisynthesizer_Mod
Global G_FILECOUNT=5 # Total clips being processed
############################################
Global G_CURRENT_TRIM=0 # Count of clips done so far : MUST BE 0
############################################
Global G_PROJECTNAME="Test" # Change to whatever you want
Global G_DB=G_PROJECTNAME+".DB" # DBase
Global G_TYPESTRING="s512s512iii" # Fields:-
# 0) String(512) ClipFileName
# 1) String(512) ClipSubTitles (not used)
# 2) Int ClipFrameCount
# 3) Int MovieStartFrame (of trim)
# 4) Int MovieEndFrame (of trim)
#############################################
RT_DBaseAlloc(G_DB,G_FILECOUNT,G_TYPESTRING) # Create Movie DB
###
#[ProcessTrim("___FILE___")] # filled in by Avisynthesizer_Mod
ProcessTrim("0.avi") ++ \
ProcessTrim("1.avi") ++ \
ProcessTrim("2.avi") ++ \
ProcessTrim("3.avi") ++ \
ProcessTrim("4.avi")
Global G_PREV_FRAME = -2 # Force Init
Global G_CURRENT_TRIM = -1 # Init for play
Global G_MOVIETRIM_START = -1 # Init for play
Global G_MOVIETRIM_END = -1 # Init for play
Global G_FN="" # Init for play
ScriptClip("""
DoInit = (G_PREV_FRAME + 1 != current_frame || current_frame > G_MOVIETRIM_END)
Global G_CURRENT_TRIM = (DoInit) ? FindTrim(G_DB,3,4,current_frame) : G_CURRENT_TRIM
Global G_MOVIETRIM_START= (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,3) : G_MOVIETRIM_START
Global G_MOVIETRIM_END = (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,4) : G_MOVIETRIM_END
Global G_FN = (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,0) : G_FN
RT_SubTitle("%d] {%d:%d} %s",current_frame,G_CURRENT_TRIM,current_frame-G_MOVIETRIM_START,G_FN)
G_PREV_FRAME = current_frame # Remember previous frame visited for next iteration
return Last
""")
Return Last
#############################################
### Contents of Process.avsi
Function ProcessTrim(string fn) {
RT_DebugF("Processing %d ] %s",G_CURRENT_TRIM,fn)
c = Avisource(fn)
FC = c.FrameCount
SubTitleFN="" # We dont have subtitle file, maybe we could get it from some external program.
S = (G_CURRENT_TRIM == 0) ? 0 : RT_DBaseGetField(G_DB,G_CURRENT_TRIM-1,4) + 1 # Previous MovieEndFrame + 1
E = S + FC - 1
RT_DBaseSet(G_DB,G_CURRENT_TRIM,fn,SubTitleFN,FC,S,E)
Global G_CURRENT_TRIM = G_CURRENT_TRIM + 1 # Increment current trim number. NOTE Assign Global
return c
}
Function FindTrim(String DB,Int S_Field,Int E_Field,Int Frame) {
# DB Find Trim (record) containing movie frame Frame, S_Field = MovieStartFrame, E_Field = MovieEndFrame
result = -1 # Init NOT FOUND
low = 0
high = RT_DBaseRecords(DB) - 1
GSCript("""
while(low <= high) {
mid = (low + high) / 2
if(RT_DBaseGetField(DB,mid,E_Field) < Frame) {
low = mid + 1
} Else If (RT_DBaseGetField(DB,mid,S_Field) > Frame) {
high = mid - 1
} Else {
low = high + 1 # Force exit
Result = mid
}
}
""")
return result
}