Ejemplo n.º 1
0
        private VisualTransaction CreateTransactionFromKsCreatePin (Event ev, XmlElement eventRoot)
        {
            VisualTransaction tr = new VisualTransaction (ev.Id, TransactionDirection.In, ev.Timestamp);

            string retValStr = eventRoot.SelectSingleNode ("/event/returnValue/value").Attributes["value"].Value;
            string lastErrStr = ErrorCodeToString (Convert.ToUInt32 (eventRoot.SelectSingleNode ("/event/lastError").Attributes["value"].Value));

            XmlNodeList inNodes = eventRoot.SelectNodes ("/event/arguments[@direction='in']/argument/value");
            string filterHandle = inNodes[0].Attributes["value"].Value;
            string desiredAccess = inNodes[2].Attributes["value"].Value;

            string connHandle = "";
            XmlNode outNode = eventRoot.SelectSingleNode ("/event/arguments[@direction='out']/argument/value/value");
            if (outNode != null)
            {
                connHandle = " => " + outNode.Attributes["value"].Value;
            }

            tr.ContextID = filterHandle;
            tr.HeadlineText = String.Format ("KsCreatePin ({0}, &Connect, {1}, &ConnectionHandle{2}) => {3}", filterHandle, desiredAccess, connHandle, retValStr);
            tr.AddHeaderField ("Id", ev.Id);
            tr.AddHeaderField ("LastError", lastErrStr);

            StringBuilder body = new StringBuilder ();

            byte[] connBytes = Convert.FromBase64String (inNodes[1].SelectSingleNode ("value[@type='KSPIN_CONNECT']").InnerText);
            ByteArrayReader connReader = new ByteArrayReader (connBytes);
            body.Append ("[Connect]:\r\nKSPIN_CONNECT:");
            body.AppendFormat ("\r\n    Interface: ({0}, {1}, {2})", connReader.ReadGuid (), connReader.ReadU32LE (), connReader.ReadU32LE ());
            body.AppendFormat ("\r\n       Medium: ({0}, {1}, {2})", connReader.ReadGuid (), connReader.ReadU32LE (), connReader.ReadU32LE ());
            body.AppendFormat ("\r\n        PinId: {0}", connReader.ReadU32LE ());
            body.AppendFormat ("\r\n  PinToHandle: {0}", connReader.ReadU32LE ());
            body.AppendFormat ("\r\n     Priority: ({0}, {1})", connReader.ReadU32LE (), connReader.ReadU32LE ());

            if (connReader.Remaining > 0)
                throw new Exception ("KSPIN_CONNECT parse error");

            byte[] formatRaw = Convert.FromBase64String (inNodes[1].SelectSingleNode ("value[@type='KSDATAFORMAT']").InnerText);
            ByteArrayReader formatReader = new ByteArrayReader (formatRaw);
            body.AppendFormat ("\r\nKSDATAFORMAT:{0}", KsDataFormatToString (formatReader));

            tr.BodyText = body.ToString ();

            return tr;
        }
