public LDSize scaled(LDSize s, AspectRatioMode mode) { if (s.isEmpty()) { return(new LDSize()); } LDSize S; switch (mode) { case AspectRatioMode.IgnoreAspectRatio: S = s; break; case AspectRatioMode.KeepAspectRatio: S = new LDSize(this.wd * Math.Min(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Min(s.wd / this.wd, s.ht / this.ht)); break; case AspectRatioMode.KeepAspectRatioByExpanding: S = new LDSize(this.wd * Math.Max(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Max(s.wd / this.wd, s.ht / this.ht)); break; default: S = null; break; } return(S); }
public void Scale(Size s, AspectRatioMode mode) { if (mode == AspectRatioMode.IgnoreAspectRatio || _wd == 0 || _ht == 0) { _wd = s._wd; _ht = s._ht; } else { bool useHeight; int rw = (s._ht * _wd) / _ht; if (mode == AspectRatioMode.KeepAspectRatio) { useHeight = (rw <= s._wd); } else // mode == Fw::KeepAspectRatioByExpanding { useHeight = (rw >= s._wd); } if (useHeight) { _wd = rw; _ht = s._ht; } else { _ht = (s._wd * _ht) / _wd; _wd = s._wd; } } }
public void scale(LDSize s, AspectRatioMode mode) { LDSize size = this.scaled(s, mode); this.wd = size.wd; this.ht = size.ht; }
internal static string AspectRatioToString(AspectRatioMode aratio) { switch (aratio) // toate cele 9 vlc aspect ratio values { case AspectRatioMode.Mode1: return("1:1"); case AspectRatioMode.Mode2: return("4:3"); case AspectRatioMode.Mode3: return("16:9"); case AspectRatioMode.Mode4: return("16:10"); case AspectRatioMode.Mode5: return("2.21:1"); case AspectRatioMode.Mode6: return("2.35:1"); case AspectRatioMode.Mode7: return("2.39:1"); case AspectRatioMode.Mode8: return("5:4"); case AspectRatioMode.Default: return("Default"); default: return(null); } }
public Gui2dElement(string name, Vector2 position, Vector2 size, Texture texture, AspectRatioMode aspectRatioMode) { _name = name; _position = position; _size = size; _texture = texture; _aspectRatioMode = aspectRatioMode; }
public GuiBlockElement(string name, Vector2 position, Vector3 size, BlockSnapshot snapshot, AspectRatioMode aspectRatioMode) { _name = name; _position = position; _size = size; _snapshot = snapshot; _aspectRatioMode = aspectRatioMode; _textureIndices = new int[6]; RefreshTextures(); GenerateMatrix(); }
public static Vector2 AspectRatio(Vector2 size, AspectRatioMode mode) { float w = size.X; float h = size.Y; float sx, sy; switch (mode) { case AspectRatioMode.FitIn: if (w > h) { sx = 1.0f; sy = w / h; } else { sx = h / w; sy = 1.0f; } break; case AspectRatioMode.FitOut: if (w > h) { sx = h / w; sy = 1.0f; } else { sx = 1.0f; sy = w / h; } break; case AspectRatioMode.FitWidth: sx = 1.0f; sy = w / h; break; default: sy = 1.0f; sx = h / w; break; } return(new Vector2(sx, sy)); }
internal static float GetAspectRatio(AspectRatioMode mode) { if (mode == AspectRatioMode.CameraAperture) { return(0.0f); } else if (mode == AspectRatioMode.CurrentResolution) { return((float)Screen.width / (float)Screen.height); } else { #if UNITY_EDITOR return((float)PlayerSettings.defaultScreenWidth / (float)PlayerSettings.defaultScreenHeight); #else // fallback on current resoltution return((float)Screen.width / (float)Screen.height); #endif } }
/// <summary> create the used COM components and get the interfaces. </summary> protected virtual bool GetDVDInterfaces(string path) { int hr; //Type comtype = null; object comobj = null; _freeNavigator = true; _dvdInfo = null; _dvdCtrl = null; bool useAC3Filter = false; string dvdNavigator = ""; string aspectRatioMode = ""; string displayMode = ""; _videoPref = DvdPreferredDisplayMode.DisplayContentDefault; using (MediaPortal.Profile.Settings xmlreader = new MPSettings()) { dvdNavigator = xmlreader.GetValueAsString("dvdplayer", "navigator", "DVD Navigator"); aspectRatioMode = xmlreader.GetValueAsString("dvdplayer", "armode", "").ToLower(); dvdNavigator = "dslibdvdnav"; if (aspectRatioMode == "crop") { arMode = AspectRatioMode.Crop; } if (aspectRatioMode == "letterbox") { arMode = AspectRatioMode.LetterBox; } if (aspectRatioMode == "stretch") { arMode = AspectRatioMode.Stretched; } //if ( aspectRatioMode == "stretch" ) arMode = AspectRatioMode.zoom14to9; if (aspectRatioMode == "follow stream") { arMode = AspectRatioMode.StretchedAsPrimary; } useAC3Filter = xmlreader.GetValueAsBool("dvdplayer", "ac3", false); displayMode = xmlreader.GetValueAsString("dvdplayer", "displaymode", "").ToLower(); if (displayMode == "default") { _videoPref = DvdPreferredDisplayMode.DisplayContentDefault; } if (displayMode == "16:9") { _videoPref = DvdPreferredDisplayMode.Display16x9; } if (displayMode == "4:3 pan scan") { _videoPref = DvdPreferredDisplayMode.Display4x3PanScanPreferred; } if (displayMode == "4:3 letterbox") { _videoPref = DvdPreferredDisplayMode.Display4x3LetterBoxPreferred; } } try { _dvdGraph = (IDvdGraphBuilder) new DvdGraphBuilder(); hr = _dvdGraph.GetFiltergraph(out _graphBuilder); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _rotEntry = new DsROTEntry((IFilterGraph)_graphBuilder); _vmr9Filter = (IBaseFilter) new VideoMixingRenderer9(); IVMRFilterConfig9 config = _vmr9Filter as IVMRFilterConfig9; hr = config.SetNumberOfStreams(1); hr = config.SetRenderingMode(VMR9Mode.Windowless); windowlessCtrl = (IVMRWindowlessControl9)_vmr9Filter; windowlessCtrl.SetVideoClippingWindow(this.panVideoWin.Handle); // config.SetRenderingPrefs(VMR9RenderPrefs. _graphBuilder.AddFilter(_vmr9Filter, "Video Mixing Renderer 9"); // _vmr7 = new VMR7Util(); // _vmr7.AddVMR7(_graphBuilder); try { _dvdbasefilter = DirectShowUtil.AddFilterToGraph(_graphBuilder, dvdNavigator); if (_dvdbasefilter != null) { IDvdControl2 cntl = (IDvdControl2)_dvdbasefilter; if (cntl != null) { _dvdInfo = (IDvdInfo2)cntl; _dvdCtrl = (IDvdControl2)cntl; if (path != null) { if (path.Length != 0) { cntl.SetDVDDirectory(path); } } _dvdCtrl.SetOption(DvdOptionFlag.HMSFTimeCodeEvents, true); // use new HMSF timecode format _dvdCtrl.SetOption(DvdOptionFlag.ResetOnStop, false); AddPreferedCodecs(_graphBuilder); DirectShowUtil.RenderOutputPins(_graphBuilder, _dvdbasefilter); // _videoWin = _graphBuilder as IVideoWindow; _freeNavigator = false; } //DirectShowUtil.ReleaseComObject( _dvdbasefilter); _dvdbasefilter = null; } } catch (Exception ex) { string strEx = ex.Message; } Guid riid; if (_dvdInfo == null) { riid = typeof(IDvdInfo2).GUID; hr = _dvdGraph.GetDvdInterface(riid, out comobj); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _dvdInfo = (IDvdInfo2)comobj; comobj = null; } if (_dvdCtrl == null) { riid = typeof(IDvdControl2).GUID; hr = _dvdGraph.GetDvdInterface(riid, out comobj); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _dvdCtrl = (IDvdControl2)comobj; comobj = null; } _mediaCtrl = (IMediaControl)_graphBuilder; _mediaEvt = (IMediaEventEx)_graphBuilder; _basicAudio = _graphBuilder as IBasicAudio; _mediaPos = (IMediaPosition)_graphBuilder; _mediaSeek = (IMediaSeeking)_graphBuilder; _mediaStep = (IVideoFrameStep)_graphBuilder; _basicVideo = _graphBuilder as IBasicVideo2; _videoWin = _graphBuilder as IVideoWindow; // disable Closed Captions! IBaseFilter baseFilter; _graphBuilder.FindFilterByName("Line 21 Decoder", out baseFilter); if (baseFilter == null) { _graphBuilder.FindFilterByName("Line21 Decoder", out baseFilter); } if (baseFilter != null) { _line21Decoder = (IAMLine21Decoder)baseFilter; if (_line21Decoder != null) { AMLine21CCState state = AMLine21CCState.Off; hr = _line21Decoder.SetServiceState(state); if (hr == 0) { logger.Info("DVDPlayer:Closed Captions disabled"); } else { logger.Info("DVDPlayer:failed 2 disable Closed Captions"); } } } /* * // get video window * if (_videoWin==null) * { * riid = typeof( IVideoWindow ).GUID; * hr = _dvdGraph.GetDvdInterface( ref riid, out comobj ); * if( hr < 0 ) * Marshal.ThrowExceptionForHR( hr ); * _videoWin = (IVideoWindow) comobj; comobj = null; * } */ // GetFrameStepInterface(); DirectShowUtil.SetARMode(_graphBuilder, arMode); DirectShowUtil.EnableDeInterlace(_graphBuilder); //m_ovMgr = new OVTOOLLib.OvMgrClass(); //m_ovMgr.SetGraph(_graphBuilder); return(true); } catch (Exception) { //MessageBox.Show( this, "Could not get interfaces\r\n" + ee.Message, "DVDPlayer.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop ); CloseDVDInterfaces(); return(false); } finally { if (comobj != null) { DirectShowUtil.ReleaseComObject(comobj); } comobj = null; } }
public LDSize scaled(LDSize s, AspectRatioMode mode) { if (s.isEmpty()) return new LDSize(); LDSize S; switch (mode) { case AspectRatioMode.IgnoreAspectRatio: S = s; break; case AspectRatioMode.KeepAspectRatio: S = new LDSize(this.wd * Math.Min(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Min(s.wd / this.wd, s.ht / this.ht)); break; case AspectRatioMode.KeepAspectRatioByExpanding: S = new LDSize(this.wd * Math.Max(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Max(s.wd / this.wd, s.ht / this.ht)); break; default: S = null; break; } return S; }
public LDSize scaled(float w, float h, AspectRatioMode mode) { return this.scaled(new LDSize(w, h), mode); }
public void scale(float w, float h,AspectRatioMode mode) { this.scale(new LDSize(w, h), mode); }
public void Scale(Size size, AspectRatioMode mode) { Scale(size.Width, size.Height, mode); }
public void Scale(int w, int h, AspectRatioMode mode) { Scale(new Size(w, h), mode); }
public Pixmap Scale(Size size, AspectRatioMode aspectMode = AspectRatioMode.IgnoreAspectRatio, TransformationMode mode = TransformationMode.FastTransformation) { return(new Pixmap(qt_pixmap_scaled(Handle, size.Handle, aspectMode, mode))); }
public static extern IntPtr QSizeScaled(Size size, int width, int height, AspectRatioMode mode);
public static Matrix AspectMatrix(Vector2 size, AspectRatioMode mode) { Vector2 aspect = AspectRatio(size, mode); return(Matrix.Transformation2D(new Vector2(0.5f, 0.5f), 0.0f, aspect, Vector2.Zero, 0.0f, Vector2.Zero)); }
public Size Scaled(Size size, AspectRatioMode mode) { return(Scaled(size.Width, size.Height, mode)); }
public Size Scaled(int width, int height, AspectRatioMode mode) { return(Marshal.PtrToStructure <Size>(Internal.QSizeScaled(this, width, height, mode))); }
/// <summary> create the used COM components and get the interfaces. </summary> protected virtual bool GetInterfaces(string path) { int hr; //Type comtype = null; object comobj = null; _freeNavigator = true; _dvdInfo = null; _dvdCtrl = null; string dvdNavigator = ""; string aspectRatioMode = ""; string displayMode = ""; bool useAC3Filter = false; using (Settings xmlreader = new MPSettings()) { dvdNavigator = xmlreader.GetValueAsString("dvdplayer", "navigator", "DVD Navigator"); aspectRatioMode = xmlreader.GetValueAsString("dvdplayer", "armode", "").ToLower(); if (aspectRatioMode == "crop") { arMode = AspectRatioMode.Crop; } if (aspectRatioMode == "letterbox") { arMode = AspectRatioMode.LetterBox; } if (aspectRatioMode == "stretch") { arMode = AspectRatioMode.Stretched; } //if ( aspectRatioMode == "stretch" ) arMode = AspectRatioMode.zoom14to9; if (aspectRatioMode == "follow stream") { arMode = AspectRatioMode.StretchedAsPrimary; } useAC3Filter = xmlreader.GetValueAsBool("dvdplayer", "ac3", false); displayMode = xmlreader.GetValueAsString("dvdplayer", "displaymode", "").ToLower(); if (displayMode == "default") { _videoPref = DvdPreferredDisplayMode.DisplayContentDefault; } if (displayMode == "16:9") { _videoPref = DvdPreferredDisplayMode.Display16x9; } if (displayMode == "4:3 pan scan") { _videoPref = DvdPreferredDisplayMode.Display4x3PanScanPreferred; } if (displayMode == "4:3 letterbox") { _videoPref = DvdPreferredDisplayMode.Display4x3LetterBoxPreferred; } } try { _dvdGraph = (IDvdGraphBuilder)new DvdGraphBuilder(); hr = _dvdGraph.GetFiltergraph(out _graphBuilder); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _rotEntry = new DsROTEntry((IFilterGraph)_graphBuilder); try { _dvdbasefilter = DirectShowUtil.AddFilterToGraph(_graphBuilder, dvdNavigator); if (_dvdbasefilter != null) { IDvdControl2 cntl = (IDvdControl2)_dvdbasefilter; if (cntl != null) { _dvdInfo = (IDvdInfo2)cntl; _dvdCtrl = (IDvdControl2)cntl; if (path != null) { if (path.Length != 0) { cntl.SetDVDDirectory(path); } } _dvdCtrl.SetOption(DvdOptionFlag.HMSFTimeCodeEvents, true); // use new HMSF timecode format _dvdCtrl.SetOption(DvdOptionFlag.ResetOnStop, false); AddPreferedCodecs(_graphBuilder); DirectShowUtil.RenderOutputPins(_graphBuilder, _dvdbasefilter); _videoWin = _graphBuilder as IVideoWindow; _freeNavigator = false; } //DirectShowUtil.ReleaseComObject( _dvdbasefilter); _dvdbasefilter = null; } } catch (Exception ex) { string strEx = ex.Message; } Guid riid; if (useAC3Filter) { string ac3filterMonikerString = @"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{A753A1EC-973E-4718-AF8E-A3F554D45C44}"; Log.Info("DVDPlayer:Adding AC3 filter to graph"); IBaseFilter filter = Marshal.BindToMoniker(ac3filterMonikerString) as IBaseFilter; if (filter != null) { hr = _graphBuilder.AddFilter(filter, "AC3 Filter"); if (hr < 0) { Log.Info("DVDPlayer:FAILED:could not add AC3 filter to graph"); } } else { Log.Info("DVDPlayer:FAILED:AC3 filter not installed"); } } if (_dvdInfo == null) { riid = typeof (IDvdInfo2).GUID; hr = _dvdGraph.GetDvdInterface(riid, out comobj); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _dvdInfo = (IDvdInfo2)comobj; comobj = null; } if (_dvdCtrl == null) { riid = typeof (IDvdControl2).GUID; hr = _dvdGraph.GetDvdInterface(riid, out comobj); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _dvdCtrl = (IDvdControl2)comobj; comobj = null; } _mediaCtrl = (IMediaControl)_graphBuilder; _mediaEvt = (IMediaEventEx)_graphBuilder; _basicAudio = _graphBuilder as IBasicAudio; _mediaPos = (IMediaPosition)_graphBuilder; _basicVideo = _graphBuilder as IBasicVideo2; _videoWin = _graphBuilder as IVideoWindow; // disable Closed Captions! IBaseFilter baseFilter; _graphBuilder.FindFilterByName("Line 21 Decoder", out baseFilter); if (baseFilter == null) { _graphBuilder.FindFilterByName("Line21 Decoder", out baseFilter); } if (baseFilter != null) { _line21Decoder = (IAMLine21Decoder)baseFilter; if (_line21Decoder != null) { AMLine21CCState state = AMLine21CCState.Off; hr = _line21Decoder.SetServiceState(state); if (hr == 0) { Log.Info("DVDPlayer:Closed Captions disabled"); } else { Log.Info("DVDPlayer:failed 2 disable Closed Captions"); } } } /* // get video window if (_videoWin==null) { riid = typeof( IVideoWindow ).GUID; hr = _dvdGraph.GetDvdInterface( ref riid, out comobj ); if( hr < 0 ) Marshal.ThrowExceptionForHR( hr ); _videoWin = (IVideoWindow) comobj; comobj = null; } */ // GetFrameStepInterface(); DirectShowUtil.SetARMode(_graphBuilder, arMode); DirectShowUtil.EnableDeInterlace(_graphBuilder); //m_ovMgr = new OVTOOLLib.OvMgrClass(); //m_ovMgr.SetGraph(_graphBuilder); return true; } catch (Exception) { //MessageBox.Show( this, "Could not get interfaces\r\n" + ee.Message, "DVDPlayer.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop ); CloseInterfaces(); return false; } finally { if (comobj != null) { DirectShowUtil.ReleaseComObject(comobj); } comobj = null; } }
public static extern void QSizeScale(ref Size size, int width, int height, AspectRatioMode mode);
/// <summary> create the used COM components and get the interfaces. </summary> protected virtual bool GetDVDInterfaces(string path) { int hr; //Type comtype = null; object comobj = null; _freeNavigator = true; _dvdInfo = null; _dvdCtrl = null; bool useAC3Filter = false; string dvdNavigator = ""; string aspectRatioMode = ""; string displayMode = ""; _videoPref = DvdPreferredDisplayMode.DisplayContentDefault; using (MediaPortal.Profile.Settings xmlreader = new MPSettings()) { dvdNavigator = xmlreader.GetValueAsString("dvdplayer", "navigator", "DVD Navigator"); aspectRatioMode = xmlreader.GetValueAsString("dvdplayer", "armode", "").ToLower(); dvdNavigator = "dslibdvdnav"; if (aspectRatioMode == "crop") { arMode = AspectRatioMode.Crop; } if (aspectRatioMode == "letterbox") { arMode = AspectRatioMode.LetterBox; } if (aspectRatioMode == "stretch") { arMode = AspectRatioMode.Stretched; } //if ( aspectRatioMode == "stretch" ) arMode = AspectRatioMode.zoom14to9; if (aspectRatioMode == "follow stream") { arMode = AspectRatioMode.StretchedAsPrimary; } useAC3Filter = xmlreader.GetValueAsBool("dvdplayer", "ac3", false); displayMode = xmlreader.GetValueAsString("dvdplayer", "displaymode", "").ToLower(); if (displayMode == "default") { _videoPref = DvdPreferredDisplayMode.DisplayContentDefault; } if (displayMode == "16:9") { _videoPref = DvdPreferredDisplayMode.Display16x9; } if (displayMode == "4:3 pan scan") { _videoPref = DvdPreferredDisplayMode.Display4x3PanScanPreferred; } if (displayMode == "4:3 letterbox") { _videoPref = DvdPreferredDisplayMode.Display4x3LetterBoxPreferred; } } try { _dvdGraph = (IDvdGraphBuilder)new DvdGraphBuilder(); hr = _dvdGraph.GetFiltergraph(out _graphBuilder); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _rotEntry = new DsROTEntry((IFilterGraph)_graphBuilder); _vmr9Filter = (IBaseFilter)new VideoMixingRenderer9(); IVMRFilterConfig9 config = _vmr9Filter as IVMRFilterConfig9; hr = config.SetNumberOfStreams(1); hr = config.SetRenderingMode(VMR9Mode.Windowless); windowlessCtrl = (IVMRWindowlessControl9)_vmr9Filter; windowlessCtrl.SetVideoClippingWindow(this.panVideoWin.Handle); // config.SetRenderingPrefs(VMR9RenderPrefs. _graphBuilder.AddFilter(_vmr9Filter, "Video Mixing Renderer 9"); // _vmr7 = new VMR7Util(); // _vmr7.AddVMR7(_graphBuilder); try { _dvdbasefilter = DirectShowUtil.AddFilterToGraph(_graphBuilder, dvdNavigator); if (_dvdbasefilter != null) { IDvdControl2 cntl = (IDvdControl2)_dvdbasefilter; if (cntl != null) { _dvdInfo = (IDvdInfo2)cntl; _dvdCtrl = (IDvdControl2)cntl; if (path != null) { if (path.Length != 0) { cntl.SetDVDDirectory(path); } } _dvdCtrl.SetOption(DvdOptionFlag.HMSFTimeCodeEvents, true); // use new HMSF timecode format _dvdCtrl.SetOption(DvdOptionFlag.ResetOnStop, false); AddPreferedCodecs(_graphBuilder); DirectShowUtil.RenderOutputPins(_graphBuilder, _dvdbasefilter); // _videoWin = _graphBuilder as IVideoWindow; _freeNavigator = false; } //DirectShowUtil.ReleaseComObject( _dvdbasefilter); _dvdbasefilter = null; } } catch (Exception ex) { string strEx = ex.Message; } Guid riid; if (_dvdInfo == null) { riid = typeof(IDvdInfo2).GUID; hr = _dvdGraph.GetDvdInterface(riid, out comobj); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _dvdInfo = (IDvdInfo2)comobj; comobj = null; } if (_dvdCtrl == null) { riid = typeof(IDvdControl2).GUID; hr = _dvdGraph.GetDvdInterface(riid, out comobj); if (hr < 0) { Marshal.ThrowExceptionForHR(hr); } _dvdCtrl = (IDvdControl2)comobj; comobj = null; } _mediaCtrl = (IMediaControl)_graphBuilder; _mediaEvt = (IMediaEventEx)_graphBuilder; _basicAudio = _graphBuilder as IBasicAudio; _mediaPos = (IMediaPosition)_graphBuilder; _mediaSeek = (IMediaSeeking)_graphBuilder; _mediaStep = (IVideoFrameStep)_graphBuilder; _basicVideo = _graphBuilder as IBasicVideo2; _videoWin = _graphBuilder as IVideoWindow; // disable Closed Captions! IBaseFilter baseFilter; _graphBuilder.FindFilterByName("Line 21 Decoder", out baseFilter); if (baseFilter == null) { _graphBuilder.FindFilterByName("Line21 Decoder", out baseFilter); } if (baseFilter != null) { _line21Decoder = (IAMLine21Decoder)baseFilter; if (_line21Decoder != null) { AMLine21CCState state = AMLine21CCState.Off; hr = _line21Decoder.SetServiceState(state); if (hr == 0) { logger.Info("DVDPlayer:Closed Captions disabled"); } else { logger.Info("DVDPlayer:failed 2 disable Closed Captions"); } } } /* // get video window if (_videoWin==null) { riid = typeof( IVideoWindow ).GUID; hr = _dvdGraph.GetDvdInterface( ref riid, out comobj ); if( hr < 0 ) Marshal.ThrowExceptionForHR( hr ); _videoWin = (IVideoWindow) comobj; comobj = null; } */ // GetFrameStepInterface(); DirectShowUtil.SetARMode(_graphBuilder, arMode); DirectShowUtil.EnableDeInterlace(_graphBuilder); //m_ovMgr = new OVTOOLLib.OvMgrClass(); //m_ovMgr.SetGraph(_graphBuilder); return true; } catch (Exception) { //MessageBox.Show( this, "Could not get interfaces\r\n" + ee.Message, "DVDPlayer.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop ); CloseDVDInterfaces(); return false; } finally { if (comobj != null) { DirectShowUtil.ReleaseComObject(comobj); } comobj = null; } }
/// <summary> /// Find the overlay mixer and/or the VMR9 windowless filters /// and tell them we dont want a fixed Aspect Ratio /// Mediaportal handles AR itself /// </summary> /// <param name="graphBuilder"></param> public static void SetARMode(IGraphBuilder graphBuilder, AspectRatioMode ARRatioMode) { int hr; IBaseFilter overlay; graphBuilder.FindFilterByName("Overlay Mixer2", out overlay); if (overlay != null) { IPin iPin; overlay.FindPin("Input0", out iPin); if (iPin != null) { IMixerPinConfig pMC = iPin as IMixerPinConfig; if (pMC != null) { AspectRatioMode mode; hr = pMC.SetAspectRatioMode(ARRatioMode); hr = pMC.GetAspectRatioMode(out mode); //ReleaseComObject(pMC); } ReleaseComObject(iPin); } ReleaseComObject(overlay); } IEnumFilters enumFilters; hr = graphBuilder.EnumFilters(out enumFilters); if (hr >= 0 && enumFilters != null) { int iFetched; enumFilters.Reset(); IBaseFilter[] pBasefilter = new IBaseFilter[2]; do { pBasefilter = null; hr = enumFilters.Next(1, pBasefilter, out iFetched); if (hr == 0 && iFetched == 1 && pBasefilter[0] != null) { IVMRAspectRatioControl pARC = pBasefilter[0] as IVMRAspectRatioControl; if (pARC != null) { pARC.SetAspectRatioMode(VMRAspectRatioMode.None); } IVMRAspectRatioControl9 pARC9 = pBasefilter[0] as IVMRAspectRatioControl9; if (pARC9 != null) { pARC9.SetAspectRatioMode(VMRAspectRatioMode.None); } IEnumPins pinEnum; hr = pBasefilter[0].EnumPins(out pinEnum); if ((hr == 0) && (pinEnum != null)) { pinEnum.Reset(); IPin[] pins = new IPin[1]; int f; do { // Get the next pin hr = pinEnum.Next(1, pins, out f); if (f == 1 && hr == 0 && pins[0] != null) { IMixerPinConfig pMC = pins[0] as IMixerPinConfig; if (null != pMC) { pMC.SetAspectRatioMode(ARRatioMode); } ReleaseComObject(pins[0]); } } while (f == 1); ReleaseComObject(pinEnum); } ReleaseComObject(pBasefilter[0]); } } while (iFetched == 1 && pBasefilter[0] != null); ReleaseComObject(enumFilters); } }
public void scale(float w, float h, AspectRatioMode mode) { this.scale(new LDSize(w, h), mode); }
public void Scale(int width, int height, AspectRatioMode mode) { Internal.QSizeScale(ref this, width, height, mode); }
public LDSize scaled(float w, float h, AspectRatioMode mode) { return(this.scaled(new LDSize(w, h), mode)); }
private static extern IntPtr qt_pixmap_scaled(IntPtr raw, IntPtr size, AspectRatioMode aspectMode, TransformationMode mode);