Skip to main content

encoder-state

// Save and restore Encoder state with bytes
// Get byte[] of encoder state
byte[] encoderByteState = mteEncoder.SaveState();

// Restore Encoder with byte[] state
MteStatus encoderStatus = mteEncoder.RestoreState(encoderByteState);
if(encoderStatus != MteStatus.mte_status_success)
{
// Encoder restore failed, handle appropriately
// Below is only an example
throw new Exception("Failed to restore Encoder state. Status: "
+ mteEncoder.GetStatusName(encoderStatus)+ " / "
+ mteEncoder.GetStatusDescription(encoderStatus));
}
// Save and restore Encoder state with string
// Get string of Encoder state
string encoderStrState = mteEncoder.SaveStateB64();

// Restore Encoder with string state
MteStatus encoderStatus = mteEncoder.RestoreStateB64(encoderStrState);
if(encoderStatus != MteStatus.mte_status_success)
{
// Encoder restore failed, handle appropriately
// Below is only an example
throw new Exception("Failed to restore encoder state. Status: "
+ mteEncoder.GetStatusName(encoderStatus)+ " / "
+ mteEncoder.GetStatusDescription(encoderStatus));
}