예제 #1
0
        private void TestOutputType()
        {
            int          hr;
            AMMediaType  pmt  = new AMMediaType();
            AMMediaType  pmt2 = new AMMediaType();
            WaveFormatEx w    = new WaveFormatEx();

            hr = m_imo.GetOutputType(0, 0, pmt);
            Debug.WriteLine(DsToString.AMMediaTypeToString(pmt));

            Marshal.PtrToStructure(pmt.formatPtr, w);
            //pmt.sampleSize = 44100;
            //pmt.fixedSizeSamples = true;

            hr = m_imo.SetOutputType(0, pmt, DMOSetType.Clear);
            DMOError.ThrowExceptionForHR(hr);

            hr = m_imo.SetOutputType(0, pmt, DMOSetType.TestOnly);
            DMOError.ThrowExceptionForHR(hr);

            hr = m_imo.SetOutputType(0, pmt, DMOSetType.None);
            DMOError.ThrowExceptionForHR(hr);

            hr = m_imo.GetOutputCurrentType(0, pmt2);
            DMOError.ThrowExceptionForHR(hr);

            Debug.Assert(pmt2.majorType == pmt.majorType, "GetOutputCurrentType");
        }
예제 #2
0
        public static string DumpAMMediaTypeInfo(AMMediaType mt)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(">>>>> AMMediaType Info");

            sb.AppendLine(DsToString.AMMediaTypeToString(mt));

            sb.AppendLine(string.Format("majorType: {0}  subType:{1}   formatType:{2}", mt.majorType, mt.subType, mt.formatType));


            if ((mt.majorType == DirectShowLib.MediaType.Video) &&
                (mt.formatType == DirectShowLib.FormatType.VideoInfo))
            {
                VideoInfoHeader vih = (VideoInfoHeader)Marshal.PtrToStructure(mt.formatPtr, typeof(VideoInfoHeader));

                sb.AppendLine("VideoInfoHeader fields");
                sb.AppendLine("AvgTimePerFrame: " + vih.AvgTimePerFrame.ToString());
                sb.AppendLine("BitErrorRate: " + vih.BitErrorRate.ToString());
                sb.AppendLine("BitRate: " + vih.BitRate.ToString());

                BitmapInfoHeader bmi = vih.BmiHeader;
                sb.AppendLine("BitmapInfoHeader fields");
                sb.AppendLine("BitCount: " + bmi.BitCount.ToString());
                sb.AppendLine("ClrImportant: " + bmi.ClrImportant.ToString());
                sb.AppendLine("ClrUsed: " + bmi.ClrUsed.ToString());
                sb.AppendLine("Compression: " + bmi.Compression.ToString());
                sb.AppendLine("Height: " + bmi.Height.ToString());
                sb.AppendLine("Width: " + bmi.Width.ToString());
                sb.AppendLine("ImageSize: " + bmi.ImageSize.ToString());
                sb.AppendLine("Planes: " + bmi.Planes.ToString());
                sb.AppendLine("Size: " + bmi.Size.ToString());
                sb.AppendLine("XPelsPerMeter: " + bmi.XPelsPerMeter.ToString());
                sb.AppendLine("YPelsPerMeter: " + bmi.YPelsPerMeter.ToString());
            }


            if ((mt.majorType == DirectShowLib.MediaType.Audio) ||
                (mt.formatType == DirectShowLib.FormatType.WaveEx))
            {
                WaveFormatEx wfx = (WaveFormatEx)Marshal.PtrToStructure(mt.formatPtr, typeof(WaveFormatEx));

                sb.AppendLine("WaveFormatEx fields");
                sb.AppendLine("wFormatTag: " + wfx.wFormatTag.ToString());
                sb.AppendLine("cbSize: " + wfx.cbSize.ToString());
                sb.AppendLine("nAvgBytesPerSec: " + wfx.nAvgBytesPerSec.ToString());
                sb.AppendLine("nBlockAlign: " + wfx.nBlockAlign.ToString());
                sb.AppendLine("nChannels: " + wfx.nChannels.ToString());
                sb.AppendLine("nSamplesPerSec: " + wfx.nSamplesPerSec.ToString());
                sb.AppendLine("wBitsPerSample: " + wfx.wBitsPerSample.ToString());
                sb.AppendLine("cbSize: " + wfx.cbSize.ToString());
            }

            sb.AppendLine("<<<<< AMMediaType Info");

            return(sb.ToString());
        }
예제 #3
0
        public static string PrintMediaType(AMMediaType amm)
        {
            var vih             = DShowHelper.QueryVideoInfoHeader(amm);
            var compressionName = DShowHelper.ForCompression(vih.BmiHeader.Compression);

            var str = string.Format("{0} width={1};height={2}", DsToString.MediaSubTypeToString(amm.subType).PadRight(8), vih.BmiHeader.Width, vih.BmiHeader.Height);

            Console.WriteLine("DShow:{0}", str);
            return(str);
        }
