@@ -65,26 +65,19 @@ public unsafe class MMALVideoEncoder : MMALEncoderBase
6565 /// and this can be applied on the next run to the newly created file.
6666 /// </summary>
6767 public bool PrepareSplit { get ; set ; }
68-
69- /// <summary>
70- /// A <see cref="DateTime"/> to signify when processing should terminate on this component.
71- /// </summary>
72- public DateTime ? Timeout { get ; }
7368
7469 /// <summary>
7570 /// Creates a new instance of <see cref="MMALVideoEncoder"/>.
7671 /// </summary>
7772 /// <param name="handler">The capture handler.</param>
78- /// <param name="timeout">The optional termination time.</param>
7973 /// <param name="split">Configure this component to split into multiple files.</param>
80- public MMALVideoEncoder ( ICaptureHandler handler , DateTime ? timeout = null , Split split = null )
74+ public MMALVideoEncoder ( ICaptureHandler handler , Split split = null )
8175 : base ( MMALParameters . MMAL_COMPONENT_DEFAULT_VIDEO_ENCODER , handler )
8276 {
8377 this . Split = split ;
84- this . Timeout = timeout ;
8578 }
8679
87- /// <inheritdoc />>
80+ /// <inheritdoc />
8881 public override MMALDownstreamComponent ConfigureOutputPort ( int outputPort , MMALPortConfig config )
8982 {
9083 base . ConfigureOutputPort ( outputPort , config ) ;
@@ -94,12 +87,13 @@ public override MMALDownstreamComponent ConfigureOutputPort(int outputPort, MMAL
9487 {
9588 this . Outputs [ outputPort ] . VideoColorSpace = MMALCameraConfig . VideoColorSpace ;
9689 }
97-
90+
9891 if ( this . Outputs [ outputPort ] . GetType ( ) == typeof ( VideoPort ) || this . Outputs [ outputPort ] . GetType ( ) . IsSubclassOf ( typeof ( VideoPort ) ) )
9992 {
100- ( ( VideoPort ) this . Outputs [ outputPort ] ) . Timeout = this . Timeout ;
93+ ( ( VideoPort ) this . Outputs [ outputPort ] ) . Timeout = config . Timeout ;
10194 }
102-
95+
96+ this . Outputs [ outputPort ] . Ptr ->BufferNum = Math . Max ( this . Outputs [ outputPort ] . Ptr ->BufferNumRecommended , 3 ) ;
10397 this . Outputs [ outputPort ] . Ptr ->BufferSize = 512 * 1024 ;
10498 this . Quality = config . Quality ;
10599
@@ -122,7 +116,7 @@ public override MMALDownstreamComponent ConfigureOutputPort(int outputPort, MMAL
122116 this . ConfigureBitrate ( outputPort ) ;
123117
124118 this . RegisterOutputCallback ( new VideoOutputCallbackHandler ( this . Outputs [ outputPort ] ) ) ;
125-
119+
126120 return this ;
127121 }
128122
@@ -182,6 +176,7 @@ internal void ConfigureBitrate(int outputPort)
182176 this . Outputs [ outputPort ] . Bitrate = MaxBitrateMJPEG ;
183177 }
184178 }
179+
185180 this . Outputs [ outputPort ] . Ptr ->Format ->Bitrate = this . Outputs [ outputPort ] . Bitrate ;
186181 this . Outputs [ outputPort ] . Ptr ->Format ->Es ->Video . FrameRate = new MMAL_RATIONAL_T ( 0 , 1 ) ;
187182 this . Outputs [ outputPort ] . Commit ( ) ;
0 commit comments