summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-15 23:32:45 +0200
committerwm4 <wm4@nowhere>2014-08-15 23:32:45 +0200
commit22a95290126398c1f416dbadaf596ba79c872996 (patch)
treeadd69161704430c551acf9e0290a39fbfa12f8e0
parentfa7c421588cb856481a948d2a95eef7c9e228b45 (diff)
downloadmpv-22a95290126398c1f416dbadaf596ba79c872996.tar.bz2
mpv-22a95290126398c1f416dbadaf596ba79c872996.tar.xz
vo: eliminate a redundant variable
Originally, I probably had plans to allow NULL images to handle things like the last frame case, but that idea was dropped later.
-rw-r--r--video/out/vo.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 72be2bbb98..e0c8d3ebed 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -136,10 +136,9 @@ struct vo_internal {
int64_t wakeup_pts; // time at which to pull frame from decoder
bool rendering; // true if an image is being rendered
- bool frame_queued; // frame queued, with parameters below
+ struct mp_image *frame_queued; // the image that should be rendered
int64_t frame_pts; // realtime of intended display
int64_t frame_duration; // realtime frame duration (for framedrop)
- struct mp_image *frame_image; // the image that should be rendered
};
static void forget_frames(struct vo *vo);
@@ -359,8 +358,7 @@ static void forget_frames(struct vo *vo)
{
struct vo_internal *in = vo->in;
in->hasframe = false;
- in->frame_queued = false;
- mp_image_unrefp(&in->frame_image);
+ mp_image_unrefp(&in->frame_queued);
}
#ifndef __MINGW32__
@@ -479,10 +477,9 @@ void vo_queue_frame(struct vo *vo, struct mp_image *image,
pthread_mutex_lock(&in->lock);
assert(vo->config_ok && !in->frame_queued);
in->hasframe = true;
- in->frame_queued = true;
+ in->frame_queued = image;
in->frame_pts = pts_us;
in->frame_duration = duration;
- in->frame_image = image;
in->wakeup_pts = in->frame_pts + MPMAX(duration, 0);
wakeup_locked(vo);
pthread_mutex_unlock(&in->lock);
@@ -507,16 +504,14 @@ static bool render_frame(struct vo *vo)
int64_t pts = in->frame_pts;
int64_t duration = in->frame_duration;
- struct mp_image *img = in->frame_image;
+ struct mp_image *img = in->frame_queued;
if (!img) {
pthread_mutex_unlock(&in->lock);
return false;
}
- assert(!!img == in->frame_queued);
in->rendering = true;
- in->frame_queued = false;
- in->frame_image = NULL;
+ in->frame_queued = NULL;
pthread_mutex_unlock(&in->lock);