[vlc-devel] commit: avformat: better seperation between time and byte seek operations. (Derk-Jan Hartman )

git version control git at videolan.org
Wed Jun 17 22:47:40 CEST 2009


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Wed Jun 17 22:44:28 2009 +0200| [7d91581a9beeda493919b3cb50ec89e192e86392] | committer: Derk-Jan Hartman 

avformat: better seperation between time and byte seek operations.

It seems that avformat does not recover from a byteseek when it does not know a duration for the file. It continiously spits out data with pts values of AV_NOPTS_VALUE after the seek.

Tested with mxf_original_NOB_format.mxf

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7d91581a9beeda493919b3cb50ec89e192e86392
---

 modules/demux/avformat/demux.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 16a9cb0..9bf5684 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -535,7 +535,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_SET_POSITION:
             f = (double) va_arg( args, double );
-            i64 = stream_Tell( p_demux->s );
             if( p_sys->i_pcr > 0 )
             {
                 i64 = p_sys->ic->duration * f;
@@ -550,12 +549,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                     (av_seek_frame( p_sys->ic, -1, i64, 0 ) < 0) )
                 {
                     int64_t i_size = stream_Size( p_demux->s );
+                    i64 = (i_size * f);
 
                     msg_Warn( p_demux, "DEMUX_SET_BYTE_POSITION: %"PRId64, i64 );
-                    if( av_seek_frame( p_sys->ic, -1, (i_size * f), AVSEEK_FLAG_BYTE ) < 0 )
+                    if( av_seek_frame( p_sys->ic, -1, i64, AVSEEK_FLAG_BYTE ) < 0 )
                         return VLC_EGENERIC;
                 }
-                UpdateSeekPoint( p_demux, i64 );
+                else
+                {
+                    UpdateSeekPoint( p_demux, i64 );
+                }
                 p_sys->i_pcr = -1; /* Invalidate time display */
             }
             return VLC_SUCCESS;




More information about the vlc-devel mailing list