static bool MFAAC_Encode(void *data, struct encoder_frame *frame, struct encoder_packet *packet, bool *received_packet) { Encoder *enc = static_cast<Encoder *>(data); Status status; if (!enc->ProcessInput(frame->data[0], frame->linesize[0], frame->pts, &status)) return false; // This shouldn't happen since we drain right after // we process input if (status == NOT_ACCEPTING) return false; UINT8 *outputData; UINT32 outputDataLength; UINT64 outputPts; if (!enc->ProcessOutput(&outputData, &outputDataLength, &outputPts, &status)) return false; // Needs more input, not a failure case if (status == NEED_MORE_INPUT) return true; packet->pts = outputPts; packet->dts = outputPts; packet->data = outputData; packet->size = outputDataLength; packet->type = OBS_ENCODER_AUDIO; packet->timebase_num = 1; packet->timebase_den = enc->SampleRate(); return *received_packet = true; }