Assuming you have a PSXjin dump saved under the name "test", you get these files:
000_test.avi
001_test-640x480.avi
002_test-368x216.avi
003_test-320x224.avi
...
000_test.wav
This will load
all of them... (unfortunately it can get very slow when the resolutions become very large):
Open_PSXjin("test")
# BilinearResize(1024, 768) # final resolution
# FlipVertical # may be necessary with some codecs
last
function Open_PSXjin(string Name) {
Base = "000_" + Name
Video = DSS2(Base + ".avi")
Video = PSXjin_FindSegmentFile(Video, 1, "_" + Name + "-")
Audio = WAVSource(Base + ".wav")
AudioDub(Video, Audio)
}
function PSXjin_FindSegmentFile(clip Video, int Index, string Name) {
s = String(Index, "%03.0f") + Name
f = PSXjin_FindSegmentFileX(s, 256)
return (f != "") ? Video.PSXjin_AddSegment(f).PSXjin_FindSegmentFile(Index + 1, Name) : Video
}
function PSXjin_FindSegmentFileX(string Base, int x) {
s = Base + String(x, "%03.0f") + "x"
f = PSXjin_FindSegmentFileY(s, 216)
return (f != "") ? f
\: (x < 640) ? PSXjin_FindSegmentFileX(Base, x + 16)
\: ""
}
function PSXjin_FindSegmentFileY(string Base, int y) {
s = Base + String(y, "%03.0f") + ".avi"
return Exist(s) ? s
\: (y < 480) ? PSXjin_FindSegmentFileY(Base, y + 8)
\: ""
}
function PSXjin_AddSegment(clip Video, string FileName) {
v1 = Video
v2 = DSS2(FileName)
x = LCM(v1.Width , v2.Width )
y = LCM(v1.Height, v2.Height)
return v1.PointResize(x, y)
\+ v2.PointResize(x, y)
}
################################ tools ################################
function LCM(int a, int b) {
# Least Common Multiple
# en.wikipedia.org/wiki/Least_common_multiple#Computing_the_least_common_multiple
Assert(a > 0, "LCM: a must be greater than zero")
Assert(b > 0, "LCM: b must be greater than zero")
return (a * b) / GCD(a, b)
}
function GCD(int u, int v) {
# Greatest Common Divisor
# en.wikipedia.org/wiki/Binary_GCD_algorithm#Recursive_version_in_C
Assert(u > 0, "GCD: u must be greater than zero")
Assert(v > 0, "GCD: v must be greater than zero")
return (u == v) ? u
\: (u == 0) ? v
\: (v == 0) ? u
\: even(u) && odd(v) ? GCD((u ) / 2, v )
\: even(u) ? GCD((u ) / 2, v / 2) * 2
\: even(v) ? GCD((u ) , v / 2)
\: (u > v) ? GCD((u - v) / 2, v )
\: GCD((v - u) / 2, u)
}
function even(int i) {return ((i % 2) == 0)}
function odd (int i) {return ((i % 2) == 1)}