Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
27th June 2014, 17:03 | #1 | Link |
Registered User
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
|
Indented block statements
Hi All,
What is the simplest way of creating indented multi-level block statements, when most levels have quoted strings and the block statements aren't easily moved to a function? Although the example below is from runtime script, I also come across this scenario in other cases. For example, to this script Code:
ScriptClip(c, """ global MF_activeclips = MF_activeclips + 1 global sequence = sequence + "b" + String(MF_activeclips) INFO = """" + Eval("MF_source" + String(MF_registeredclips)) + """" + " " + \ String(current_frame) + "=" + MF_Frames2INFO(current_frame + Int(Value("""" + tcoffsetstr + """")), Value("""" + String(fps) + """")) Eval("global MF_INFO" + String(MF_activeclips) + "=INFO") MF_show == "Clip" || MF_show == "ClipFast" \ ? MF_ShowINFO(INFO) \ : last """, show=false, after_frame=false) Code:
ScriptClip(c, """ current_frame != MF_clipbefore \ ? Eval(" global MF_clipbefore = current_frame global MF_label = "label" all_of_the_above ") \ : last """, show=false, after_frame=false) Thanks, Francois Last edited by fvisagie; 27th June 2014 at 17:05. |
28th June 2014, 18:20 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This method works ok but initializes GScript at every frame
Code:
Function WhatAmI(clip c,int current_frame) { GSCript(""" c Txt = "I dont know what I am !" if(isYUV) { if(isYV12) { Txt ="I am YV12" } Else if(isYUY2) { Txt="I am YUY2" } Else if(isYV16) { Txt="I am YV16" } Else if(isYV24) { Txt="I am YV24" } Else if(isYV411) { Txt="I am YV411" } Else if(isY8) { Txt="I am Y8" } Else { Txt="I am some kind of YUV" } } Else if (IsRGB) { if(isRGB24) { Txt="I am RGB24" } Else if(isRGB32) { Txt="I am RGB32" } Else { Txt="I am some kind of RGB" } } Subtitle(String(current_frame)+"] "+Txt) """) } c=avisource("D:\avs\test.avi") c ConvertToYV24 ScriptClip("WhatAmI(Last,current_frame)", show=false, after_frame=false) Return ConvertToRGB32() # if v2.6 colorspace Code:
FnS=""" Function WhatAmI(clip c,int current_frame) { c Txt = "I dont know what I am !" if(isYUV) { if(isYV12) { Txt ="I am YV12" } Else if(isYUY2) { Txt="I am YUY2" } Else if(isYV16) { Txt="I am YV16" } Else if(isYV24) { Txt="I am YV24" } Else if(isYV411) { Txt="I am YV411" } Else if(isY8) { Txt="I am Y8" } Else { Txt="I am some kind of YUV" } } Else if (IsRGB) { if(isRGB24) { Txt="I am RGB24" } Else if(isRGB32) { Txt="I am RGB32" } Else { Txt="I am some kind of RGB" } } Subtitle(String(current_frame)+"] "+Txt) } Return ScriptClip("WhatAmI(Last,current_Frame)", show=false, after_frame=false) """ c=avisource("D:\avs\test.avi") c ConvertToYV24 GScript(FnS) Return ConvertToRGB32() # if v2.6 colorspace Code:
FnS=""" Function WhatAmI(clip c,int current_frame) { c Txt = "I dont know what I am !" if(isYUV) { if(isYV12) { Txt ="I am YV12" } Else if(isYUY2) { Txt="I am YUY2" } Else if(isYV16) { Txt="I am YV16" } Else if(isYV24) { Txt="I am YV24" } Else if(isYV411) { Txt="I am YV411" } Else if(isY8) { Txt="I am Y8" } Else { Txt="I am some kind of YUV" } } Else if (IsRGB) { if(isRGB24) { Txt="I am RGB24" } Else if(isRGB32) { Txt="I am RGB32" } Else { Txt="I am some kind of RGB" } } Subtitle(String(current_frame)+"] "+Txt) } """ c=avisource("D:\avs\test.avi") c ConvertToYV24 GScript(FnS) # Init Function ScriptClip("WhatAmI(Last,current_Frame)", show=false, after_frame=false) Return ConvertToRGB32() # if v2.6 colorspace EDIT: And of course the obvious way, which I forgot. Code:
GSCript(""" Function WhatAmI(clip c,int current_frame) { c Txt = "I dont know what I am !" if(isYUV) { if(isYV12) { Txt ="I am YV12" } Else if(isYUY2) { Txt="I am YUY2" } Else if(isYV16) { Txt="I am YV16" } Else if(isYV24) { Txt="I am YV24" } Else if(isYV411) { Txt="I am YV411" } Else if(isY8) { Txt="I am Y8" } Else { Txt="I am some kind of YUV" } } Else if (IsRGB) { if(isRGB24) { Txt="I am RGB24" } Else if(isRGB32) { Txt="I am RGB32" } Else { Txt="I am some kind of RGB" } } Subtitle(String(current_frame)+"] "+Txt) } """) c=avisource("D:\avs\test.avi") c ConvertToYV24 ScriptClip("WhatAmI(Last,current_Frame)", show=false, after_frame=false) Return ConvertToRGB32() # if v2.6 colorspace
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 29th June 2014 at 10:03. |
Thread Tools | Search this Thread |
Display Modes | |
|
|