MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ drain()

bool MayaFlux::IO::VideoEncodeContext::drain ( FFmpegMuxContext mux)

Flush all buffered frames from the encoder to the mux.

Sends a null frame to signal EOS to the encoder and drains all remaining output packets. Call once before FFmpegMuxContext::close().

Parameters
muxMux context to receive remaining packets.
Returns
True if all remaining packets were written successfully.

Definition at line 326 of file VideoEncodeContext.cpp.

327{
328 if (!is_valid())
329 return false;
330
331 if (avcodec_send_frame(codec_context, nullptr) < 0) {
332 m_last_error = "avcodec_send_frame(null) failed during drain";
333 return false;
334 }
335
336 return drain_packets(mux);
337}
bool is_valid() const
True if codec, scaler, and scratch frame are all ready.
bool drain_packets(FFmpegMuxContext &mux)
AVCodecContext * codec_context
Owned; freed in destructor.

References codec_context, drain_packets(), is_valid(), and m_last_error.

Referenced by MayaFlux::IO::VideoFileWriter::worker_loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: