private AvsFile(string script, bool parse) { try { this.enviroment = new AviSynthScriptEnvironment(); this.clip = parse ? enviroment.ParseScript(script, AviSynthColorspace.RGB24) : enviroment.OpenScriptFile(script, AviSynthColorspace.RGB24); checked { ulong width = (ulong)clip.VideoWidth; ulong height = (ulong)clip.VideoHeight; info = new MediaFileInfo( clip.HasVideo, width, height, new Dar(clip.GetIntVariable("MeGUI_darx", -1), clip.GetIntVariable("MeGUI_dary", -1), width, height), (ulong)clip.num_frames, ((double)clip.raten) / ((double)clip.rated), (clip.SamplesCount != 0)); } } catch (Exception) { cleanup(); throw; } }
public static int AVSFileChannelCount(String strAVSScript) { try { if (!Path.GetExtension(strAVSScript).ToLower(System.Globalization.CultureInfo.InvariantCulture).Equals(".avs")) { return(0); } using (AviSynthScriptEnvironment env = new AviSynthScriptEnvironment()) using (AviSynthClip a = env.OpenScriptFile(strAVSScript)) return(a.ChannelsCount); } catch { return(0); } }
public static bool AVSFileHasAudio(String strAVSScript) { try { if (!Path.GetExtension(strAVSScript).ToLower(System.Globalization.CultureInfo.InvariantCulture).Equals(".avs")) { return(false); } using (AviSynthScriptEnvironment env = new AviSynthScriptEnvironment()) using (AviSynthClip a = env.OpenScriptFile(strAVSScript)) if (a.ChannelsCount == 0) { return(false); } return(true); } catch { return(false); } }
public static bool AVSFileHasAudio(String strAVSScript) { try { if (!Path.GetExtension(strAVSScript).ToLowerInvariant().Equals(".avs")) { return(false); } using (AviSynthScriptEnvironment env = new AviSynthScriptEnvironment()) using (AviSynthClip a = env.OpenScriptFile(strAVSScript)) if (!a.HasAudio) { return(false); } return(true); } catch { return(false); } }
public static double GetFPSFromAVSFile(String strAVSScript) { try { if (!Path.GetExtension(strAVSScript).ToLower(System.Globalization.CultureInfo.InvariantCulture).Equals(".avs")) { return(0); } using (AviSynthScriptEnvironment env = new AviSynthScriptEnvironment()) { using (AviSynthClip a = env.OpenScriptFile(strAVSScript)) if (a.HasVideo) { return((double)a.raten / (double)a.rated); } } return(0); } catch { return(0); } }
private AvsFile(string script, bool parse, bool bRequireRGB24) { try { this.enviroment = new AviSynthScriptEnvironment(); this.clip = parse ? enviroment.ParseScript(script, bRequireRGB24) : enviroment.OpenScriptFile(script, bRequireRGB24); checked { if (clip.HasVideo) { ulong width = (ulong)clip.VideoWidth; ulong height = (ulong)clip.VideoHeight; info = new VideoInformation( clip.HasVideo, width, height, new Dar(clip.GetIntVariable("MeGUI_darx", -1), clip.GetIntVariable("MeGUI_dary", -1), width, height), (ulong)clip.num_frames, ((double)clip.raten) / ((double)clip.rated), clip.raten, clip.rated); } else if (clip.HasAudio) { info = new VideoInformation(false, 0, 0, Dar.A1x1, (ulong)clip.SamplesCount, (double)clip.AudioSampleRate, 0, 0); } else { info = new VideoInformation(false, 0, 0, Dar.A1x1, 0, 0, 0, 0); } } } catch (Exception) { cleanup(); throw; } }
private AvsFile(string script, bool parse) { try { this.enviroment = new AviSynthScriptEnvironment(); this.clip = parse ? enviroment.ParseScript(script, AviSynthColorspace.RGB24) : enviroment.OpenScriptFile(script, AviSynthColorspace.RGB24); checked { ulong width = (ulong)clip.VideoWidth; ulong height = (ulong)clip.VideoHeight; info = new MediaFileInfo( clip.HasVideo, width, height, new Dar(clip.GetIntVariable("MeGUI_darx", -1), clip.GetIntVariable("MeGUI_dary", -1), width, height), (ulong)clip.num_frames, ((double)clip.raten) / ((double)clip.rated), (clip.SamplesCount != 0)); } } catch (Exception) { cleanup(); throw; } }
private AvsFile(string script, bool parse) { try { this.enviroment = new AviSynthScriptEnvironment(); this.clip = parse ? enviroment.ParseScript(script, AviSynthColorspace.RGB24) : enviroment.OpenScriptFile(script, AviSynthColorspace.RGB24); this.hasVideo = clip.HasVideo; this.height = this.clip.VideoHeight; this.width = this.clip.VideoWidth; this.frameRate = ((double)clip.raten) / ((double)clip.rated); this.darX = this.clip.GetIntVariable("MeGUI_darx", -1); this.darY = this.clip.GetIntVariable("MeGUI_dary", -1); this.frameCount = clip.num_frames; this.hasAudio = (clip.SamplesCount != 0); } catch (Exception) { cleanup(); throw; } }