changeset 16877:9081ae3a702c

move resync_audio_stream after seeking to demuxer.c
author reimar
date Sun, 30 Oct 2005 09:19:05 +0000
parents 9dd44ff7ec32
children 865ba529e6fd
files libmpdemux/demux_aac.c libmpdemux/demux_asf.c libmpdemux/demux_audio.c libmpdemux/demux_avi.c libmpdemux/demux_mkv.c libmpdemux/demux_mpc.c libmpdemux/demux_mpg.c libmpdemux/demux_ogg.c libmpdemux/demux_rawaudio.c libmpdemux/demux_real.c libmpdemux/demux_ts.c libmpdemux/demux_ty.c libmpdemux/demux_vqf.c libmpdemux/demux_xmms.c libmpdemux/demuxer.c
diffstat 15 files changed, 3 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_aac.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_aac.c	Sun Oct 30 09:19:05 2005 +0000
@@ -14,8 +14,6 @@
 #include "bswap.h"
 #include "ms_hdr.h"
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
-
 typedef struct {
 	uint8_t *buf;
 	uint64_t size;	/// amount of time of data packets pushed to demuxer->audio (in bytes)
@@ -248,7 +246,6 @@
 		}
 	}
 	sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)priv->bitrate;
-	resync_audio_stream(sh_audio);
 }
 
 
--- a/libmpdemux/demux_asf.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_asf.c	Sun Oct 30 09:19:05 2005 +0000
@@ -359,7 +359,6 @@
 
 #include "stheader.h"
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
 extern void skip_audio_frame(sh_audio_t *sh_audio);
 
 static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
@@ -390,7 +389,6 @@
     ds_fill_buffer(d_video);
     if(sh_audio){
       ds_fill_buffer(d_audio);
-      resync_audio_stream(sh_audio);
     }
     
     if (d_video->id < 0)
--- a/libmpdemux/demux_audio.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_audio.c	Sun Oct 30 09:19:05 2005 +0000
@@ -44,7 +44,6 @@
 } mp3_hdr_t;
 
 extern void free_sh_audio(sh_audio_t* sh);
-extern void resync_audio_stream(sh_audio_t *sh_audio);
 extern void print_wave_header(WAVEFORMATEX *h);
 
 int hr_mp3_seek = 0;
@@ -496,7 +495,6 @@
     if(len > 0)
       high_res_mp3_seek(demuxer,len);
     sh_audio->delay = priv->last_pts -  (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
-    resync_audio_stream(sh_audio);
     return;
   }
 
@@ -527,9 +525,6 @@
   }
 
   stream_seek(s,pos);
-
-  resync_audio_stream(sh_audio);
-
 }
 
 static void demux_close_audio(demuxer_t* demuxer) {
--- a/libmpdemux/demux_avi.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_avi.c	Sun Oct 30 09:19:05 2005 +0000
@@ -617,7 +617,6 @@
 }
 
 //extern float initial_pts_delay;
-extern void resync_audio_stream(sh_audio_t *sh_audio);
 
 void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
     avi_priv_t *priv=demuxer->priv;
@@ -806,7 +805,6 @@
             demux_read_data(d_audio,NULL,skip_audio_bytes);
             //d_audio->pts=0; // PTS is outdated because of the raw data skipping
           }
-	  resync_audio_stream(sh_audio);
 
 //          sh_audio->timer=-skip_audio_secs;
 
--- a/libmpdemux/demux_mkv.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_mkv.c	Sun Oct 30 09:19:05 2005 +0000
@@ -3117,7 +3117,6 @@
   free_cached_dps (demuxer);
   if (!(flags & 2))  /* time in secs */
     {
-      void resync_audio_stream(sh_audio_t *sh_audio);
       mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
       stream_t *s = demuxer->stream;
       int64_t target_timecode = 0, diff, min_diff=0xFFFFFFFL;
@@ -3228,15 +3227,11 @@
         clear_subtitles(demuxer, 0, 1);
 
       demux_mkv_fill_buffer(demuxer, NULL);
-
-      if(demuxer->audio->sh != NULL)
-        resync_audio_stream((sh_audio_t *) demuxer->audio->sh); 
     }
   else if ((demuxer->movi_end <= 0) || !(flags & 1))
     mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
   else
     {
-      void resync_audio_stream(sh_audio_t *sh_audio);
       mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
       stream_t *s = demuxer->stream;
       uint64_t target_filepos;
@@ -3274,9 +3269,6 @@
         clear_subtitles(demuxer, 0, 1);
 
       demux_mkv_fill_buffer(demuxer, NULL);
-
-      if(demuxer->audio->sh != NULL)
-        resync_audio_stream((sh_audio_t *) demuxer->audio->sh); 
     }
 }
 
--- a/libmpdemux/demux_mpc.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_mpc.c	Sun Oct 30 09:19:05 2005 +0000
@@ -181,7 +181,6 @@
   if (!sh_audio) return;
   sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio) -
                      sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
-  resync_audio_stream(sh_audio);
 }
 
 static void demux_close_mpc(demuxer_t* demuxer) {
--- a/libmpdemux/demux_mpg.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_mpg.c	Sun Oct 30 09:19:05 2005 +0000
@@ -669,7 +669,6 @@
   return 1;
 }
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
 extern void skip_audio_frame(sh_audio_t *sh_audio);
 
 void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags){
@@ -733,7 +732,6 @@
 	ds_fill_buffer(d_video);
 	if(sh_audio){
 	  ds_fill_buffer(d_audio);
-	  resync_audio_stream(sh_audio);
 	}
 
 	while(1){
--- a/libmpdemux/demux_ogg.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_ogg.c	Sun Oct 30 09:19:05 2005 +0000
@@ -1390,8 +1390,6 @@
 
 }
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
-
 static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
   ogg_demuxer_t* ogg_d = demuxer->priv;
   ogg_sync_state* sync = &ogg_d->sync;
@@ -1558,8 +1556,6 @@
         vo_osd_changed(OSDTYPE_SUBTITLE);
         clear_sub = -1;
 	demux_ogg_add_packet(ds,os,ds->id,&op);
-	if(sh_audio)
-	  resync_audio_stream(sh_audio); 
 	return;
       }
      }
--- a/libmpdemux/demux_rawaudio.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_rawaudio.c	Sun Oct 30 09:19:05 2005 +0000
@@ -30,8 +30,6 @@
 };
 
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
-
 static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) {
   sh_audio_t* sh_audio;
   WAVEFORMATEX* w;
@@ -95,7 +93,6 @@
   pos -= (pos % (sh_audio->channels * sh_audio->samplesize) );
   stream_seek(s,pos);
   sh_audio->delay= (pos-ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len) / (float)(sh_audio->wf->nAvgBytesPerSec);
-  resync_audio_stream(sh_audio);
 //  printf("demux_rawaudio: streamtell=%d\n",(int)stream_tell(demuxer->stream));
 }
 
--- a/libmpdemux/demux_real.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_real.c	Sun Oct 30 09:19:05 2005 +0000
@@ -1748,8 +1748,6 @@
     return;
 }
 
-extern void resync_audio_stream(sh_audio_t * sh_audio);
-
 /* please upload RV10 samples WITH INDEX CHUNK */
 static int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
 {
@@ -1840,8 +1838,6 @@
         stream_seek(demuxer->stream, next_offset);
 
     demux_real_fill_buffer(demuxer, NULL);
-    if (sh_audio)
-        resync_audio_stream(sh_audio);
     return 1;
 }
 
--- a/libmpdemux/demux_ts.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_ts.c	Sun Oct 30 09:19:05 2005 +0000
@@ -223,7 +223,6 @@
 #define IS_VIDEO(x) (((x) == VIDEO_MPEG1) || ((x) == VIDEO_MPEG2) || ((x) == VIDEO_MPEG4) || ((x) == VIDEO_H264) || ((x) == VIDEO_AVC))
 
 static int ts_parse(demuxer_t *demuxer, ES_stream_t *es, unsigned char *packet, int probe);
-extern void resync_audio_stream( sh_audio_t *sh_audio );
 
 static uint8_t get_packet_size(const unsigned char *buf, int size)
 {
@@ -2991,7 +2990,6 @@
 }
 
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
 extern void skip_audio_frame(sh_audio_t *sh_audio);
 
 static void reset_fifos(ts_priv_t* priv, int a, int v, int s)
@@ -3096,7 +3094,6 @@
 	if(sh_audio != NULL)
 	{
 		ds_fill_buffer(d_audio);
-		resync_audio_stream(sh_audio);
 	}
 
 	while(sh_video != NULL)
--- a/libmpdemux/demux_ty.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_ty.c	Sun Oct 30 09:19:05 2005 +0000
@@ -45,7 +45,6 @@
 #include "stheader.h"
 #include "../sub_cc.h"
 
-extern void resync_audio_stream( sh_audio_t *sh_audio );
 extern void skip_audio_frame( sh_audio_t *sh_audio );
 extern int sub_justify;
 
@@ -1313,7 +1312,6 @@
 	if( sh_audio )
    {
 	  ds_fill_buffer( d_audio );
-	  resync_audio_stream( sh_audio );
 	}
 
 	while( 1 )
--- a/libmpdemux/demux_vqf.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_vqf.c	Sun Oct 30 09:19:05 2005 +0000
@@ -9,8 +9,6 @@
 #include "stheader.h"
 #include "../libmpcodecs/vqf.h"
 
-extern void resync_audio_stream(sh_audio_t *sh_audio);
-
 static int demux_probe_vqf(demuxer_t* demuxer) 
 {
   char buf[KEYWORD_BYTES];
@@ -195,7 +193,6 @@
 
   pos -= (pos % (sh_audio->channels * sh_audio->samplesize) );
   stream_seek(s,pos);
-  resync_audio_stream(sh_audio);
 #endif
 }
 
--- a/libmpdemux/demux_xmms.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demux_xmms.c	Sun Oct 30 09:19:05 2005 +0000
@@ -199,8 +199,6 @@
 
 // ============================ mplayer demuxer stuff ===============
 
-//extern void resync_audio_stream(sh_audio_t *sh_audio);
-
 static int demux_xmms_open(demuxer_t* demuxer) {
   InputPlugin* ip = NULL;
   sh_audio_t* sh_audio;
--- a/libmpdemux/demuxer.c	Sun Oct 30 09:13:32 2005 +0000
+++ b/libmpdemux/demuxer.c	Sun Oct 30 09:19:05 2005 +0000
@@ -21,6 +21,7 @@
 #include "../libaf/af_format.h"
 #include "../libvo/fastmemcpy.h"
 
+extern void resync_audio_stream(sh_audio_t *sh_audio);
 
 // Demuxer list
 extern demuxer_desc_t demuxer_desc_rawaudio;
@@ -856,6 +857,8 @@
 if (demuxer->desc->seek)
     demuxer->desc->seek(demuxer,rel_seek_secs,flags);
 
+    if (sh_audio) resync_audio_stream(sh_audio);
+
 return 1;
 }