[vlc-commits] dec: change get_display_rate() return type
Thomas Guillem
git at videolan.org
Fri Jun 8 11:05:12 CEST 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun 8 10:37:22 2018 +0200| [109318739145973c6aa58f57f66c24489bbf0d55] | committer: Thomas Guillem
dec: change get_display_rate() return type
Return a float in order to behave like the future output clock.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=109318739145973c6aa58f57f66c24489bbf0d55
---
include/vlc_codec.h | 6 +++---
modules/codec/synchro.c | 5 ++---
src/input/decoder.c | 6 +++---
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 75b9ed3ddf..3af54e6479 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -64,7 +64,7 @@ struct decoder_owner_callbacks
mtime_t (*get_display_date)( decoder_t *, mtime_t );
/* Display rate
* cf. decoder_GetDisplayRate */
- int (*get_display_rate)( decoder_t * );
+ float (*get_display_rate)( decoder_t * );
} video;
struct
{
@@ -444,11 +444,11 @@ static inline mtime_t decoder_GetDisplayDate( decoder_t *dec, mtime_t i_ts )
* You MUST use it *only* for gathering statistics about speed.
*/
VLC_USED
-static inline int decoder_GetDisplayRate( decoder_t *dec )
+static inline float decoder_GetDisplayRate( decoder_t *dec )
{
assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
if( !dec->cbs->video.get_display_rate )
- return 1000 /* XXX: INPUT_RATE_DEFAULT */;
+ return 1.f;
return dec->cbs->video.get_display_rate( dec );
}
diff --git a/modules/codec/synchro.c b/modules/codec/synchro.c
index 61ec70e321..02e8753825 100644
--- a/modules/codec/synchro.c
+++ b/modules/codec/synchro.c
@@ -217,7 +217,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
mtime_t now, period;
mtime_t pts;
bool b_decode = 0;
- int i_current_rate;
+ float i_current_rate;
if ( p_synchro->b_no_skip )
return 1;
@@ -225,8 +225,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
i_current_rate = decoder_GetDisplayRate( p_synchro->p_dec );
now = mdate();
- period = CLOCK_FREQ * 1001 / p_synchro->i_frame_rate
- * i_current_rate / INPUT_RATE_DEFAULT;
+ period = CLOCK_FREQ * 1001 / p_synchro->i_frame_rate * i_current_rate;
p_synchro->i_render_time = i_render_time;
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 70f1bb3e4d..9bc7fe32be 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -643,13 +643,13 @@ static mtime_t DecoderGetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
return i_ts;
}
-static int DecoderGetDisplayRate( decoder_t *p_dec )
+static float DecoderGetDisplayRate( decoder_t *p_dec )
{
struct decoder_owner *p_owner = dec_get_owner( p_dec );
if( !p_owner->p_clock )
- return INPUT_RATE_DEFAULT;
- return input_clock_GetRate( p_owner->p_clock );
+ return 1.f;
+ return input_clock_GetRate( p_owner->p_clock ) / (float) INPUT_RATE_DEFAULT;
}
/*****************************************************************************
More information about the vlc-commits
mailing list