Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
6cf55f06
Commit
6cf55f06
authored
Aug 19, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ThreadDisplayPreparePicture: simplify
Make code more verbose and easy to read
parent
55b27720
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
32 deletions
+32
-32
src/video_output/video_output.c
src/video_output/video_output.c
+32
-32
No files found.
src/video_output/video_output.c
View file @
6cf55f06
...
...
@@ -814,9 +814,10 @@ static void ThreadChangeFilters(vout_thread_t *vout,
/* */
static
int
ThreadDisplayPreparePicture
(
vout_thread_t
*
vout
,
bool
reuse
,
bool
is_late_dropped
)
static
int
ThreadDisplayPreparePicture
(
vout_thread_t
*
vout
,
bool
reuse
,
bool
frame_by_frame
)
{
int
lost_count
=
0
;
bool
is_late_dropped
=
vout
->
p
->
is_late_dropped
&&
!
vout
->
p
->
pause
.
is_on
&&
!
frame_by_frame
;
vlc_mutex_lock
(
&
vout
->
p
->
filter
.
lock
);
...
...
@@ -1066,68 +1067,67 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
static
int
ThreadDisplayPicture
(
vout_thread_t
*
vout
,
mtime_t
*
deadline
)
{
bool
now
=
!
deadline
;
bool
is_late_dropped
=
vout
->
p
->
is_late_dropped
&&
!
vout
->
p
->
pause
.
is_on
&&
!
now
;
bool
frame_by_frame
=
!
deadline
;
bool
paused
=
vout
->
p
->
pause
.
is_on
;
bool
first
=
!
vout
->
p
->
displayed
.
current
;
if
(
first
&&
ThreadDisplayPreparePicture
(
vout
,
true
,
is_late_dropped
))
/* FIXME not sure it is ok */
return
VLC_EGENERIC
;
if
(
!
vout
->
p
->
pause
.
is_on
||
now
)
{
while
(
!
vout
->
p
->
displayed
.
next
)
{
if
(
ThreadDisplayPreparePicture
(
vout
,
false
,
is_late_dropped
))
{
break
;
}
}
}
if
(
first
)
if
(
ThreadDisplayPreparePicture
(
vout
,
true
,
frame_by_frame
))
/* FIXME not sure it is ok */
return
VLC_EGENERIC
;
if
(
!
paused
||
frame_by_frame
)
while
(
!
vout
->
p
->
displayed
.
next
&&
!
ThreadDisplayPreparePicture
(
vout
,
false
,
frame_by_frame
))
;
const
mtime_t
date
=
mdate
();
const
mtime_t
render_delay
=
vout_chrono_GetHigh
(
&
vout
->
p
->
render
)
+
VOUT_MWAIT_TOLERANCE
;
bool
drop_next_frame
=
frame_by_frame
;
mtime_t
date_next
=
VLC_TS_INVALID
;
if
(
!
vout
->
p
->
pause
.
is_on
&&
vout
->
p
->
displayed
.
next
)
if
(
!
paused
&&
vout
->
p
->
displayed
.
next
)
{
date_next
=
vout
->
p
->
displayed
.
next
->
date
-
render_delay
;
if
(
date_next
/* + 0 FIXME */
<=
date
)
drop_next_frame
=
true
;
}
/* FIXME/XXX we must redisplay the last decoded picture (because
* of potential vout updated, or filters update or SPU update)
* For now a high update period is needed but it coul
m
d be removed
* For now a high update period is needed but it could be removed
* if and only if:
* - vout module emits events from theselves.
* - *and* SPU is modified to emit an event or a deadline when needed.
*
* So it will be done lat
t
er.
* So it will be done later.
*/
bool
refresh
=
false
;
mtime_t
date_refresh
=
VLC_TS_INVALID
;
if
(
vout
->
p
->
displayed
.
date
>
VLC_TS_INVALID
)
if
(
vout
->
p
->
displayed
.
date
>
VLC_TS_INVALID
)
{
date_refresh
=
vout
->
p
->
displayed
.
date
+
VOUT_REDISPLAY_DELAY
-
render_delay
;
bool
drop
=
now
;
if
(
date_next
!=
VLC_TS_INVALID
)
drop
|=
date_next
+
0
<=
date
;
bool
refresh
=
false
;
if
(
date_refresh
>
VLC_TS_INVALID
)
refresh
=
date_refresh
<=
date
;
}
if
(
!
first
&&
!
refresh
&&
!
drop
)
{
if
(
!
now
)
{
if
(
date_next
!=
VLC_TS_INVALID
&&
date_refresh
!=
VLC_TS_INVALID
)
*
deadline
=
__MIN
(
date_next
,
date_refresh
);
else
if
(
date_next
!=
VLC_TS_INVALID
)
*
deadline
=
date_next
;
else
if
(
date_refresh
!=
VLC_TS_INVALID
)
if
(
!
first
&&
!
refresh
&&
!
drop_next_frame
)
{
if
(
!
frame_by_frame
)
{
if
(
date_refresh
!=
VLC_TS_INVALID
)
*
deadline
=
date_refresh
;
if
(
date_next
!=
VLC_TS_INVALID
&&
date_next
<
*
deadline
)
*
deadline
=
date_next
;
}
return
VLC_EGENERIC
;
}
if
(
drop
)
{
if
(
drop
_next_frame
)
{
picture_Release
(
vout
->
p
->
displayed
.
current
);
vout
->
p
->
displayed
.
current
=
vout
->
p
->
displayed
.
next
;
vout
->
p
->
displayed
.
next
=
NULL
;
}
if
(
!
vout
->
p
->
displayed
.
current
)
return
VLC_EGENERIC
;
bool
is_forced
=
now
||
(
!
drop
&&
refresh
)
||
vout
->
p
->
displayed
.
current
->
b_force
;
/* display the picture immediately */
bool
is_forced
=
frame_by_frame
||
(
!
drop_next_frame
&&
refresh
)
||
vout
->
p
->
displayed
.
current
->
b_force
;
return
ThreadDisplayRenderPicture
(
vout
,
is_forced
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment