[vlc-commits] demux: flac: fix pos/length on non zero starting flac
Francois Cartegnie
git at videolan.org
Sat Mar 17 20:32:28 CET 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Mar 15 20:14:03 2018 +0100| [8d3ffa9de5aa6df3cc5aba6a96079d3916dedc69] | committer: Francois Cartegnie
demux: flac: fix pos/length on non zero starting flac
(cherry picked from commit 8a9c932789d7e91bd1cef8ce60ba750c51c7f867)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8d3ffa9de5aa6df3cc5aba6a96079d3916dedc69
---
modules/demux/flac.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 33de6aacbc..22ed917b04 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -510,10 +510,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
const double f = va_arg( args, double );
int64_t i_length = ControlGetLength( p_demux );
+ int i_ret;
if( i_length > 0 )
- return ControlSetTime( p_demux, i_length * f );
+ {
+ i_ret = ControlSetTime( p_demux, i_length * f );
+ if( i_ret == VLC_SUCCESS )
+ return i_ret;
+ }
/* just byte pos seek */
- int i_ret = vlc_stream_Seek( p_demux->s, (int64_t) (f * stream_Size( p_demux->s )) );
+ i_ret = vlc_stream_Seek( p_demux->s, (int64_t) (f * stream_Size( p_demux->s )) );
if( i_ret == VLC_SUCCESS )
{
p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
@@ -532,10 +537,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
const int64_t i_length = ControlGetLength(p_demux);
if( i_length > 0 )
{
- double *pf = va_arg( args, double * );
double current = ControlGetTime(p_demux);
- *pf = current / (double)i_length;
- return VLC_SUCCESS;
+ if( current <= i_length )
+ {
+ *(va_arg( args, double * )) = current / (double)i_length;
+ return VLC_SUCCESS;
+ }
}
/* Else fallback on byte position */
}
More information about the vlc-commits
mailing list