/// <summary> /// Encode to binary /// </summary> /// <returns></returns> public byte[] Encode() { List <byte> bufList = new List <byte>(); byte[] bitStream1 = null; if (avc420EncodedBitstream1 != null) { bitStream1 = avc420EncodedBitstream1.Encode(); } byte[] bitStream2 = null; if (avc420EncodedBitstream2 != null) { bitStream2 = avc420EncodedBitstream2.Encode(); } if (LC == AVC444LCValue.BothLumaChroma || LC == AVC444LCValue.OnlyLuma) { cbAvc420EncodedBitstream1 = (uint)bitStream1.Length; } uint avc420EncodedBitstreamInfo = (cbAvc420EncodedBitstream1 | (((uint)LC) << 30)); bufList.AddRange(TypeMarshal.ToBytes <uint>(avc420EncodedBitstreamInfo)); if (bitStream1 != null) { bufList.AddRange(bitStream1); } if (bitStream2 != null) { bufList.AddRange(bitStream2); } return(bufList.ToArray()); }
/// <summary> /// Send bitmap data in H264 AVC420 codec /// </summary> /// <param name="sId">This is used to indicate the target surface id</param> /// <param name="pixFormat">This is used to indicate the pixel format to fill target surface.</param> /// <param name="bmRect">The rectangle of whole Image</param> /// <param name="avc420BitmapStream">A RFX_AVC420_BITMAP_STREAM structure for encoded information</param> /// <param name="baseImage">Base Image used to verify output</param> /// <returns></returns> public uint SendImageWithH264AVC420Codec(ushort sId, PixelFormat pixFormat, RDPGFX_RECT16 bmRect, RFX_AVC420_BITMAP_STREAM avc420BitmapStream, Image baseImage) { uint fid = MakeStartFramePdu(); MakeWireToSurfacePdu1(sId, CodecType.RDPGFX_CODECID_AVC420, pixFormat, bmRect, avc420BitmapStream.Encode()); MakeEndFramePdu(fid); PackAndSendServerPdu(); if (this.bcgrAdapter.SimulatedScreen != null) { if (baseImage == null) { Site.Assume.Inconclusive("Cannot verify the output since base image is not find, check the existance and format of BaseImage element in test data file."); } this.bcgrAdapter.SimulatedScreen.RenderUncompressedImage(sId, baseImage, bmRect.left, bmRect.top); } return fid; }
/// <summary> /// Send bitmap data in H264 AVC420 codec /// </summary> /// <param name="sId">This is used to indicate the target surface id</param> /// <param name="pixFormat">This is used to indicate the pixel format to fill target surface.</param> /// <param name="bmRect">The rectangle of whole Image</param> /// <param name="numRects">Number of rects</param> /// <param name="regionRects">Rect list</param> /// <param name="quantQualityVals">Quality list</param> /// <param name="avc420EncodedBitstream">encoded H264 AVC420 data stream</param> /// <param name="baseImage">Base Image used to verify output</param> /// <returns></returns> public uint SendImageWithH264AVC420Codec(ushort sId, PixelFormat pixFormat, RDPGFX_RECT16 bmRect, uint numRects, RDPGFX_RECT16[] regionRects, RDPGFX_AVC420_QUANT_QUALITY[] quantQualityVals, byte[] avc420EncodedBitstream, Image baseImage) { uint fid = MakeStartFramePdu(); RFX_AVC420_METABLOCK avc420MetaData = new RFX_AVC420_METABLOCK(); avc420MetaData.numRegionRects = numRects; avc420MetaData.regionRects = regionRects; avc420MetaData.quantQualityVals = quantQualityVals; RFX_AVC420_BITMAP_STREAM avc420Stream = new RFX_AVC420_BITMAP_STREAM(avc420MetaData, avc420EncodedBitstream); MakeWireToSurfacePdu1(sId, CodecType.RDPGFX_CODECID_AVC420, pixFormat, bmRect, avc420Stream.Encode()); MakeEndFramePdu(fid); PackAndSendServerPdu(); if (this.bcgrAdapter.SimulatedScreen != null) { if (baseImage == null) { Site.Assume.Inconclusive("Cannot verify the output since base image is not find, check the existance and format of BaseImage element in test data file."); } this.bcgrAdapter.SimulatedScreen.RenderUncompressedImage(sId, baseImage, bmRect.left, bmRect.top); } return fid; }