summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl_cb.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-10 17:00:18 +0100
committerwm4 <wm4@nowhere>2014-12-10 17:00:18 +0100
commit56eb2b71b8787364238cf80bfb953aba14d55dbf (patch)
treeaca17d71fb698c3c665d4c99c8be60bc594f64a6 /video/out/vo_opengl_cb.c
parentc6dc0c6d99593a809803b1bf4bcc183b084f9b79 (diff)
downloadmpv-56eb2b71b8787364238cf80bfb953aba14d55dbf.tar.bz2
mpv-56eb2b71b8787364238cf80bfb953aba14d55dbf.tar.xz
vo: fix some nonsense
Commit d38bc531 is incorrect: the 50ms queue-ahead value and the flip queue offset have different functions. The latter is about calling flip_page in advance, so the change attempted to show video frames 50ms in advance on all VOs. The change was for vo_opengl_cb, but that can be handled differently.
Diffstat (limited to 'video/out/vo_opengl_cb.c')
-rw-r--r--video/out/vo_opengl_cb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c
index 44ad9e5484..97c50ba489 100644
--- a/video/out/vo_opengl_cb.c
+++ b/video/out/vo_opengl_cb.c
@@ -53,6 +53,7 @@ struct mpv_opengl_cb_context {
// --- Protected by lock
mpv_opengl_cb_update_fn update_cb;
void *update_cb_ctx;
+ struct mp_image *waiting_frame;
struct mp_image *next_frame;
struct mp_image_params img_params;
bool reconfigured;
@@ -228,7 +229,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
struct vo_priv *p = vo->priv;
if (p->ctx) {
pthread_mutex_lock(&p->ctx->lock);
- mp_image_setrefp(&p->ctx->next_frame, mpi);
+ mp_image_setrefp(&p->ctx->waiting_frame, mpi);
pthread_mutex_unlock(&p->ctx->lock);
}
talloc_free(mpi);
@@ -239,6 +240,9 @@ static void flip_page(struct vo *vo)
struct vo_priv *p = vo->priv;
if (p->ctx) {
pthread_mutex_lock(&p->ctx->lock);
+ mp_image_unrefp(&p->ctx->next_frame);
+ p->ctx->next_frame = p->ctx->waiting_frame;
+ p->ctx->waiting_frame = NULL;
if (p->ctx->update_cb)
p->ctx->update_cb(p->ctx->update_cb_ctx);
pthread_mutex_unlock(&p->ctx->lock);
@@ -331,6 +335,7 @@ static void uninit(struct vo *vo)
if (p->ctx) {
pthread_mutex_lock(&p->ctx->lock);
mp_image_unrefp(&p->ctx->next_frame);
+ mp_image_unrefp(&p->ctx->waiting_frame);
p->ctx->img_params = (struct mp_image_params){0};
p->ctx->reconfigured = true;
p->ctx->active = NULL;
@@ -342,9 +347,6 @@ static int preinit(struct vo *vo)
{
struct vo_priv *p = vo->priv;
p->vo = vo;
- // Currently, there's no video timing in the API, and it's questionable
- // how API users would make use of it too.
- vo_set_flip_queue_offset(vo, 0);
return 0;
}