picture: add dav1d_picture_move_ref()

parent 2044016e
......@@ -206,15 +206,13 @@ int dav1d_decode(Dav1dContext *const c,
in->data += res;
if (!in->sz) dav1d_data_unref(in);
if (c->out.data[0]) {
dav1d_picture_ref(out, &c->out);
dav1d_picture_unref(&c->out);
dav1d_picture_move_ref(out, &c->out);
return 0;
}
}
if (c->out.data[0]) {
dav1d_picture_ref(out, &c->out);
dav1d_picture_unref(&c->out);
dav1d_picture_move_ref(out, &c->out);
return 0;
}
......
......@@ -185,6 +185,18 @@ void dav1d_picture_ref(Dav1dPicture *const dst, const Dav1dPicture *const src) {
*dst = *src;
}
void dav1d_picture_move_ref(Dav1dPicture *const dst, Dav1dPicture *const src) {
validate_input(dst != NULL);
validate_input(dst->data[0] == NULL);
validate_input(src != NULL);
if (src->ref)
validate_input(src->data[0] != NULL);
*dst = *src;
memset(src, 0, sizeof(*src));
}
void dav1d_thread_picture_ref(Dav1dThreadPicture *dst,
const Dav1dThreadPicture *src)
{
......
......@@ -67,6 +67,11 @@ void dav1d_thread_picture_ref(Dav1dThreadPicture *dst,
const Dav1dThreadPicture *src);
void dav1d_thread_picture_unref(Dav1dThreadPicture *p);
/**
* Move a picture reference.
*/
void dav1d_picture_move_ref(Dav1dPicture *dst, Dav1dPicture *src);
/**
* Wait for picture to reach a certain stage.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment