MCPcopy Create free account
hub / github.com/AOMediaCodec/libavif / rav1eCodecEncodeFinish

Function rav1eCodecEncodeFinish

src/codec_rav1e.c:289–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289static avifBool rav1eCodecEncodeFinish(avifCodec * codec, avifCodecEncodeOutput * output)
290{
291 for (;;) {
292 RaEncoderStatus encoderStatus = rav1e_send_frame(codec->internal->rav1eContext, NULL); // flush
293 if (encoderStatus != RA_ENCODER_STATUS_SUCCESS) {
294 return AVIF_FALSE;
295 }
296
297 avifBool gotPacket = AVIF_FALSE;
298 RaPacket * pkt = NULL;
299 for (;;) {
300 encoderStatus = rav1e_receive_packet(codec->internal->rav1eContext, &pkt);
301 if (encoderStatus == RA_ENCODER_STATUS_ENCODED) {
302 continue;
303 }
304 if ((encoderStatus != RA_ENCODER_STATUS_SUCCESS) && (encoderStatus != RA_ENCODER_STATUS_LIMIT_REACHED)) {
305 return AVIF_FALSE;
306 }
307 if (pkt) {
308 gotPacket = AVIF_TRUE;
309 if (pkt->data && (pkt->len > 0)) {
310 if (avifCodecEncodeOutputAddSample(output, pkt->data, pkt->len, (pkt->frame_type == RA_FRAME_TYPE_KEY)) !=
311 AVIF_RESULT_OK) {
312 return AVIF_FALSE;
313 }
314 }
315 rav1e_packet_unref(pkt);
316 pkt = NULL;
317 } else {
318 break;
319 }
320 }
321
322 if (!gotPacket) {
323 break;
324 }
325 }
326 return AVIF_TRUE;
327}
328
329const char * avifCodecVersionRav1e(void)
330{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected