internal void LogFormat(MMALEventFormat format, MMALPortImpl port) { StringBuilder sb = new StringBuilder(); if (port != null) { switch (port.PortType) { case PortType.Input: sb.Append("Port Type: Input"); break; case PortType.Output: sb.Append("Port Type: Output"); break; case PortType.Control: sb.Append("Port Type: Control"); break; default: break; } } sb.Append($"FourCC: {format.FourCC}"); sb.Append($"Width: {format.Width}"); sb.Append($"Height: {format.Height}"); sb.Append($"Crop: {format.CropX}, {format.CropY}, {format.CropWidth}, {format.CropHeight}"); sb.Append($"Pixel aspect ratio: {format.ParNum}, {format.ParDen}. Frame rate: {format.FramerateNum}, {format.FramerateDen}"); if (port != null) { sb.Append($"Port info: Buffers num: {port.BufferNum}(opt {port.BufferNumRecommended}, min {port.BufferNumMin}). Size: {port.BufferSize} (opt {port.BufferSizeRecommended}, min {port.BufferSizeMin}). Alignment: {port.BufferAlignmentMin}"); } MMALLog.Logger.Info(sb.ToString()); }
public MMALStillDecodeConvertPort(MMALPortImpl copyFrom) : base(copyFrom.Ptr, copyFrom.ComponentReference, copyFrom.PortType, copyFrom.Guid) { }
/// <summary> /// Configures a specific input port on a downstream component. This method will perform a shallow copy of the output /// port it is to be connected to. /// </summary> /// <param name="encodingType">The encoding type the input port shall be expecting.</param> /// <param name="pixelFormat">The pixel format the input port shall be expecting</param> /// <param name="copyPort">The output port we are copying format data from</param> public virtual unsafe void ConfigureInputPort(MMALEncoding encodingType, MMALEncoding pixelFormat, MMALPortImpl copyPort) { this.InitialiseInputPort(0); copyPort.ShallowCopy(this.Inputs[0]); if (encodingType != null) { this.Inputs[0].Ptr->Format->encoding = encodingType.EncodingVal; } if (pixelFormat != null) { this.Inputs[0].Ptr->Format->encodingVariant = pixelFormat.EncodingVal; } this.Inputs[0].Commit(); }
public MMALVideoPort(MMALPortImpl copyFrom) : base(copyFrom.Ptr, copyFrom.ComponentReference, copyFrom.PortType, copyFrom.Guid) { }
public MMALStillPort(MMALPortImpl copyFrom) : base(copyFrom.Ptr, copyFrom.ComponentReference, copyFrom.PortType) { }
/// <summary> /// Configures a specific input port on a downstream component. This method will perform a shallow copy of the output /// port it is to be connected to. /// </summary> /// <param name="encodingType">The encoding type the input port shall be expecting.</param> /// <param name="pixelFormat">The pixel format the input port shall be expecting.</param> /// <param name="copyPort">The output port we are copying format data from.</param> /// <param name="zeroCopy">Instruct MMAL to not copy buffers to ARM memory (useful for large buffers and handling raw data).</param> public virtual void ConfigureInputPort(MMALEncoding encodingType, MMALEncoding pixelFormat, MMALPortImpl copyPort, bool zeroCopy = false) { this.InitialiseInputPort(0); if (copyPort != null) { copyPort.ShallowCopy(this.Inputs[0]); } if (encodingType != null) { this.Inputs[0].NativeEncodingType = encodingType.EncodingVal; } if (pixelFormat != null) { this.Inputs[0].NativeEncodingSubformat = pixelFormat.EncodingVal; } this.Inputs[0].Commit(); if (zeroCopy) { this.Inputs[0].ZeroCopy = true; this.Inputs[0].SetParameter(MMALParametersCommon.MMAL_PARAMETER_ZERO_COPY, true); } }