mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:23:51 +00:00
Reduce some indentation
This commit is contained in:
parent
6cedd64509
commit
f555dc60eb
1 changed files with 59 additions and 58 deletions
|
@ -462,68 +462,69 @@ public:
|
|||
VideoPicture *vp;
|
||||
double actual_delay, delay, sync_threshold, ref_clock, diff;
|
||||
|
||||
if(is->video_st)
|
||||
if(!is->video_st)
|
||||
{
|
||||
if(is->pictq_size == 0)
|
||||
schedule_refresh(is, 1);
|
||||
else
|
||||
schedule_refresh(is, 100);
|
||||
return;
|
||||
}
|
||||
if(is->pictq_size == 0)
|
||||
{
|
||||
schedule_refresh(is, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
vp = &is->pictq[is->pictq_rindex];
|
||||
|
||||
is->video_current_pts = vp->pts;
|
||||
is->video_current_pts_time = av_gettime();
|
||||
|
||||
delay = vp->pts - is->frame_last_pts; /* the pts from last time */
|
||||
if(delay <= 0 || delay >= 1.0) {
|
||||
/* if incorrect delay, use previous one */
|
||||
delay = is->frame_last_delay;
|
||||
}
|
||||
/* save for next time */
|
||||
is->frame_last_delay = delay;
|
||||
is->frame_last_pts = vp->pts;
|
||||
|
||||
/* update delay to sync to audio if not master source */
|
||||
if(is->av_sync_type != AV_SYNC_VIDEO_MASTER)
|
||||
{
|
||||
ref_clock = get_master_clock(is);
|
||||
diff = vp->pts - ref_clock;
|
||||
|
||||
/* Skip or repeat the frame. Take delay into account
|
||||
FFPlay still doesn't "know if this is the best guess." */
|
||||
sync_threshold = (delay > AV_SYNC_THRESHOLD) ? delay : AV_SYNC_THRESHOLD;
|
||||
if(fabs(diff) < AV_NOSYNC_THRESHOLD)
|
||||
{
|
||||
vp = &is->pictq[is->pictq_rindex];
|
||||
|
||||
is->video_current_pts = vp->pts;
|
||||
is->video_current_pts_time = av_gettime();
|
||||
|
||||
delay = vp->pts - is->frame_last_pts; /* the pts from last time */
|
||||
if(delay <= 0 || delay >= 1.0) {
|
||||
/* if incorrect delay, use previous one */
|
||||
delay = is->frame_last_delay;
|
||||
}
|
||||
/* save for next time */
|
||||
is->frame_last_delay = delay;
|
||||
is->frame_last_pts = vp->pts;
|
||||
|
||||
/* update delay to sync to audio if not master source */
|
||||
if(is->av_sync_type != AV_SYNC_VIDEO_MASTER)
|
||||
{
|
||||
ref_clock = get_master_clock(is);
|
||||
diff = vp->pts - ref_clock;
|
||||
|
||||
/* Skip or repeat the frame. Take delay into account
|
||||
FFPlay still doesn't "know if this is the best guess." */
|
||||
sync_threshold = (delay > AV_SYNC_THRESHOLD) ? delay : AV_SYNC_THRESHOLD;
|
||||
if(fabs(diff) < AV_NOSYNC_THRESHOLD)
|
||||
{
|
||||
if(diff <= -sync_threshold)
|
||||
delay = 0;
|
||||
else if(diff >= sync_threshold)
|
||||
delay = 2 * delay;
|
||||
}
|
||||
}
|
||||
|
||||
is->frame_timer += delay;
|
||||
/* computer the REAL delay */
|
||||
actual_delay = is->frame_timer - (av_gettime() / 1000000.0);
|
||||
if(actual_delay < 0.010)
|
||||
{
|
||||
/* Really it should skip the picture instead */
|
||||
actual_delay = 0.010;
|
||||
}
|
||||
schedule_refresh(is, (int)(actual_delay * 1000 + 0.5));
|
||||
|
||||
/* show the picture! */
|
||||
video_display(is);
|
||||
|
||||
/* update queue for next picture! */
|
||||
if(++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
|
||||
is->pictq_rindex = 0;
|
||||
is->pictq_mutex.lock();
|
||||
is->pictq_size--;
|
||||
is->pictq_cond.notify_one ();
|
||||
is->pictq_mutex.unlock ();
|
||||
if(diff <= -sync_threshold)
|
||||
delay = 0;
|
||||
else if(diff >= sync_threshold)
|
||||
delay = 2 * delay;
|
||||
}
|
||||
}
|
||||
else
|
||||
schedule_refresh(is, 100);
|
||||
|
||||
is->frame_timer += delay;
|
||||
/* computer the REAL delay */
|
||||
actual_delay = is->frame_timer - (av_gettime() / 1000000.0);
|
||||
if(actual_delay < 0.010)
|
||||
{
|
||||
/* Really it should skip the picture instead */
|
||||
actual_delay = 0.010;
|
||||
}
|
||||
schedule_refresh(is, (int)(actual_delay * 1000 + 0.5));
|
||||
|
||||
/* show the picture! */
|
||||
video_display(is);
|
||||
|
||||
/* update queue for next picture! */
|
||||
if(++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
|
||||
is->pictq_rindex = 0;
|
||||
is->pictq_mutex.lock();
|
||||
is->pictq_size--;
|
||||
is->pictq_cond.notify_one ();
|
||||
is->pictq_mutex.unlock ();
|
||||
}
|
||||
|
||||
int queue_picture(VideoState *is, AVFrame *pFrame, double pts)
|
||||
|
|
Loading…
Reference in a new issue