OSDN Git Service

#36708 StageClear演出、FCEXC演出のクラスを追加。 work-36708
authorkairera0467 <gennsou76573@gmail.com>
Sat, 10 Dec 2016 01:35:43 +0000 (10:35 +0900)
committerkairera0467 <gennsou76573@gmail.com>
Sat, 10 Dec 2016 01:35:43 +0000 (10:35 +0900)
#xxxxx MemoryRendererでDirectShow動画を扱えるようにした。

DTXManiaプロジェクト/DTXManiaプロジェクト.csproj
DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏FCEXC演出.cs [new file with mode: 0644]
DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏StageClear.cs [new file with mode: 0644]
DTXManiaプロジェクト/コード/ステージ/07.演奏/CStage演奏画面共通.cs
DTXManiaプロジェクト/コード/全体/CDTXMania.cs
FDK17プロジェクト/コード/04.グラフィック/CAviDS.cs
FDK17プロジェクト/コード/05.DirectShow/CDirectShow.cs

index c4715b0..751e407 100644 (file)
     <Compile Include="コード\ステージ\07.演奏\CAct演奏Combo共通.cs" />
     <Compile Include="コード\ステージ\07.演奏\CAct演奏Danger共通.cs" />
     <Compile Include="コード\ステージ\07.演奏\CAct演奏RGB共通.cs" />
+    <Compile Include="コード\ステージ\07.演奏\CAct演奏FCEXC演出.cs" />
+    <Compile Include="コード\ステージ\07.演奏\CAct演奏StageClear.cs" />
     <Compile Include="コード\ステージ\07.演奏\CAct演奏WailingBonus共通.cs" />
     <Compile Include="コード\ステージ\07.演奏\CAct演奏ゲージ共通.cs" />
     <Compile Include="コード\ステージ\07.演奏\CAct演奏スクロール速度.cs" />
diff --git a/DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏FCEXC演出.cs b/DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏FCEXC演出.cs
new file mode 100644 (file)
index 0000000..b647fda
--- /dev/null
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using FDK;
+
+namespace DTXMania
+{
+       internal class CAct演奏FCEXC演出 : CActivity
+       {
+        //FC、EXC演出をするメソッド。
+        //FIFOメソッドの拡張
+
+               // メソッド
+
+               public void t開始()
+               {
+                       this.counter = new CCounter( 0, 100, 5, CDTXMania.Timer );
+               }
+               public void t演出終了()
+               {
+                       this.counter.n現在の値 = this.counter.n終了値;
+               }
+
+               // CActivity 実装
+
+               public override void On非活性化()
+               {
+                       if( !base.b活性化してない )
+                       {
+                               CDTXMania.tテクスチャの解放( ref this.tx黒タイル64x64 );
+                               base.On非活性化();
+                       }
+               }
+               public override void OnManagedリソースの作成()
+               {
+                       if( !base.b活性化してない )
+                       {
+                               this.tx黒タイル64x64 = CDTXMania.tテクスチャの生成( CSkin.Path( @"Graphics\Tile black 64x64.png" ), false );
+                               base.OnManagedリソースの作成();
+                       }
+               }
+               public override int On進行描画()
+               {
+                       if( base.b活性化してない || ( this.counter == null ) )
+                       {
+                               return 0;
+                       }
+                       this.counter.t進行();
+
+                       if( this.tx黒タイル64x64 != null )
+                       {
+                               this.tx黒タイル64x64.n透明度 = 0;
+                               for( int i = 0; i <= ( SampleFramework.GameWindowSize.Width / 64 ); i++ )               // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
+                               {
+                                       for( int j = 0; j <= (SampleFramework.GameWindowSize.Height / 64 ); j++ )       // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
+                                       {
+                                               this.tx黒タイル64x64.t2D描画( CDTXMania.app.Device, i * 64, j * 64 );
+                                       }
+                               }
+                       }
+                       if( this.counter.n現在の値 != 100 )
+                       {
+                               return 0;
+                       }
+                       return 1;
+               }
+
+
+               // その他
+
+               #region [ private ]
+               //-----------------
+               private CCounter counter;
+               private CTexture tx黒タイル64x64;
+        private CTexture tx描画用;
+               //-----------------
+               #endregion
+       }
+}
diff --git a/DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏StageClear.cs b/DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏StageClear.cs
new file mode 100644 (file)
index 0000000..0ad1d09
--- /dev/null
@@ -0,0 +1,86 @@
+using DirectShowLib;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using FDK;
+
+namespace DTXMania
+{
+       internal class CAct演奏StageClear : CActivity
+       {
+               // メソッド
+
+               public void t開始()
+               {
+                       this.counter = new CCounter( 0, 200, 5, CDTXMania.Timer );
+               }
+               public void t完了()
+               {
+                       this.counter.n現在の値 = this.counter.n終了値;
+               }
+
+               // CActivity 実装
+
+               public override void On非活性化()
+               {
+                       if( !base.b活性化してない )
+                       {
+                               CDTXMania.tテクスチャの解放( ref this.tx描画用 );
+                CDTXMania.t安全にDisposeする( ref this.dsStageClear );
+                               base.On非活性化();
+                       }
+               }
+               public override void OnManagedリソースの作成()
+               {
+                       if( !base.b活性化してない )
+                       {
+                this.tx描画用 = new CTexture( CDTXMania.app.Device, 1280, 720, CDTXMania.TextureFormat );
+                this.dsStageClear = CDTXMania.t失敗してもスキップ可能なDirectShowを生成する( CSkin.Path( @"Graphics\7_StageClear.mp4" ), CDTXMania.app.WindowHandle, true, true );
+                               base.OnManagedリソースの作成();
+                       }
+               }
+               public override int On進行描画()
+               {
+                       if( base.b活性化してない || ( this.counter == null ) )
+                       {
+                               return 0;
+                       }
+            if( base.b初めての進行描画 )
+            {
+                CDTXMania.Skin.soundステージクリア音.t再生する();
+                base.b初めての進行描画 = true;
+            }
+                       this.counter.t進行();
+
+
+                       
+                       if( CDTXMania.Skin.soundステージクリア音.b再生中 )
+                       {
+                               return 0;
+                       }
+
+            if( CDTXMania.Skin.soundステージクリア音 == null )
+            {
+                if( this.counter.b終了値に達した )
+                {
+                    return 1;
+                }
+            }
+                       return 1;
+               }
+
+
+               // その他
+
+               #region [ private ]
+               //-----------------
+               private CCounter counter;
+               private EFIFOモード mode;
+               private CTexture tx白タイル64x64;
+        private CTexture tx描画用;
+        private CDirectShow dsStageClear;
+               //-----------------
+               #endregion
+       }
+}
index 228aee9..29860d2 100644 (file)
@@ -668,6 +668,7 @@ namespace DTXMania
                protected CAct演奏演奏情報 actPlayInfo;
                protected CAct演奏RGB共通 actRGB;
                public CAct演奏スコア共通 actScore;
+        protected CAct演奏StageClear actStageClear;
                protected CAct演奏ステージ失敗 actStageFailed;
                protected CAct演奏ステータスパネル共通 actStatusPanels;
                protected CAct演奏WailingBonus共通 actWailingBonus;
@@ -3498,9 +3499,8 @@ namespace DTXMania
                                                return true;
                                        }
                                        break;
-
                                case CStage.Eフェーズ.演奏_STAGE_CLEAR_フェードアウト:
-                                       if ( this.actFOClear.On進行描画() == 0 )
+                                       if ( this.actFO.On進行描画() == 0 )
                                        {
                                                break;
                                        }
index 4a3b15d..444d922 100644 (file)
@@ -1731,12 +1731,16 @@ for (int i = 0; i < 3; i++) {
                #endregion
         public static CDirectShow t失敗してもスキップ可能なDirectShowを生成する( string fileName, IntPtr hWnd, bool bオーディオレンダラなし )
         {
+            return t失敗してもスキップ可能なDirectShowを生成する( fileName, hWnd, bオーディオレンダラなし, false );
+        }
+        public static CDirectShow t失敗してもスキップ可能なDirectShowを生成する( string fileName, IntPtr hWnd, bool bオーディオレンダラなし, bool bMemoryRenderer )
+        {
             CDirectShow ds = null;
             if( File.Exists( fileName ) )
             {
                 try
                 {
-                    ds = new CDirectShow( fileName, hWnd, bオーディオレンダラなし );
+                    ds = new CDirectShow( fileName, hWnd, bMemoryRenderer, bオーディオレンダラなし );
                 }
                 catch( FileNotFoundException )
                 {
index e7d8476..eccaefc 100644 (file)
@@ -91,7 +91,7 @@ namespace FDK
 
                        // Null レンダラに接続しないとウィンドウが表示される。
                        // また、レンダリングを行わないため処理速度を向上できる。
-                       CDirectShow.ConnectNullRendererFromSampleGrabber(builder, grabber as IBaseFilter);
+                       CDirectShow.ConnectNullRendererFromSampleGrabber(builder, grabber as IBaseFilter, false);
                        CDirectShow.tグラフを解析しデバッグ出力する(builder);
 
                        IVideoWindow videoWindow = builder as IVideoWindow;
index ea51a7f..a5a4ae1 100644 (file)
@@ -249,7 +249,7 @@ namespace FDK
                public CDirectShow()
                {
                }
-               public CDirectShow( string fileName, IntPtr hWnd, bool bオーディオレンダラなし )
+               public CDirectShow( string fileName, IntPtr hWnd, bool bMemoryRenderer, bool bオーディオレンダラなし )
                {
                        // 初期化。
 
@@ -328,10 +328,23 @@ namespace FDK
 
 
                                // 音声のみ?
-
+                if( bMemoryRenderer )
                                {
                                        IBaseFilter videoRenderer;
                                        IPin videoInputPin;
+                                       CDirectShow.tビデオレンダラとその入力ピンを探して返す( this.graphBuilder, out videoRenderer, out videoInputPin );
+                                       if( videoRenderer == null )
+                                               this.b音声のみ = true;
+                                       else
+                                       {
+                                               C共通.tCOMオブジェクトを解放する( ref videoInputPin );
+                                               C共通.tCOMオブジェクトを解放する( ref videoRenderer );
+                                       }
+                               }
+                else
+                {
+                                       IBaseFilter videoRenderer;
+                                       IPin videoInputPin;
                                        IBaseFilter audioRenderer;
                                        IPin audioInputPin;
                                        CDirectShow.SearchMMRenderers( this.graphBuilder, out videoRenderer, out videoInputPin, out audioRenderer, out audioInputPin );
@@ -346,7 +359,7 @@ namespace FDK
                                                C共通.tCOMオブジェクトを解放する(ref audioInputPin);
                                                C共通.tCOMオブジェクトを解放する(ref audioRenderer);
                                        }
-                               }
+                }
 
 
                                // イメージ情報を取得。
@@ -841,7 +854,7 @@ namespace FDK
                                C共通.tCOMオブジェクトを解放する( ref audioRenderer );
                        }
                }
-               public static void ConnectNullRendererFromSampleGrabber(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber)
+               public static void ConnectNullRendererFromSampleGrabber(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber, bool bMemoryRenderer )
                {
                        int hr = 0;
                        IBaseFilter videoRenderer = null;
@@ -849,79 +862,128 @@ namespace FDK
                        IBaseFilter audioRenderer = null;
                        IPin audioRendererInputPin = null;
                        IPin connectedOutputPin = null;
+            IPin rendererConnectedOutputPin = null;
                        IPin nullRendererInputPin = null;
                        IPin grabberOutputPin = null;
                        IPin grabberOutputConnectedPin = null;
 
                        try
                        {
-                               // videoRenderer を探す。
-                               CDirectShow.SearchMMRenderers(graphBuilder, out videoRenderer, out videoRendererInputPin, out audioRenderer, out audioRendererInputPin);
-                               if (videoRenderer != null && audioRendererInputPin != null)
-                               {
-                                       // 既存のレンダラにつながっているピン対を取得
-                                       hr = videoRendererInputPin.ConnectedTo(out connectedOutputPin);
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       // それらを切断。前段の出力ピンとビデオレンダラの入力ピンを切断する。双方向から切断しないとグラフから切り離されないので注意。
-                                       hr = videoRendererInputPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = connectedOutputPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       // ビデオレンダラをグラフから除去し、ヌルレンダラを追加
-                                       hr = graphBuilder.RemoveFilter(videoRenderer);
-                                       DsError.ThrowExceptionForHR(hr);
-                                       IBaseFilter nullRenderer = new NullRenderer() as IBaseFilter;
-                                       hr = graphBuilder.AddFilter(nullRenderer, "Video Null Renderer");
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       // nullRenderer の入力ピンを探す。
-                                       hr = nullRenderer.FindPin("In", out nullRendererInputPin);
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = nullRendererInputPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       // グラバの Out と Null Renderer の In を接続する。
-                                       hr = sampleGrabber.FindPin("Out", out grabberOutputPin);
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = grabberOutputPin.ConnectedTo(out grabberOutputConnectedPin);
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = grabberOutputConnectedPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = grabberOutputPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = grabberOutputPin.Connect(nullRendererInputPin, null);
-                                       DsError.ThrowExceptionForHR(hr);
-                               }
-
-                               if( audioRenderer != null && audioRendererInputPin != null )
-                               {
-                                       C共通.tCOMオブジェクトを解放する(ref connectedOutputPin);
-
-                                       // 既存のレンダラにつながっているピン対を取得
-                                       hr = audioRendererInputPin.ConnectedTo(out connectedOutputPin);
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       // それらを切断。前段の出力ピンとビデオレンダラの入力ピンを切断する。双方向から切断しないとグラフから切り離されないので注意。
-                                       hr = audioRendererInputPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = connectedOutputPin.Disconnect();
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       // ビデオレンダラをグラフから除去し、ヌルレンダラを追加
-                                       hr = graphBuilder.RemoveFilter(audioRenderer);
-                                       DsError.ThrowExceptionForHR(hr);
-                                       IBaseFilter nullRenderer = new NullRenderer() as IBaseFilter;
-                                       hr = graphBuilder.AddFilter(nullRenderer, "Audio Null Renderer");
-                                       DsError.ThrowExceptionForHR(hr);
-
-                                       C共通.tCOMオブジェクトを解放する(ref nullRendererInputPin);
-                                       hr = nullRenderer.FindPin("In", out nullRendererInputPin);
-                                       DsError.ThrowExceptionForHR(hr);
-                                       hr = connectedOutputPin.Connect(nullRendererInputPin, null);
-                                       DsError.ThrowExceptionForHR(hr);
-                               }
+                if( bMemoryRenderer )
+                {
+                    // videoRenderer を探す。
+                               CDirectShow.tビデオレンダラとその入力ピンを探して返す(graphBuilder, out videoRenderer, out videoRendererInputPin);
+                               if(videoRenderer==null || videoRendererInputPin ==null)
+                               {
+                                       return;
+                                   }
+                               // 既存のレンダラにつながっているピン対を取得
+                               hr = videoRendererInputPin.ConnectedTo(out connectedOutputPin);
+                               DsError.ThrowExceptionForHR(hr);
+                    hr = videoRendererInputPin.ConnectedTo(out rendererConnectedOutputPin);
+                                   DsError.ThrowExceptionForHR(hr);
+                               
+                               // それらを切断。前段の出力ピンとビデオレンダラの入力ピンを切断する。双方向から切断しないとグラフから切り離されないので注意。
+                    hr = videoRendererInputPin.Disconnect();
+                               DsError.ThrowExceptionForHR(hr);
+                               hr = connectedOutputPin.Disconnect();
+                                   DsError.ThrowExceptionForHR(hr);
+                               
+                               // ビデオレンダラをグラフから除去し、ヌルレンダラを追加
+                               hr = graphBuilder.RemoveFilter(videoRenderer);
+                               DsError.ThrowExceptionForHR(hr);
+                               IBaseFilter nullRenderer = new NullRenderer() as IBaseFilter;
+                                   hr = graphBuilder.AddFilter(nullRenderer, "Null Renderer");
+                               DsError.ThrowExceptionForHR(hr);
+
+                               // nullRenderer の入力ピンを探す。
+                               hr = nullRenderer.FindPin("In", out nullRendererInputPin);
+                               DsError.ThrowExceptionForHR(hr);
+                                   hr = nullRendererInputPin.Disconnect();
+                               DsError.ThrowExceptionForHR(hr);
+
+                               // グラバの Out と Null Renderer の In を接続する。
+                               hr = sampleGrabber.FindPin("Out", out grabberOutputPin);
+                               DsError.ThrowExceptionForHR(hr);
+                                   hr = grabberOutputPin.ConnectedTo(out grabberOutputConnectedPin);
+                               DsError.ThrowExceptionForHR(hr);
+                               hr = grabberOutputConnectedPin.Disconnect();
+                               DsError.ThrowExceptionForHR(hr);
+                               hr = grabberOutputPin.Disconnect();
+                                   DsError.ThrowExceptionForHR(hr);
+                               hr = grabberOutputPin.Connect(nullRendererInputPin, null);
+                               DsError.ThrowExceptionForHR(hr);
+                }
+                else
+                {
+                               // videoRenderer を探す。
+                               CDirectShow.SearchMMRenderers(graphBuilder, out videoRenderer, out videoRendererInputPin, out audioRenderer, out audioRendererInputPin);
+                               if (videoRenderer != null && audioRendererInputPin != null)
+                               {
+                                       // 既存のレンダラにつながっているピン対を取得
+                                       hr = videoRendererInputPin.ConnectedTo(out connectedOutputPin);
+                                       DsError.ThrowExceptionForHR(hr);
+
+                                       // それらを切断。前段の出力ピンとビデオレンダラの入力ピンを切断する。双方向から切断しないとグラフから切り離されないので注意。
+                                       hr = videoRendererInputPin.Disconnect();
+                                           DsError.ThrowExceptionForHR(hr);
+                                       hr = connectedOutputPin.Disconnect();
+                                       DsError.ThrowExceptionForHR(hr);
+
+                                       // ビデオレンダラをグラフから除去し、ヌルレンダラを追加
+                                       hr = graphBuilder.RemoveFilter(videoRenderer);
+                                       DsError.ThrowExceptionForHR(hr);
+                                           IBaseFilter nullRenderer = new NullRenderer() as IBaseFilter;
+                                       hr = graphBuilder.AddFilter(nullRenderer, "Video Null Renderer");
+                                       DsError.ThrowExceptionForHR(hr);
+
+                                       // nullRenderer の入力ピンを探す。
+                                       hr = nullRenderer.FindPin("In", out nullRendererInputPin);
+                                       DsError.ThrowExceptionForHR(hr);
+                                           hr = nullRendererInputPin.Disconnect();
+                                       DsError.ThrowExceptionForHR(hr);
+
+                                       // グラバの Out と Null Renderer の In を接続する。
+                                       hr = sampleGrabber.FindPin("Out", out grabberOutputPin);
+                                       DsError.ThrowExceptionForHR(hr);
+                                       hr = grabberOutputPin.ConnectedTo(out grabberOutputConnectedPin);
+                                           DsError.ThrowExceptionForHR(hr);
+                                       hr = grabberOutputConnectedPin.Disconnect();
+                                       DsError.ThrowExceptionForHR(hr);
+                                       hr = grabberOutputPin.Disconnect();
+                                       DsError.ThrowExceptionForHR(hr);
+                                       hr = grabberOutputPin.Connect(nullRendererInputPin, null);
+                                           DsError.ThrowExceptionForHR(hr);
+                                   }
+
+                               if( audioRenderer != null && audioRendererInputPin != null )
+                               {
+                                       C共通.tCOMオブジェクトを解放する(ref connectedOutputPin);
+
+                                       // 既存のレンダラにつながっているピン対を取得
+                                           hr = audioRendererInputPin.ConnectedTo(out connectedOutputPin);
+                                       DsError.ThrowExceptionForHR(hr);
+
+                                       // それらを切断。前段の出力ピンとビデオレンダラの入力ピンを切断する。双方向から切断しないとグラフから切り離されないので注意。
+                                       hr = audioRendererInputPin.Disconnect();
+                                       DsError.ThrowExceptionForHR(hr);
+                                       hr = connectedOutputPin.Disconnect();
+                                           DsError.ThrowExceptionForHR(hr);
+
+                                       // ビデオレンダラをグラフから除去し、ヌルレンダラを追加
+                                       hr = graphBuilder.RemoveFilter(audioRenderer);
+                                       DsError.ThrowExceptionForHR(hr);
+                                       IBaseFilter nullRenderer = new NullRenderer() as IBaseFilter;
+                                           hr = graphBuilder.AddFilter(nullRenderer, "Audio Null Renderer");
+                                       DsError.ThrowExceptionForHR(hr);
+
+                                       C共通.tCOMオブジェクトを解放する(ref nullRendererInputPin);
+                                       hr = nullRenderer.FindPin("In", out nullRendererInputPin);
+                                       DsError.ThrowExceptionForHR(hr);
+                                       hr = connectedOutputPin.Connect(nullRendererInputPin, null);
+                                           DsError.ThrowExceptionForHR(hr);
+                                   }
+                }
                        }
                        finally
                        {
@@ -936,6 +998,50 @@ namespace FDK
                        }
                }
 
+               public static void tビデオレンダラをグラフから除去する( IGraphBuilder graphBuilder )
+               {
+                       int hr = 0;
+
+                       IBaseFilter videoRenderer = null;
+                       IPin renderInputPin = null;
+                       IPin connectedOutputPin = null;
+
+                       try
+                       {
+                               // videoRenderer を探す。
+                               
+                               CDirectShow.tビデオレンダラとその入力ピンを探して返す( graphBuilder, out videoRenderer, out renderInputPin );
+                               if( videoRenderer == null || renderInputPin == null )
+                                       return;         // なかった
+
+                               #region [ renderInputPin へ接続している前段の出力ピン connectedOutputPin を探す。 ]
+                               //-----------------
+                               renderInputPin.ConnectedTo( out connectedOutputPin );
+                               //-----------------
+                               #endregion
+
+                               if( connectedOutputPin == null )
+                                       return;         // なかった
+
+
+                               // 前段の出力ピンとビデオレンダラの入力ピンを切断する。双方向から切断しないとグラフから切り離されないので注意。
+
+                               renderInputPin.Disconnect();
+                               connectedOutputPin.Disconnect();
+
+
+                               // ビデオレンダラをグラフから除去。
+
+                               graphBuilder.RemoveFilter( videoRenderer );
+                       }
+                       finally
+                       {
+                               C共通.tCOMオブジェクトを解放する( ref connectedOutputPin );
+                               C共通.tCOMオブジェクトを解放する( ref renderInputPin );
+                               C共通.tCOMオブジェクトを解放する( ref videoRenderer );
+                       }
+               }
+
                private static IPin t最初の入力ピンを探して返す( IBaseFilter baseFilter )
                {
                        int hr = 0;
@@ -980,6 +1086,159 @@ namespace FDK
 
                        return firstInputPin;
                }
+
+               private static void tビデオレンダラとその入力ピンを探して返す( IFilterGraph graph, out IBaseFilter videoRenderer, out IPin inputPin )
+               {
+                       int hr = 0;
+                       string strフィルタ名 = null;
+                       string strピンID = null;
+
+
+                       // ビデオレンダラと入力ピンを探し、そのフィルタ名とピンIDを控える。
+
+                       IEnumFilters eFilters;
+                       hr = graph.EnumFilters( out eFilters );
+                       DsError.ThrowExceptionForHR( hr );
+                       try
+                       {
+                               var filters = new IBaseFilter[ 1 ];
+                               while( eFilters.Next( 1, filters, IntPtr.Zero ) == CWin32.S_OK )
+                               {
+                                       try
+                                       {
+                                               #region [ 出力ピンがない(レンダラである)ことを確認する。]
+                                               //-----------------
+                                               IEnumPins ePins;
+                                               bool b出力ピンがある = false;
+
+                                               hr = filters[ 0 ].EnumPins( out ePins );
+                                               DsError.ThrowExceptionForHR( hr );
+                                               try
+                                               {
+                                                       var pins = new IPin[ 1 ];
+                                                       while( ePins.Next( 1, pins, IntPtr.Zero ) == CWin32.S_OK )
+                                                       {
+                                                               try
+                                                               {
+                                                                       if( b出力ピンがある )
+                                                                               continue;
+
+                                                                       PinDirection dir;
+                                                                       hr = pins[ 0 ].QueryDirection( out dir );
+                                                                       DsError.ThrowExceptionForHR( hr );
+                                                                       if( dir == PinDirection.Output )
+                                                                               b出力ピンがある = true;
+                                                               }
+                                                               finally
+                                                               {
+                                                                       C共通.tCOMオブジェクトを解放する( ref pins[ 0 ] );
+                                                               }
+                                                       }
+                                               }
+                                               finally
+                                               {
+                                                       C共通.tCOMオブジェクトを解放する( ref ePins );
+                                               }
+
+                                               if( b出力ピンがある )
+                                                       continue;       // 次のフィルタへ
+
+                                               //-----------------
+                                               #endregion
+                                               #region [ 接続中の入力ピンが MEDIATYPE_Video に対応していたら、フィルタ名とピンIDを取得する。]
+                                               //-----------------
+                                               hr = filters[ 0 ].EnumPins( out ePins );
+                                               DsError.ThrowExceptionForHR( hr );
+                                               try
+                                               {
+                                                       var pins = new IPin[ 1 ];
+                                                       while( ePins.Next( 1, pins, IntPtr.Zero ) == CWin32.S_OK )
+                                                       {
+                                                               try
+                                                               {
+                                                                       if( !string.IsNullOrEmpty( strフィルタ名 ) )
+                                                                               continue;
+
+                                                                       var mediaType = new AMMediaType();
+
+                                                                       #region [ 現在接続中の MediaType を取得。つながってなければ次のピンへ。]
+                                                                       //-----------------
+                                                                       hr = pins[ 0 ].ConnectionMediaType( mediaType );
+                                                                       if( hr == CWin32.VFW_E_NOT_CONNECTED )
+                                                                               continue;       // つながってない
+                                                                       DsError.ThrowExceptionForHR( hr );
+                                                                       //-----------------
+                                                                       #endregion
+
+                                                                       try
+                                                                       {
+                                                                               if( mediaType.majorType.Equals( MediaType.Video ) )
+                                                                               {
+                                                                                       #region [ フィルタ名取得!]
+                                                                                       //-----------------
+                                                                                       FilterInfo filterInfo;
+                                                                                       hr = filters[ 0 ].QueryFilterInfo( out filterInfo );
+                                                                                       DsError.ThrowExceptionForHR( hr );
+                                                                                       strフィルタ名 = filterInfo.achName;
+                                                                                       C共通.tCOMオブジェクトを解放する( ref filterInfo.pGraph );
+                                                                                       //-----------------
+                                                                                       #endregion
+                                                                                       #region [ ピンID取得!]
+                                                                                       //-----------------
+                                                                                       hr = pins[ 0 ].QueryId( out strピンID );
+                                                                                       DsError.ThrowExceptionForHR( hr );
+                                                                                       //-----------------
+                                                                                       #endregion
+
+                                                                                       continue;       // 次のピンへ。
+                                                                               }
+                                                                       }
+                                                                       finally
+                                                                       {
+                                                                               DsUtils.FreeAMMediaType( mediaType );
+                                                                       }
+                                                               }
+                                                               finally
+                                                               {
+                                                                       C共通.tCOMオブジェクトを解放する( ref pins[ 0 ] );
+                                                               }
+                                                       }
+                                               }
+                                               finally
+                                               {
+                                                       C共通.tCOMオブジェクトを解放する( ref ePins );
+                                               }
+
+                                               //-----------------
+                                               #endregion
+                                       }
+                                       finally
+                                       {
+                                               C共通.tCOMオブジェクトを解放する( ref filters[ 0 ] );
+                                       }
+                               }
+                       }
+                       finally
+                       {
+                               C共通.tCOMオブジェクトを解放する( ref eFilters );
+                       }
+
+
+                       // 改めてフィルタ名とピンIDからこれらのインターフェースを取得し、戻り値として返す。
+
+                       videoRenderer = null;
+                       inputPin = null;
+
+                       if( !string.IsNullOrEmpty( strフィルタ名 ) )
+                       {
+                               hr = graph.FindFilterByName( strフィルタ名, out videoRenderer );
+                               DsError.ThrowExceptionForHR( hr );
+
+                               hr = videoRenderer.FindPin( strピンID, out inputPin );
+                               DsError.ThrowExceptionForHR( hr );
+                       }
+               }
+
                private static void SearchMMRenderers( IFilterGraph graph, out IBaseFilter videoRenderer, out IPin inputVPin, out IBaseFilter audioRenderer, out IPin inputAPin )
                {
                        int hr = 0;