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
a1aca436
Commit
a1aca436
authored
Apr 26, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete input/decoder.c review to use VLC_TS_INVALID.
No functionnal changes.
parent
2ae89ba1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
31 deletions
+32
-31
src/input/decoder.c
src/input/decoder.c
+32
-31
No files found.
src/input/decoder.c
View file @
a1aca436
...
@@ -239,7 +239,7 @@ int decoder_GetInputAttachments( decoder_t *p_dec,
...
@@ -239,7 +239,7 @@ int decoder_GetInputAttachments( decoder_t *p_dec,
mtime_t
decoder_GetDisplayDate
(
decoder_t
*
p_dec
,
mtime_t
i_ts
)
mtime_t
decoder_GetDisplayDate
(
decoder_t
*
p_dec
,
mtime_t
i_ts
)
{
{
if
(
!
p_dec
->
pf_get_display_date
)
if
(
!
p_dec
->
pf_get_display_date
)
return
0
;
return
VLC_TS_INVALID
;
return
p_dec
->
pf_get_display_date
(
p_dec
,
i_ts
);
return
p_dec
->
pf_get_display_date
(
p_dec
,
i_ts
);
}
}
...
@@ -649,14 +649,14 @@ static mtime_t DecoderGetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
...
@@ -649,14 +649,14 @@ static mtime_t DecoderGetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
vlc_mutex_lock
(
&
p_owner
->
lock
);
vlc_mutex_lock
(
&
p_owner
->
lock
);
if
(
p_owner
->
b_buffering
||
p_owner
->
b_paused
)
if
(
p_owner
->
b_buffering
||
p_owner
->
b_paused
)
i_ts
=
0
;
i_ts
=
VLC_TS_INVALID
;
vlc_mutex_unlock
(
&
p_owner
->
lock
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
if
(
!
p_owner
->
p_clock
||
!
i_ts
)
if
(
!
p_owner
->
p_clock
||
i_ts
<=
VLC_TS_INVALID
)
return
i_ts
;
return
i_ts
;
if
(
input_clock_ConvertTS
(
p_owner
->
p_clock
,
NULL
,
&
i_ts
,
NULL
,
INT64_MAX
)
)
if
(
input_clock_ConvertTS
(
p_owner
->
p_clock
,
NULL
,
&
i_ts
,
NULL
,
INT64_MAX
)
)
return
0
;
return
VLC_TS_INVALID
;
return
i_ts
;
return
i_ts
;
}
}
...
@@ -725,7 +725,7 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
...
@@ -725,7 +725,7 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
vlc_object_release
(
p_dec
);
vlc_object_release
(
p_dec
);
return
NULL
;
return
NULL
;
}
}
p_dec
->
p_owner
->
i_preroll_end
=
-
1
;
p_dec
->
p_owner
->
i_preroll_end
=
VLC_TS_INVALID
;
p_dec
->
p_owner
->
i_last_rate
=
INPUT_RATE_DEFAULT
;
p_dec
->
p_owner
->
i_last_rate
=
INPUT_RATE_DEFAULT
;
p_dec
->
p_owner
->
p_input
=
p_input
;
p_dec
->
p_owner
->
p_input
=
p_input
;
p_dec
->
p_owner
->
p_aout
=
NULL
;
p_dec
->
p_owner
->
p_aout
=
NULL
;
...
@@ -825,7 +825,7 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
...
@@ -825,7 +825,7 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
p_owner
->
p_description
=
NULL
;
p_owner
->
p_description
=
NULL
;
p_owner
->
b_paused
=
false
;
p_owner
->
b_paused
=
false
;
p_owner
->
pause
.
i_date
=
0
;
p_owner
->
pause
.
i_date
=
VLC_TS_INVALID
;
p_owner
->
pause
.
i_ignore
=
0
;
p_owner
->
pause
.
i_ignore
=
0
;
p_owner
->
b_buffering
=
false
;
p_owner
->
b_buffering
=
false
;
...
@@ -1016,9 +1016,9 @@ static inline void DecoderUpdatePreroll( int64_t *pi_preroll, const block_t *p )
...
@@ -1016,9 +1016,9 @@ static inline void DecoderUpdatePreroll( int64_t *pi_preroll, const block_t *p )
{
{
if
(
p
->
i_flags
&
(
BLOCK_FLAG_PREROLL
|
BLOCK_FLAG_DISCONTINUITY
)
)
if
(
p
->
i_flags
&
(
BLOCK_FLAG_PREROLL
|
BLOCK_FLAG_DISCONTINUITY
)
)
*
pi_preroll
=
INT64_MAX
;
*
pi_preroll
=
INT64_MAX
;
else
if
(
p
->
i_dts
>
0
)
else
if
(
p
->
i_dts
>
VLC_TS_INVALID
)
*
pi_preroll
=
__MIN
(
*
pi_preroll
,
p
->
i_dts
);
*
pi_preroll
=
__MIN
(
*
pi_preroll
,
p
->
i_dts
);
else
if
(
p
->
i_pts
>
0
)
else
if
(
p
->
i_pts
>
VLC_TS_INVALID
)
*
pi_preroll
=
__MIN
(
*
pi_preroll
,
p
->
i_pts
);
*
pi_preroll
=
__MIN
(
*
pi_preroll
,
p
->
i_pts
);
}
}
...
@@ -1027,7 +1027,7 @@ static mtime_t DecoderTeletextFixTs( mtime_t i_ts )
...
@@ -1027,7 +1027,7 @@ static mtime_t DecoderTeletextFixTs( mtime_t i_ts )
mtime_t
current_date
=
mdate
();
mtime_t
current_date
=
mdate
();
/* FIXME I don't really like that, es_out SHOULD do it using the video pts */
/* FIXME I don't really like that, es_out SHOULD do it using the video pts */
if
(
!
i_ts
||
i_ts
>
current_date
+
10000000
||
i_ts
<
current_date
)
if
(
i_ts
<=
VLC_TS_INVALID
||
i_ts
>
current_date
+
10000000
||
i_ts
<
current_date
)
{
{
/* ETSI EN 300 472 Annex A : do not take into account the PTS
/* ETSI EN 300 472 Annex A : do not take into account the PTS
* for teletext streams. */
* for teletext streams. */
...
@@ -1051,13 +1051,13 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
...
@@ -1051,13 +1051,13 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
const
bool
b_ephemere
=
pi_ts1
&&
*
pi_ts0
==
*
pi_ts1
;
const
bool
b_ephemere
=
pi_ts1
&&
*
pi_ts0
==
*
pi_ts1
;
int
i_rate
;
int
i_rate
;
if
(
*
pi_ts0
>
0
)
if
(
*
pi_ts0
>
VLC_TS_INVALID
)
{
{
*
pi_ts0
+=
i_es_delay
;
*
pi_ts0
+=
i_es_delay
;
if
(
pi_ts1
&&
*
pi_ts1
>
0
)
if
(
pi_ts1
&&
*
pi_ts1
>
VLC_TS_INVALID
)
*
pi_ts1
+=
i_es_delay
;
*
pi_ts1
+=
i_es_delay
;
if
(
input_clock_ConvertTS
(
p_clock
,
&
i_rate
,
pi_ts0
,
pi_ts1
,
i_ts_bound
)
)
if
(
input_clock_ConvertTS
(
p_clock
,
&
i_rate
,
pi_ts0
,
pi_ts1
,
i_ts_bound
)
)
*
pi_ts0
=
0
;
*
pi_ts0
=
VLC_TS_INVALID
;
}
}
else
else
{
{
...
@@ -1078,7 +1078,7 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
...
@@ -1078,7 +1078,7 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
if
(
b_telx
)
if
(
b_telx
)
{
{
*
pi_ts0
=
DecoderTeletextFixTs
(
*
pi_ts0
);
*
pi_ts0
=
DecoderTeletextFixTs
(
*
pi_ts0
);
if
(
pi_ts1
&&
*
pi_ts1
<=
0
)
if
(
pi_ts1
&&
*
pi_ts1
<=
VLC_TS_INVALID
)
*
pi_ts1
=
*
pi_ts0
;
*
pi_ts1
=
*
pi_ts0
;
}
}
}
}
...
@@ -1092,7 +1092,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
...
@@ -1092,7 +1092,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
aout_input_t
*
p_aout_input
=
p_owner
->
p_aout_input
;
aout_input_t
*
p_aout_input
=
p_owner
->
p_aout_input
;
/* */
/* */
if
(
p_audio
->
start_date
<=
0
)
if
(
p_audio
->
start_date
<=
VLC_TS_INVALID
)
// FIXME --VLC_TS_INVALID verify audio_output/*
{
{
msg_Warn
(
p_dec
,
"non-dated audio buffer received"
);
msg_Warn
(
p_dec
,
"non-dated audio buffer received"
);
*
pi_lost_sum
+=
1
;
*
pi_lost_sum
+=
1
;
...
@@ -1145,7 +1145,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
...
@@ -1145,7 +1145,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
}
}
/* */
/* */
const
bool
b_dated
=
p_audio
->
start_date
>
0
;
const
bool
b_dated
=
p_audio
->
start_date
>
VLC_TS_INVALID
;
int
i_rate
=
INPUT_RATE_DEFAULT
;
int
i_rate
=
INPUT_RATE_DEFAULT
;
DecoderFixTs
(
p_dec
,
&
p_audio
->
start_date
,
&
p_audio
->
end_date
,
NULL
,
DecoderFixTs
(
p_dec
,
&
p_audio
->
start_date
,
&
p_audio
->
end_date
,
NULL
,
...
@@ -1154,7 +1154,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
...
@@ -1154,7 +1154,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
vlc_mutex_unlock
(
&
p_owner
->
lock
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
if
(
!
p_aout
||
!
p_aout_input
||
if
(
!
p_aout
||
!
p_aout_input
||
p_audio
->
start_date
<=
0
||
p_audio
->
start_date
<=
VLC_TS_INVALID
||
i_rate
<
INPUT_RATE_DEFAULT
/
AOUT_MAX_INPUT_RATE
||
i_rate
<
INPUT_RATE_DEFAULT
/
AOUT_MAX_INPUT_RATE
||
i_rate
>
INPUT_RATE_DEFAULT
*
AOUT_MAX_INPUT_RATE
)
i_rate
>
INPUT_RATE_DEFAULT
*
AOUT_MAX_INPUT_RATE
)
b_reject
=
true
;
b_reject
=
true
;
...
@@ -1227,19 +1227,20 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
...
@@ -1227,19 +1227,20 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
}
}
i_decoded
++
;
i_decoded
++
;
if
(
p_aout_buf
->
start_date
<
p_owner
->
i_preroll_end
)
if
(
p_owner
->
i_preroll_end
>
VLC_TS_INVALID
&&
p_aout_buf
->
start_date
<
p_owner
->
i_preroll_end
)
{
{
aout_DecDeleteBuffer
(
p_aout
,
p_aout_input
,
p_aout_buf
);
aout_DecDeleteBuffer
(
p_aout
,
p_aout_input
,
p_aout_buf
);
continue
;
continue
;
}
}
if
(
p_owner
->
i_preroll_end
>
0
)
if
(
p_owner
->
i_preroll_end
>
VLC_TS_INVALID
)
{
{
msg_Dbg
(
p_dec
,
"End of audio preroll"
);
msg_Dbg
(
p_dec
,
"End of audio preroll"
);
if
(
p_owner
->
p_aout
&&
p_owner
->
p_aout_input
)
if
(
p_owner
->
p_aout
&&
p_owner
->
p_aout_input
)
aout_DecFlush
(
p_owner
->
p_aout
,
p_owner
->
p_aout_input
);
aout_DecFlush
(
p_owner
->
p_aout
,
p_owner
->
p_aout_input
);
/* */
/* */
p_owner
->
i_preroll_end
=
-
1
;
p_owner
->
i_preroll_end
=
VLC_TS_INVALID
;
}
}
DecoderPlayAudio
(
p_dec
,
p_aout_buf
,
&
i_played
,
&
i_lost
);
DecoderPlayAudio
(
p_dec
,
p_aout_buf
,
&
i_played
,
&
i_lost
);
...
@@ -1307,7 +1308,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
...
@@ -1307,7 +1308,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
vout_thread_t
*
p_vout
=
p_owner
->
p_vout
;
vout_thread_t
*
p_vout
=
p_owner
->
p_vout
;
bool
b_first_buffered
;
bool
b_first_buffered
;
if
(
p_picture
->
date
<=
0
)
if
(
p_picture
->
date
<=
VLC_TS_INVALID
)
{
{
msg_Warn
(
p_vout
,
"non-dated video buffer received"
);
msg_Warn
(
p_vout
,
"non-dated video buffer received"
);
*
pi_lost_sum
+=
1
;
*
pi_lost_sum
+=
1
;
...
@@ -1373,7 +1374,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
...
@@ -1373,7 +1374,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
p_picture
->
b_force
=
true
;
p_picture
->
b_force
=
true
;
}
}
const
bool
b_dated
=
p_picture
->
date
>
0
;
const
bool
b_dated
=
p_picture
->
date
>
VLC_TS_INVALID
;
int
i_rate
=
INPUT_RATE_DEFAULT
;
int
i_rate
=
INPUT_RATE_DEFAULT
;
DecoderFixTs
(
p_dec
,
&
p_picture
->
date
,
NULL
,
NULL
,
DecoderFixTs
(
p_dec
,
&
p_picture
->
date
,
NULL
,
NULL
,
&
i_rate
,
DECODER_BOGUS_VIDEO_DELAY
,
false
);
&
i_rate
,
DECODER_BOGUS_VIDEO_DELAY
,
false
);
...
@@ -1381,7 +1382,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
...
@@ -1381,7 +1382,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
vlc_mutex_unlock
(
&
p_owner
->
lock
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
/* */
/* */
if
(
!
p_picture
->
b_force
&&
p_picture
->
date
<=
0
)
if
(
!
p_picture
->
b_force
&&
p_picture
->
date
<=
VLC_TS_INVALID
)
// FIXME --VLC_TS_INVALID verify video_output/*
b_reject
=
true
;
b_reject
=
true
;
if
(
!
b_reject
)
if
(
!
b_reject
)
...
@@ -1446,19 +1447,19 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
...
@@ -1446,19 +1447,19 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
i_decoded
++
;
i_decoded
++
;
if
(
p_pic
->
date
<
p_owner
->
i_preroll_end
)
if
(
p_
owner
->
i_preroll_end
>
VLC_TS_INVALID
&&
p_
pic
->
date
<
p_owner
->
i_preroll_end
)
{
{
vout_DropPicture
(
p_vout
,
p_pic
);
vout_DropPicture
(
p_vout
,
p_pic
);
continue
;
continue
;
}
}
if
(
p_owner
->
i_preroll_end
>
0
)
if
(
p_owner
->
i_preroll_end
>
VLC_TS_INVALID
)
{
{
msg_Dbg
(
p_dec
,
"End of video preroll"
);
msg_Dbg
(
p_dec
,
"End of video preroll"
);
if
(
p_vout
)
if
(
p_vout
)
vout_Flush
(
p_vout
,
1
);
vout_Flush
(
p_vout
,
VLC_TS_INVALID
+
1
);
/* */
/* */
p_owner
->
i_preroll_end
=
-
1
;
p_owner
->
i_preroll_end
=
VLC_TS_INVALID
;
}
}
if
(
p_dec
->
pf_get_cc
&&
if
(
p_dec
->
pf_get_cc
&&
...
@@ -1490,7 +1491,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic,
...
@@ -1490,7 +1491,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic,
vout_thread_t
*
p_vout
=
p_owner
->
p_spu_vout
;
vout_thread_t
*
p_vout
=
p_owner
->
p_spu_vout
;
/* */
/* */
if
(
p_subpic
->
i_start
<=
0
)
if
(
p_subpic
->
i_start
<=
VLC_TS_INVALID
)
{
{
msg_Warn
(
p_dec
,
"non-dated spu buffer received"
);
msg_Warn
(
p_dec
,
"non-dated spu buffer received"
);
subpicture_Delete
(
p_subpic
);
subpicture_Delete
(
p_subpic
);
...
@@ -1619,7 +1620,7 @@ static void DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block,
...
@@ -1619,7 +1620,7 @@ static void DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block,
vlc_mutex_unlock
(
&
p_owner
->
lock
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
if
(
!
b_reject
)
if
(
!
b_reject
)
sout_InputSendBuffer
(
p_owner
->
p_sout_input
,
p_sout_block
);
sout_InputSendBuffer
(
p_owner
->
p_sout_input
,
p_sout_block
);
// FIXME --VLC_TS_INVALID inspect stream_output/*
else
else
block_Release
(
p_sout_block
);
block_Release
(
p_sout_block
);
...
@@ -1807,7 +1808,7 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block, bool b_flus
...
@@ -1807,7 +1808,7 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block, bool b_flus
}
}
if
(
b_flush
&&
p_owner
->
p_vout
)
if
(
b_flush
&&
p_owner
->
p_vout
)
vout_Flush
(
p_owner
->
p_vout
,
1
);
vout_Flush
(
p_owner
->
p_vout
,
VLC_TS_INVALID
+
1
);
}
}
/* This function process a audio block
/* This function process a audio block
...
@@ -1879,9 +1880,9 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush
...
@@ -1879,9 +1880,9 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush
if
(
p_vout
&&
p_owner
->
p_spu_vout
==
p_vout
)
if
(
p_vout
&&
p_owner
->
p_spu_vout
==
p_vout
)
{
{
/* Preroll does not work very well with subtitle */
/* Preroll does not work very well with subtitle */
if
(
p_spu
->
i_start
>
0
&&
if
(
p_spu
->
i_start
>
VLC_TS_INVALID
&&
p_spu
->
i_start
<
p_owner
->
i_preroll_end
&&
p_spu
->
i_start
<
p_owner
->
i_preroll_end
&&
(
p_spu
->
i_stop
<=
0
||
p_spu
->
i_stop
<
p_owner
->
i_preroll_end
)
)
(
p_spu
->
i_stop
<=
VLC_TS_INVALID
||
p_spu
->
i_stop
<
p_owner
->
i_preroll_end
)
)
{
{
subpicture_Delete
(
p_spu
);
subpicture_Delete
(
p_spu
);
}
}
...
...
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