/// <summary> /// デバッグ /// </summary> /// <param name="graph"></param> private void DebugPrint(IGraphBuilder graph) { IEnumFilters filters = null; IBaseFilter filter = null; int fetched = 0; int hr = graph.EnumFilters(ref filters); while (filters.Next(1, ref filter, ref fetched) == (int)DSLab.HRESULT.S_OK) { if (fetched == 0) break; FILTER_INFO info = new FILTER_INFO(); hr = filter.QueryFilterInfo(info); Console.WriteLine("{0}", info.achName); // フィルタ解放. Marshal.ReleaseComObject(filter); filter = null; } // 解放. Marshal.ReleaseComObject(filters); // サンプルグラバフィルタの入力形式設定. // majortype: http://msdn.microsoft.com/ja-jp/library/cc370108.aspx // subtype : http://msdn.microsoft.com/ja-jp/library/cc371040.aspx AM_MEDIA_TYPE media_type = new AM_MEDIA_TYPE(); SampleGrabber.GetConnectedMediaType(media_type); Debug.WriteLine("{0}:{1}", "majortype", media_type.majortype); Debug.WriteLine("{0}:{1}", "subtype", media_type.subtype); Debug.WriteLine("{0}:{1}", "formattype", media_type.formattype); Debug.WriteLine("{0}:{1}", "bFixedSizeSamples", media_type.bFixedSizeSamples); Debug.WriteLine("{0}:{1}", "bTemporalCompression", media_type.bTemporalCompression); Debug.WriteLine("{0}:{1}", "cbFormat", media_type.cbFormat); Debug.WriteLine("{0}:{1}", "lSampleSize", media_type.lSampleSize); Debug.WriteLine("{0}:{1}", "pbFormat", media_type.pbFormat); Debug.WriteLine("{0}:{1}", "pUnk", media_type.pUnk); // 映像形式の場合、サイズを取得する. if (GUID.Compare(media_type.formattype.ToString(), GUID.FORMAT_VideoInfo)) { VIDEOINFOHEADER vinfo = new VIDEOINFOHEADER(); vinfo = (VIDEOINFOHEADER)Marshal.PtrToStructure(media_type.pbFormat, typeof(VIDEOINFOHEADER)); Debug.WriteLine("{0}:{1}", "Width", vinfo.bmiHeader.biWidth); Debug.WriteLine("{0}:{1}", "Height", vinfo.bmiHeader.biHeight); Debug.WriteLine("{0}:{1}", "BitCount", vinfo.bmiHeader.biBitCount); Debug.WriteLine("{0}:{1}", "Size", vinfo.bmiHeader.biSize); Debug.WriteLine("{0}:{1}", "ImageSize", vinfo.bmiHeader.biSizeImage); Debug.WriteLine("{0}:{1}", "ClrImportant", vinfo.bmiHeader.biClrImportant); Debug.WriteLine("{0}:{1}", "ClrUsed", vinfo.bmiHeader.biClrUsed); Debug.WriteLine("{0}:{1}", "Compression", vinfo.bmiHeader.biCompression); Debug.WriteLine("{0}:{1}", "Planes", vinfo.bmiHeader.biPlanes); Debug.WriteLine("{0}:{1}", "XPelsPerMeter", vinfo.bmiHeader.biXPelsPerMeter); Debug.WriteLine("{0}:{1}", "YPelsPerMeter", vinfo.bmiHeader.biYPelsPerMeter); } }
/// <summary> /// デバッグ /// </summary> /// <param name="graph"></param> private void DebugPrint(IGraphBuilder graph) { IEnumFilters filters = null; IBaseFilter filter = null; int fetched = 0; int hr = graph.EnumFilters(ref filters); while (filters.Next(1, ref filter, ref fetched) == (int)DSLab.HRESULT.S_OK) { if (fetched == 0) { break; } FILTER_INFO info = new FILTER_INFO(); hr = filter.QueryFilterInfo(info); Console.WriteLine("{0}", info.achName); // フィルタ解放. Marshal.ReleaseComObject(filter); filter = null; } // 解放. Marshal.ReleaseComObject(filters); // サンプルグラバフィルタの入力形式設定. // majortype: http://msdn.microsoft.com/ja-jp/library/cc370108.aspx // subtype : http://msdn.microsoft.com/ja-jp/library/cc371040.aspx AM_MEDIA_TYPE media_type = new AM_MEDIA_TYPE(); SampleGrabber.GetConnectedMediaType(media_type); Debug.WriteLine("{0}:{1}", "majortype", media_type.majortype); Debug.WriteLine("{0}:{1}", "subtype", media_type.subtype); Debug.WriteLine("{0}:{1}", "formattype", media_type.formattype); Debug.WriteLine("{0}:{1}", "bFixedSizeSamples", media_type.bFixedSizeSamples); Debug.WriteLine("{0}:{1}", "bTemporalCompression", media_type.bTemporalCompression); Debug.WriteLine("{0}:{1}", "cbFormat", media_type.cbFormat); Debug.WriteLine("{0}:{1}", "lSampleSize", media_type.lSampleSize); Debug.WriteLine("{0}:{1}", "pbFormat", media_type.pbFormat); Debug.WriteLine("{0}:{1}", "pUnk", media_type.pUnk); // 映像形式の場合、サイズを取得する. if (GUID.Compare(media_type.formattype.ToString(), GUID.FORMAT_VideoInfo)) { VIDEOINFOHEADER vinfo = new VIDEOINFOHEADER(); vinfo = (VIDEOINFOHEADER)Marshal.PtrToStructure(media_type.pbFormat, typeof(VIDEOINFOHEADER)); Debug.WriteLine("{0}:{1}", "Width", vinfo.bmiHeader.biWidth); Debug.WriteLine("{0}:{1}", "Height", vinfo.bmiHeader.biHeight); Debug.WriteLine("{0}:{1}", "BitCount", vinfo.bmiHeader.biBitCount); Debug.WriteLine("{0}:{1}", "Size", vinfo.bmiHeader.biSize); Debug.WriteLine("{0}:{1}", "ImageSize", vinfo.bmiHeader.biSizeImage); Debug.WriteLine("{0}:{1}", "ClrImportant", vinfo.bmiHeader.biClrImportant); Debug.WriteLine("{0}:{1}", "ClrUsed", vinfo.bmiHeader.biClrUsed); Debug.WriteLine("{0}:{1}", "Compression", vinfo.bmiHeader.biCompression); Debug.WriteLine("{0}:{1}", "Planes", vinfo.bmiHeader.biPlanes); Debug.WriteLine("{0}:{1}", "XPelsPerMeter", vinfo.bmiHeader.biXPelsPerMeter); Debug.WriteLine("{0}:{1}", "YPelsPerMeter", vinfo.bmiHeader.biYPelsPerMeter); } }