Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
987d3a85
Commit
987d3a85
authored
Sep 23, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the ugly input clock.c sleep.
The input main loop will now handles space control at the right place.
parent
f09152bc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
52 deletions
+72
-52
src/input/clock.c
src/input/clock.c
+26
-17
src/input/es_out.c
src/input/es_out.c
+9
-0
src/input/input.c
src/input/input.c
+34
-26
src/input/input_internal.h
src/input/input_internal.h
+3
-9
No files found.
src/input/clock.c
View file @
987d3a85
...
...
@@ -66,6 +66,12 @@
* new_average = (old_average * c_average + new_sample_value) / (c_average +1)
*/
enum
/* Synchro states */
{
SYNCHRO_OK
=
0
,
SYNCHRO_START
=
1
,
SYNCHRO_REINIT
=
2
,
};
static
void
ClockNewRef
(
input_clock_t
*
p_pgrm
,
mtime_t
i_clock
,
mtime_t
i_sysdate
);
...
...
@@ -179,23 +185,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
cl
->
last_cr
=
i_clock
;
cl
->
last_sysdate
=
i_mdate
;
if
(
b_synchronize
)
{
/* Wait a while before delivering the packets to the decoder.
* In case of multiple programs, we arbitrarily follow the
* clock of the selected program. */
if
(
!
p_input
->
p
->
b_out_pace_control
)
{
mtime_t
i_wakeup
=
ClockToSysdate
(
cl
,
i_clock
);
while
(
(
i_wakeup
-
mdate
())
/
CLOCK_FREQ
>
1
)
{
msleep
(
CLOCK_FREQ
);
if
(
p_input
->
b_die
)
i_wakeup
=
mdate
();
}
mwait
(
i_wakeup
);
}
}
else
if
(
i_mdate
-
cl
->
last_update
>
200000
)
if
(
!
b_synchronize
&&
i_mdate
-
cl
->
last_update
>
200000
)
{
/* Smooth clock reference variations. */
const
mtime_t
i_extrapoled_clock
=
ClockCurrent
(
cl
);
...
...
@@ -245,3 +235,22 @@ void input_ClockSetRate( input_clock_t *cl, int i_rate )
cl
->
i_rate
=
i_rate
;
}
/*****************************************************************************
* input_ClockGetWakeup
*****************************************************************************/
mtime_t
input_ClockGetWakeup
(
input_thread_t
*
p_input
,
input_clock_t
*
cl
)
{
/* Not synchronized, we cannot wait */
if
(
cl
->
i_synchro_state
!=
SYNCHRO_OK
)
return
0
;
/* We must not wait if not pace controled, or we are not the
* master clock */
if
(
!
p_input
->
b_can_pace_control
||
!
cl
->
b_master
||
p_input
->
p
->
b_out_pace_control
)
return
0
;
/* */
return
ClockToSysdate
(
cl
,
cl
->
last_cr
);
}
src/input/es_out.c
View file @
987d3a85
...
...
@@ -348,6 +348,15 @@ es_out_id_t *input_EsOutGetFromID( es_out_t *out, int i_id )
return
NULL
;
}
mtime_t
input_EsOutGetWakeup
(
es_out_t
*
out
)
{
es_out_sys_t
*
p_sys
=
out
->
p_sys
;
if
(
!
p_sys
->
p_pgrm
)
return
0
;
return
input_ClockGetWakeup
(
p_sys
->
p_input
,
&
p_sys
->
p_pgrm
->
clock
);
}
static
void
EsOutDiscontinuity
(
es_out_t
*
out
,
bool
b_flush
,
bool
b_audio
)
{
es_out_sys_t
*
p_sys
=
out
->
p_sys
;
...
...
src/input/input.c
View file @
987d3a85
...
...
@@ -727,14 +727,20 @@ static void MainLoop( input_thread_t *p_input )
vlc_value_t
val
;
mtime_t
i_current
;
mtime_t
i_deadline
;
mtime_t
i_wakeup
;
/* Demux data */
b_force_update
=
false
;
i_wakeup
=
0
;
if
(
p_input
->
i_state
!=
PAUSE_S
)
{
MainLoopDemux
(
p_input
,
&
b_force_update
,
&
i_start_mdate
);
i_wakeup
=
input_EsOutGetWakeup
(
p_input
->
p
->
p_es_out
);
}
/* */
i_deadline
=
0
;
do
{
i_deadline
=
i_wakeup
;
if
(
p_input
->
i_state
==
PAUSE_S
)
i_deadline
=
__MIN
(
i_intf_update
,
i_statistic_update
);
...
...
@@ -755,12 +761,14 @@ static void MainLoop( input_thread_t *p_input )
{
MainLoopInterface
(
p_input
);
i_intf_update
=
i_current
+
INT64_C
(
250000
);
b_force_update
=
false
;
}
if
(
i_statistic_update
<
i_current
)
{
MainLoopStatistic
(
p_input
);
i_statistic_update
=
i_current
+
INT64_C
(
1000000
);
}
}
while
(
i_current
<
i_wakeup
);
}
if
(
!
p_input
->
b_eof
&&
!
p_input
->
b_error
&&
p_input
->
p
->
input
.
b_eof
)
...
...
src/input/input_internal.h
View file @
987d3a85
...
...
@@ -347,6 +347,7 @@ void input_DecoderIsCcPresent( decoder_t *, bool pb_present[4] );
es_out_t
*
input_EsOutNew
(
input_thread_t
*
,
int
i_rate
);
void
input_EsOutDelete
(
es_out_t
*
);
es_out_id_t
*
input_EsOutGetFromID
(
es_out_t
*
,
int
i_id
);
mtime_t
input_EsOutGetWakeup
(
es_out_t
*
);
void
input_EsOutSetDelay
(
es_out_t
*
,
int
i_cat
,
int64_t
);
int
input_EsOutSetRecord
(
es_out_t
*
,
bool
b_record
);
void
input_EsOutChangeRate
(
es_out_t
*
,
int
);
...
...
@@ -354,14 +355,6 @@ void input_EsOutChangeState( es_out_t * );
void
input_EsOutChangePosition
(
es_out_t
*
);
bool
input_EsOutDecodersEmpty
(
es_out_t
*
);
/* clock.c */
enum
/* Synchro states */
{
SYNCHRO_OK
=
0
,
SYNCHRO_START
=
1
,
SYNCHRO_REINIT
=
2
,
};
typedef
struct
{
/* Synchronization information */
...
...
@@ -388,6 +381,7 @@ void input_ClockSetPCR( input_thread_t *, input_clock_t *, mtime_t );
void
input_ClockResetPCR
(
input_clock_t
*
);
mtime_t
input_ClockGetTS
(
input_thread_t
*
,
input_clock_t
*
,
mtime_t
);
void
input_ClockSetRate
(
input_clock_t
*
cl
,
int
i_rate
);
mtime_t
input_ClockGetWakeup
(
input_thread_t
*
,
input_clock_t
*
cl
);
/* Subtitles */
char
**
subtitles_Detect
(
input_thread_t
*
,
char
*
path
,
const
char
*
fname
);
...
...
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