Ejemplo n.º 2
0
        private string KsDataFormatToString (ByteArrayReader reader)
        {
            StringBuilder result = new StringBuilder ();

            uint formatSize = reader.ReadU32LE ();
            uint flags = reader.ReadU32LE ();
            uint sampleSize = reader.ReadU32LE ();
            uint reserved = reader.ReadU32LE ();
            Guid majorFormatGuid = reader.ReadGuid ();
            string majorFormatStr = MajorFormatToString (majorFormatGuid);
            Guid subFormatGuid = reader.ReadGuid ();
            string subFormatStr = SubFormatToString (subFormatGuid);
            Guid specifierGuid = reader.ReadGuid ();
            string specifierStr = SpecifierToString (specifierGuid);

            result.Append ("\r\nKSDATAFORMAT:");
            result.AppendFormat ("\r\n   FormatSize: {0}", formatSize);
            result.AppendFormat ("\r\n        Flags: {0}", flags);
            result.AppendFormat ("\r\n   SampleSize: {0}", sampleSize);
            result.AppendFormat ("\r\n     Reserved: {0}", reserved);
            result.AppendFormat ("\r\n  MajorFormat: {0}", majorFormatStr);
            result.AppendFormat ("\r\n    SubFormat: {0}", subFormatStr);
            result.AppendFormat ("\r\n    Specifier: {0}", specifierStr);

            if (specifierStr == "KSDATAFORMAT_SPECIFIER_VIDEOINFO")
            {
                Rectangle sourceRect = reader.ReadRectLE ();
                Rectangle targetRect = reader.ReadRectLE ();
                uint bitRate = reader.ReadU32LE ();
                uint bitErrorRate = reader.ReadU32LE ();
                Int64 avgTimePerFrame = reader.ReadI64LE ();
                double fps = 10000000.0 / avgTimePerFrame;

                result.Append ("\r\nKS_VIDEOINFO:");
                result.AppendFormat ("\r\n         rcSource: ({0}, {1}, {2}, {3})", sourceRect.Left, sourceRect.Top, sourceRect.Right, sourceRect.Bottom);
                result.AppendFormat ("\r\n         rcTarget: ({0}, {1}, {2}, {3})", targetRect.Left, targetRect.Top, targetRect.Right, targetRect.Bottom);
                result.AppendFormat ("\r\n        dwBitRate: {0}", bitRate);
                result.AppendFormat ("\r\n   dwBitErrorRate: {0}", bitErrorRate);
                result.AppendFormat ("\r\n  AvgTimePerFrame: {0} ({1:0.##} fps)", avgTimePerFrame, fps);

                uint size = reader.ReadU32LE ();
                int width = reader.ReadI32LE ();
                int height = reader.ReadI32LE ();
                ushort planes = reader.ReadU16LE ();
                ushort bitCount = reader.ReadU16LE ();
                uint compression = reader.ReadU32LE ();
                uint sizeImage = reader.ReadU32LE ();
                int xPelsPerMeter = reader.ReadI32LE ();
                int yPelsPerMeter = reader.ReadI32LE ();
                uint clrUsed = reader.ReadU32LE ();
                uint clrImportant = reader.ReadU32LE ();

                result.Append ("\r\nKS_BITMAPINFOHEADER:");
                result.AppendFormat ("\r\n           biSize: {0}", size);
                result.AppendFormat ("\r\n          biWidth: {0}", width);
                result.AppendFormat ("\r\n         biHeight: {0}", height);
                result.AppendFormat ("\r\n         biPlanes: {0}", planes);
                result.AppendFormat ("\r\n       biBitCount: {0}", bitCount);
                result.AppendFormat ("\r\n    biCompression: 0x{0:x8}", compression);
                result.AppendFormat ("\r\n      biSizeImage: {0}", sizeImage);
                result.AppendFormat ("\r\n  biXPelsPerMeter: {0}", xPelsPerMeter);
                result.AppendFormat ("\r\n  biYPelsPerMeter: {0}", yPelsPerMeter);
                result.AppendFormat ("\r\n        biClrUsed: {0}", clrUsed);
                result.AppendFormat ("\r\n   biClrImportant: {0}", clrImportant);
            }

            return result.ToString ();
        }
Ejemplo n.º 3
0
        private string KsAllocatorFramingExToString (ByteArrayReader reader)
        {
            StringBuilder result = new StringBuilder ();

            uint countItems = reader.ReadU32LE ();

            result.Append ("\r\nKSALLOCATOR_FRAMING_EX:");
            result.AppendFormat ("\r\n         CountItems: {0}", countItems);
            result.AppendFormat ("\r\n           PinFlags: 0x{0:x8}", reader.ReadU32LE ());
            result.AppendFormat ("\r\n  OutputCompression: ({0}/{1}, ConstantMargin={2})",
                reader.ReadU32LE (), reader.ReadU32LE (), reader.ReadU32LE ());
            result.AppendFormat ("\r\n          PinWeight: {0}", reader.ReadU32LE ());

            for (int i = 0; i < countItems; i++)
            {
                result.AppendFormat ("\r\n\r\nFramingItem[{0}]:", i);
                result.AppendFormat ("\r\n        MemoryType: {0}", MemoryTypeToString (reader.ReadGuid ()));
                result.AppendFormat ("\r\n           BusType: {0}", BusTypeToString (reader.ReadGuid ()));
                result.AppendFormat ("\r\n       MemoryFlags: {0}", BitfieldToString (ksAllocatorQueryFlags, reader.ReadU32LE ()));
                result.AppendFormat ("\r\n          BusFlags: 0x{0:x8}", reader.ReadU32LE ());
                result.AppendFormat ("\r\n             Flags: {0}", BitfieldToString (ksAllocatorQueryFlags, reader.ReadU32LE ()));
                result.AppendFormat ("\r\n            Frames: {0}", reader.ReadU32LE ());
                result.AppendFormat ("\r\n     FileAlignment: {0}", BitfieldToString (fileAlignmentFlags, reader.ReadU32LE ()));
                result.AppendFormat ("\r\n  MemoryTypeWeight: {0}", reader.ReadU32LE ());
                result.AppendFormat ("\r\n     PhysicalRange: ([{0}, {1}], Stepping={2})",
                    reader.ReadU32LE (), reader.ReadU32LE (), reader.ReadU32LE ());
                result.AppendFormat ("\r\n      FramingRange: (([{0}, {1}], Stepping={2}), InPlaceWeight={3}, NotInPlaceWeight={4})",
                    reader.ReadU32LE (), reader.ReadU32LE (), reader.ReadU32LE (), reader.ReadU32LE (), reader.ReadU32LE ());
            }

            return result.ToString ();
        }