Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
f1e16994
Commit
f1e16994
authored
Sep 30, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No functionnal changes (clean up)
parent
bf304527
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
73 deletions
+78
-73
src/input/clock.c
src/input/clock.c
+4
-1
src/input/decoder.c
src/input/decoder.c
+47
-40
src/input/es_out.c
src/input/es_out.c
+20
-27
src/input/input_clock.h
src/input/input_clock.h
+4
-1
src/input/input_decoder.h
src/input/input_decoder.h
+3
-4
No files found.
src/input/clock.c
View file @
f1e16994
...
...
@@ -322,13 +322,16 @@ mtime_t input_clock_GetWakeup( input_clock_t *cl )
/*****************************************************************************
* input_clock_GetTS: manages a PTS or DTS
*****************************************************************************/
mtime_t
input_clock_GetTS
(
input_clock_t
*
cl
,
mtime_t
input_clock_GetTS
(
input_clock_t
*
cl
,
int
*
pi_rate
,
mtime_t
i_pts_delay
,
mtime_t
i_ts
)
{
mtime_t
i_converted_ts
;
vlc_mutex_lock
(
&
cl
->
lock
);
if
(
pi_rate
)
*
pi_rate
=
cl
->
i_rate
;
if
(
!
cl
->
b_has_reference
)
{
vlc_mutex_unlock
(
&
cl
->
lock
);
...
...
src/input/decoder.c
View file @
f1e16994
...
...
@@ -159,7 +159,7 @@ mtime_t decoder_GetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
if
(
!
p_owner
->
p_clock
)
return
i_ts
;
return
input_clock_GetTS
(
p_owner
->
p_clock
,
p_owner
->
p_input
->
i_pts_delay
,
i_ts
);
return
input_clock_GetTS
(
p_owner
->
p_clock
,
NULL
,
p_owner
->
p_input
->
i_pts_delay
,
i_ts
);
}
/* decoder_GetDisplayRate:
*/
...
...
@@ -363,29 +363,7 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block )
}
}
void
input_DecoderDiscontinuity
(
decoder_t
*
p_dec
,
bool
b_flush
)
{
decoder_owner_sys_t
*
p_owner
=
p_dec
->
p_owner
;
block_t
*
p_null
;
/* Empty the fifo */
if
(
p_owner
->
b_own_thread
&&
b_flush
)
block_FifoEmpty
(
p_owner
->
p_fifo
);
/* Send a special block */
p_null
=
block_New
(
p_dec
,
128
);
p_null
->
i_flags
|=
BLOCK_FLAG_DISCONTINUITY
;
if
(
b_flush
&&
p_dec
->
fmt_in
.
i_cat
==
SPU_ES
)
p_null
->
i_flags
|=
BLOCK_FLAG_CORE_FLUSH
;
/* FIXME check for p_packetizer or b_packitized from es_format_t of input ? */
if
(
p_owner
->
p_packetizer
&&
b_flush
)
p_null
->
i_flags
|=
BLOCK_FLAG_CORRUPTED
;
memset
(
p_null
->
p_buffer
,
0
,
p_null
->
i_buffer
);
input_DecoderDecode
(
p_dec
,
p_null
);
}
bool
input_DecoderEmpty
(
decoder_t
*
p_dec
)
bool
input_DecoderIsEmpty
(
decoder_t
*
p_dec
)
{
if
(
p_dec
->
p_owner
->
b_own_thread
&&
block_FifoCount
(
p_dec
->
p_owner
->
p_fifo
)
>
0
)
...
...
@@ -504,6 +482,29 @@ void input_DecoderChangeDelay( decoder_t *p_dec, mtime_t i_delay )
p_owner
->
i_ts_delay
=
i_delay
;
vlc_mutex_unlock
(
&
p_owner
->
lock
);
}
void
input_DecoderFlush
(
decoder_t
*
p_dec
)
{
decoder_owner_sys_t
*
p_owner
=
p_dec
->
p_owner
;
block_t
*
p_null
;
/* Empty the fifo */
if
(
p_owner
->
b_own_thread
)
block_FifoEmpty
(
p_owner
->
p_fifo
);
/* Send a special block */
p_null
=
block_New
(
p_dec
,
128
);
p_null
->
i_flags
|=
BLOCK_FLAG_DISCONTINUITY
;
if
(
p_dec
->
fmt_in
.
i_cat
==
SPU_ES
)
p_null
->
i_flags
|=
BLOCK_FLAG_CORE_FLUSH
;
/* FIXME check for p_packetizer or b_packitized from es_format_t of input ? */
if
(
p_owner
->
p_packetizer
)
p_null
->
i_flags
|=
BLOCK_FLAG_CORRUPTED
;
memset
(
p_null
->
p_buffer
,
0
,
p_null
->
i_buffer
);
input_DecoderDecode
(
p_dec
,
p_null
);
}
/**
* Create a decoder object
*
...
...
@@ -769,13 +770,15 @@ static void DecoderSoutBufferFixTs( block_t *p_block,
{
assert
(
p_clock
);
p_block
->
i_rate
=
input_clock_GetRate
(
p_clock
)
;
p_block
->
i_rate
=
0
;
if
(
p_block
->
i_dts
>
0
)
p_block
->
i_dts
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_block
->
i_dts
);
p_block
->
i_dts
=
input_clock_GetTS
(
p_clock
,
&
p_block
->
i_rate
,
i_ts_delay
,
p_block
->
i_dts
);
if
(
p_block
->
i_pts
>
0
)
p_block
->
i_pts
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_block
->
i_pts
);
p_block
->
i_pts
=
input_clock_GetTS
(
p_clock
,
&
p_block
->
i_rate
,
i_ts_delay
,
p_block
->
i_pts
);
if
(
p_block
->
i_length
>
0
)
p_block
->
i_length
=
(
p_block
->
i_length
*
p_block
->
i_rate
+
...
...
@@ -784,18 +787,23 @@ static void DecoderSoutBufferFixTs( block_t *p_block,
if
(
b_teletext
)
p_block
->
i_pts
=
DecoderTeletextFixTs
(
p_block
->
i_pts
,
i_ts_delay
);
}
static
void
DecoderAoutBufferFixTs
(
aout_buffer_t
*
p_buffer
,
static
void
DecoderAoutBufferFixTs
(
aout_buffer_t
*
p_buffer
,
int
*
pi_rate
,
input_clock_t
*
p_clock
,
mtime_t
i_ts_delay
)
{
/* sout display module does not set clock */
if
(
!
p_clock
)
return
;
if
(
!
p_buffer
->
start_date
&&
!
p_buffer
->
end_date
)
*
pi_rate
=
input_clock_GetRate
(
p_clock
);
if
(
p_buffer
->
start_date
)
p_buffer
->
start_date
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_buffer
->
start_date
);
p_buffer
->
start_date
=
input_clock_GetTS
(
p_clock
,
pi_rate
,
i_ts_delay
,
p_buffer
->
start_date
);
if
(
p_buffer
->
end_date
)
p_buffer
->
end_date
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_buffer
->
end_date
);
p_buffer
->
end_date
=
input_clock_GetTS
(
p_clock
,
pi_rate
,
i_ts_delay
,
p_buffer
->
end_date
);
}
static
void
DecoderVoutBufferFixTs
(
picture_t
*
p_picture
,
input_clock_t
*
p_clock
,
mtime_t
i_ts_delay
)
...
...
@@ -805,7 +813,8 @@ static void DecoderVoutBufferFixTs( picture_t *p_picture,
return
;
if
(
p_picture
->
date
)
p_picture
->
date
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_picture
->
date
);
p_picture
->
date
=
input_clock_GetTS
(
p_clock
,
NULL
,
i_ts_delay
,
p_picture
->
date
);
}
static
void
DecoderSpuBufferFixTs
(
subpicture_t
*
p_subpic
,
input_clock_t
*
p_clock
,
mtime_t
i_ts_delay
,
...
...
@@ -818,10 +827,12 @@ static void DecoderSpuBufferFixTs( subpicture_t *p_subpic,
return
;
if
(
p_subpic
->
i_start
)
p_subpic
->
i_start
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_subpic
->
i_start
);
p_subpic
->
i_start
=
input_clock_GetTS
(
p_clock
,
NULL
,
i_ts_delay
,
p_subpic
->
i_start
);
if
(
p_subpic
->
i_stop
)
p_subpic
->
i_stop
=
input_clock_GetTS
(
p_clock
,
i_ts_delay
,
p_subpic
->
i_stop
);
p_subpic
->
i_stop
=
input_clock_GetTS
(
p_clock
,
NULL
,
i_ts_delay
,
p_subpic
->
i_stop
);
/* Do not create ephemere picture because of rounding errors */
if
(
!
b_ephemere
&&
p_subpic
->
i_start
==
p_subpic
->
i_stop
)
...
...
@@ -845,7 +856,6 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
{
aout_instance_t
*
p_aout
=
p_owner
->
p_aout
;
aout_input_t
*
p_aout_input
=
p_owner
->
p_aout_input
;
int
i_rate
;
int
i_lost
;
int
i_played
;
...
...
@@ -875,15 +885,12 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
DecoderWaitUnpause
(
p_dec
);
const
mtime_t
i_delay
=
DecoderGetTotalDelay
(
p_dec
);
int
i_rate
=
INPUT_RATE_DEFAULT
;
DecoderAoutBufferFixTs
(
p_aout_buf
,
p_clock
,
i_delay
);
DecoderAoutBufferFixTs
(
p_aout_buf
,
&
i_rate
,
p_clock
,
i_delay
);
if
(
p_clock
)
i_rate
=
input_clock_GetRate
(
p_clock
);
else
if
(
p_block
&&
p_block
->
i_rate
>
0
)
if
(
!
p_clock
&&
p_block
&&
p_block
->
i_rate
>
0
)
i_rate
=
p_block
->
i_rate
;
else
i_rate
=
INPUT_RATE_DEFAULT
;
/* FIXME TODO take care of audio-delay for mdate check */
const
mtime_t
i_max_date
=
mdate
()
+
i_delay
+
AOUT_MAX_ADVANCE_TIME
;
...
...
src/input/es_out.c
View file @
f1e16994
...
...
@@ -367,25 +367,6 @@ mtime_t input_EsOutGetWakeup( es_out_t *out )
return
input_clock_GetWakeup
(
p_sys
->
p_pgrm
->
p_clock
);
}
static
void
EsOutDiscontinuity
(
es_out_t
*
out
,
bool
b_flush
,
bool
b_audio
)
{
es_out_sys_t
*
p_sys
=
out
->
p_sys
;
int
i
;
for
(
i
=
0
;
i
<
p_sys
->
i_es
;
i
++
)
{
es_out_id_t
*
es
=
p_sys
->
es
[
i
];
/* Send a dummy block to let decoder know that
* there is a discontinuity */
if
(
es
->
p_dec
&&
(
!
b_audio
||
es
->
fmt
.
i_cat
==
AUDIO_ES
)
)
{
input_DecoderDiscontinuity
(
es
->
p_dec
,
b_flush
);
if
(
es
->
p_dec_record
)
input_DecoderDiscontinuity
(
es
->
p_dec_record
,
b_flush
);
}
}
}
static
void
EsOutDecodersChangePause
(
es_out_t
*
out
,
bool
b_paused
,
mtime_t
i_date
)
{
es_out_sys_t
*
p_sys
=
out
->
p_sys
;
...
...
@@ -542,10 +523,23 @@ void input_EsOutChangePause( es_out_t *out, bool b_paused, mtime_t i_date )
}
void
input_EsOutChangePosition
(
es_out_t
*
out
)
{
//es_out_sys_t *p_sys = out->p_sys;
es_out_sys_t
*
p_sys
=
out
->
p_sys
;
for
(
int
i
=
0
;
i
<
p_sys
->
i_es
;
i
++
)
{
es_out_id_t
*
es
=
p_sys
->
es
[
i
];
/* Send a dummy block to let decoder know that
* there is a discontinuity */
if
(
es
->
p_dec
)
{
input_DecoderFlush
(
es
->
p_dec
);
if
(
es
->
p_dec_record
)
input_DecoderFlush
(
es
->
p_dec_record
);
}
}
es_out_Control
(
out
,
ES_OUT_RESET_PCR
);
EsOutDiscontinuity
(
out
,
true
,
false
);
}
bool
input_EsOutDecodersEmpty
(
es_out_t
*
out
)
...
...
@@ -557,9 +551,9 @@ bool input_EsOutDecodersEmpty( es_out_t *out )
{
es_out_id_t
*
es
=
p_sys
->
es
[
i
];
if
(
es
->
p_dec
&&
!
input_DecoderEmpty
(
es
->
p_dec
)
)
if
(
es
->
p_dec
&&
!
input_Decoder
Is
Empty
(
es
->
p_dec
)
)
return
false
;
if
(
es
->
p_dec_record
&&
!
input_DecoderEmpty
(
es
->
p_dec_record
)
)
if
(
es
->
p_dec_record
&&
!
input_Decoder
Is
Empty
(
es
->
p_dec_record
)
)
return
false
;
}
return
true
;
...
...
@@ -1558,7 +1552,6 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
{
es_out_sys_t
*
p_sys
=
out
->
p_sys
;
input_thread_t
*
p_input
=
p_sys
->
p_input
;
es_out_pgrm_t
*
p_pgrm
=
es
->
p_pgrm
;
int
i_total
=
0
;
if
(
libvlc_stats
(
p_input
)
)
...
...
@@ -1653,8 +1646,8 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
{
while
(
!
out
->
p_sys
->
p_input
->
b_die
&&
es
->
p_dec
)
{
if
(
input_DecoderEmpty
(
es
->
p_dec
)
&&
(
!
es
->
p_dec_record
||
input_DecoderEmpty
(
es
->
p_dec_record
)
))
if
(
input_Decoder
Is
Empty
(
es
->
p_dec
)
&&
(
!
es
->
p_dec_record
||
input_Decoder
Is
Empty
(
es
->
p_dec_record
)
))
break
;
msleep
(
20
*
1000
);
}
...
...
@@ -1933,7 +1926,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
{
int64_t
i_ts
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
int64_t
*
pi_ts
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_ts
=
input_clock_GetTS
(
p_sys
->
p_pgrm
->
p_clock
,
*
pi_ts
=
input_clock_GetTS
(
p_sys
->
p_pgrm
->
p_clock
,
NULL
,
p_sys
->
p_input
->
i_pts_delay
,
i_ts
);
return
VLC_SUCCESS
;
}
...
...
src/input/input_clock.h
View file @
f1e16994
...
...
@@ -77,8 +77,11 @@ void input_clock_ChangePause( input_clock_t *, bool b_paused, mtime_t i_date
/**
* This function converts a timestamp from stream clock to system clock.
*
* If pi_rate is provided it will be field with the rate value used for
* the conversion.
*/
mtime_t
input_clock_GetTS
(
input_clock_t
*
,
mtime_t
i_pts_delay
,
mtime_t
);
mtime_t
input_clock_GetTS
(
input_clock_t
*
,
int
*
pi_rate
,
mtime_t
i_pts_delay
,
mtime_t
);
/**
* This function returns the current rate.
...
...
src/input/input_decoder.h
View file @
f1e16994
...
...
@@ -47,15 +47,14 @@ void input_DecoderChangePause( decoder_t *, bool b_paused, mtime_t i_date );
void
input_DecoderChangeDelay
(
decoder_t
*
,
mtime_t
i_delay
);
/**
* This function warn the decoder about a discontinuity and allow flushing
* if requested.
* This function will cause a flush of the decoder.
*/
void
input_Decoder
Discontinuity
(
decoder_t
*
,
bool
b_flush
);
void
input_Decoder
Flush
(
decoder_t
*
);
/**
* This function returns true if the decoder fifo is empty and false otherwise.
*/
bool
input_DecoderEmpty
(
decoder_t
*
);
bool
input_Decoder
Is
Empty
(
decoder_t
*
);
/**
* This function activates the request closed caption channel.
...
...
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