err = dav1d_open(&ctx, &settings); if (err < 0) goto end;
while (ptr <= data + size - 12) {
Dav1dData buf;
uint8_t *p;
size_t frame_size = r32le(ptr);
ptr += 12;
if (frame_size > size || ptr > data + size - frame_size) break;
if (!frame_size) continue;
if (!have_seq_hdr) {
Dav1dSequenceHeader seq; int err = dav1d_parse_sequence_header(&seq, ptr, frame_size); // skip frames until we see a sequence header if (err != 0) {
ptr += frame_size; continue;
}
have_seq_hdr = 1;
}
// copy frame data to a new buffer to catch reads past the end of input
p = dav1d_data_create(&buf, frame_size); if (!p) goto cleanup;
memcpy(p, ptr, frame_size);
ptr += frame_size;
do { if ((err = dav1d_send_data(ctx, &buf)) < 0) { if (err != DAV1D_ERR(EAGAIN)) break;
}
memset(&pic, 0, sizeof(pic));
err = dav1d_get_picture(ctx, &pic); if (err == 0) {
dav1d_picture_unref(&pic);
} elseif (err != DAV1D_ERR(EAGAIN)) { break;
}
} while (buf.sz > 0);
if (buf.sz > 0)
dav1d_data_unref(&buf);
}
memset(&pic, 0, sizeof(pic)); if ((err = dav1d_get_picture(ctx, &pic)) == 0) { /* Test calling dav1d_picture_unref() after dav1d_close() */ do {
Dav1dPicture pic2 = { 0 }; if ((err = dav1d_get_picture(ctx, &pic2)) == 0)
dav1d_picture_unref(&pic2);
} while (err != DAV1D_ERR(EAGAIN));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.