]> git.sesse.net Git - vlc/blobdiff - modules/demux/gme.cpp
Merge branch 'master' of git.videolan.org:vlc
[vlc] / modules / demux / gme.cpp
index dd3ac00a14d09f35b21595544fd384635b13d98f..dcd213f73ebece167e5aad257bb6798e2f89542a 100644 (file)
@@ -115,13 +115,14 @@ static int Open( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
     char        *ext;
-    int         i;
+    int         i = 0;
     vlc_value_t val;
  
     /* We accept file based on extention match */
     if( !p_demux->b_force )
     {
-        if( ( ext = strrchr( p_demux->psz_path, '.' ) ) == NULL ||
+        if( p_demux->psz_file == NULL
+         || ( ext = strrchr( p_demux->psz_file, '.' ) ) == NULL ||
             stream_Size( p_demux->s ) == 0 ) return VLC_EGENERIC;
 
         ext++;  /* skip . */
@@ -309,7 +310,7 @@ static int Open( vlc_object_t *p_this )
     }
 
    /* init time */
-    p_sys->i_time  = 1;
+    p_sys->i_time  = 0;
     p_sys->i_length = 314 * (int64_t)1000;
 
     msg_Dbg( p_demux, "GME loaded type=%s title=%s tracks=%i", type_str[p_sys->i_type],
@@ -377,13 +378,13 @@ static int Demux( demux_t *p_demux )
     for (int i = 0; i<i_buf; i++) p_frame->p_buffer[i] = ((uint8_t *)p_emubuf)[i];
 
     /* Set PCR */
-    es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_time );
+    es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_time );
+    p_frame->i_dts = p_frame->i_pts = VLC_TS_0 + p_sys->i_time;
 
     /* We should use p_frame->i_buffer */
     p_sys->i_time += (int64_t)1000000 * p_frame->i_buffer / i_bk / p_sys->fmt.audio.i_rate;
 
     /* Send data */
-    p_frame->i_dts = p_frame->i_pts = p_sys->i_time;
     es_out_Send( p_demux->out, p_sys->es, p_frame );
 
     return 1;
@@ -426,7 +427,7 @@ switch( i_query )
             if( i64 >= 0 && i64 <= p_sys->i_length )
             {
                 ModPlug_Seek( p_sys->f, i64 / 1000 );
-                p_sys->i_time = i64 + 1;
+                p_sys->i_time = i64;
 
                 return VLC_SUCCESS;
             }
@@ -448,7 +449,7 @@ switch( i_query )
             if( i64 >= 0 && i64 <= p_sys->i_length )
             {
                 ModPlug_Seek( p_sys->f, i64 / 1000 );
-                p_sys->i_time = i64 + 1;
+                p_sys->i_time = i64;
 
                 return VLC_SUCCESS;
             }