예제 #4
0
파일: MediaTypeProps.cs 프로젝트: x2v0/gep
 public override string ToString()
 {
     return(string.Format("{0} {1} {2} {3} {4} {5} SampleSize={6}",
                          DsToString.MediaTypeToString(mt.majorType).Replace('\0', ' '),
                          DsToString.MediaSubTypeToString(mt.subType).Replace('\0', ' '),
                          DsToString.MediaFormatTypeToString(mt.formatType).Replace('\0', ' '),
                          format_ftp.ToString(),
                          (mt.fixedSizeSamples ? "FixedSamples" : "NotFixedSamples"),
                          (mt.temporalCompression ? "TemporalCompression" : "NotTemporalCompression"),
                          mt.sampleSize.ToString()));
 }
예제 #5
0
        /// <summary>
        /// The MediaSubTypeToString function in DirectShowLib fails to properly decode the FourCC of
        /// guids that start with 0x0000.
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        private string MediaSubTypeToString(Guid guid)
        {
            string s = DsToString.MediaSubTypeToString(guid);

            if (s.Contains("\0"))
            {
                return(guid.ToString());
            }
            else
            {
                return(s);
            }
        }
예제 #6
0
        public FilterPropertiesPanel(DSFilterTreeViewNode node)
        {
            InitializeComponent();
            _nameLabel.Text      = node.Text;
            _meritLabel.Text     = "0x" + node.FilterInformation.Merit.ToString("X");
            _monikerTextBox.Text = node.DevicePath;
            _filenameLabel.Text  = node.FilePath;
            _filenameLabel.SelectAll();

            foreach (FilterDataPin pin in node.FilterInformation.Pins)
            {
                TreeNode tn = new TreeNode("pin " + pin.PinNumber.ToString() + ":");
                tn.Nodes.Add(new TreeNode("Many: " + pin.PinFlagMany.ToString()));
                tn.Nodes.Add(new TreeNode("Output: " + pin.PinFlagOutput.ToString()));
                tn.Nodes.Add(new TreeNode("Rendered: " + pin.PinFlagRenderer.ToString()));
                tn.Nodes.Add(new TreeNode("Zero: " + pin.PinFlagZero.ToString()));
                tn.Nodes.Add(new TreeNode("ClsPinCategory: " + pin.Category.ToString()));

                foreach (FilterDataPinType pt in pin.Mediums)
                {
                    TreeNode mtn = new TreeNode("Medium " + pt.TypeNumber.ToString());
                    mtn.Nodes.Add(new TreeNode("medium clsid: " + pt.MajorType.ToString()));
                    tn.Nodes.Add(mtn);
                }

                foreach (FilterDataPinType pt in pin.Types)
                {
                    TreeNode mtn = new TreeNode("type " + pt.TypeNumber.ToString());
                    mtn.Nodes.Add(new TreeNode("major type: " + DsToString.MediaTypeToString(pt.MajorType) + " {" + pt.MajorType.ToString() + "}"));
                    mtn.Nodes.Add(new TreeNode("subtype: " + DsToString.MediaSubTypeToString(pt.SubType) + " {" + pt.SubType.ToString() + "}"));
                    tn.Nodes.Add(mtn);
                }

                _pinsTreeView.Nodes.Add(tn);
            }
        }
예제 #7
0
        private string ConnectionMediaTypeString(AMMediaType mtype)
        {
            string retval =
                "Major type:\t" + DsToString.MediaTypeToString(mtype.majorType) + "\r\n" +
                "Subtype type:\t" + this.MediaSubTypeToString(mtype.subType) + "\r\n" +
                "Format type:\t" + DsToString.MediaFormatTypeToString(mtype.formatType) + "\r\n";

            if (mtype.formatPtr != IntPtr.Zero)
            {
                if (mtype.formatType == FormatType.WaveEx)
                {
                    retval += WaveFormatExString(mtype);
                }
                else if (mtype.formatType == FormatType.VideoInfo || mtype.formatType == FormatType.MpegVideo)
                {
                    retval += VideoInfoFormatString(mtype);
                }
                else if (mtype.formatType == FormatType.VideoInfo2 || mtype.formatType == FormatType.Mpeg2Video)
                {
                    retval += VideoInfo2FormatString(mtype);
                }
            }
            return(retval + "---\r\n");
        }
예제 #8
0
파일: MediaTypeProps.cs 프로젝트: x2v0/gep
 public override string ToString()
 {
     return(DsToString.AMMediaTypeToString(mt).Replace('\0', ' '));
 }