Reverse commit of unfinished patch for passing audio_delay to the demuxers.
authorcorey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>
Thu, 9 Feb 2006 19:39:51 +0000 (19:39 +0000)
committercorey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>
Thu, 9 Feb 2006 19:39:51 +0000 (19:39 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@17570 b3059339-0415-0410-9bf9-f77b7e298cf2

24 files changed:
libmpdemux/demux_asf.c
libmpdemux/demux_avi.c
libmpdemux/demux_avs.c
libmpdemux/demux_demuxers.c
libmpdemux/demux_film.c
libmpdemux/demux_fli.c
libmpdemux/demux_lavf.c
libmpdemux/demux_mf.c
libmpdemux/demux_mov.c
libmpdemux/demux_mpg.c
libmpdemux/demux_nsv.c
libmpdemux/demux_nuv.c
libmpdemux/demux_pva.c
libmpdemux/demux_rawdv.c
libmpdemux/demux_real.c
libmpdemux/demux_realaud.c
libmpdemux/demux_ts.c
libmpdemux/demux_ty.c
libmpdemux/demux_vqf.c
libmpdemux/demux_y4m.c
libmpdemux/demuxer.c
libmpdemux/demuxer.h
mencoder.c
mplayer.c

index dd8d1a9..a072b1c 100644 (file)
@@ -369,7 +369,7 @@ static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
 
 extern void skip_audio_frame(sh_audio_t *sh_audio);
 
-static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
     demux_stream_t *d_audio=demuxer->audio;
     demux_stream_t *d_video=demuxer->video;
     sh_audio_t *sh_audio=d_audio->sh;
index 21ab48d..6febdd1 100644 (file)
@@ -618,7 +618,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
 
 //extern float initial_pts_delay;
 
-void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
     avi_priv_t *priv=demuxer->priv;
     demux_stream_t *d_audio=demuxer->audio;
     demux_stream_t *d_video=demuxer->video;
@@ -706,8 +706,8 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int
            curr_audio_pos/=align;
            curr_audio_pos*=align;
 #else
-           /* immediate seeking to audio position, including when streams are delayed */
-           curr_audio_pos=(priv->avi_video_pts + audio_delay)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
+           curr_audio_pos=(priv->avi_video_pts)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
+           curr_audio_pos-=sh_audio->audio.dwStart;
            curr_audio_pos*=sh_audio->audio.dwSampleSize;
 #endif
 
@@ -733,8 +733,7 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int
              
        } else {
            // VBR audio
-           /* immediate seeking to audio position, including when streams are delayed */
-           int chunks=(priv->avi_video_pts + audio_delay)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
+           int chunks=(priv->avi_video_pts)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
            audio_chunk_pos=0;
            
         // find audio chunk pos:
index 7c8de70..bc3829d 100644 (file)
@@ -375,7 +375,7 @@ static void demux_close_avs(demuxer_t* demuxer)
     }
 }
 
-static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
+static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs,int flags)
 {
     demux_stream_t *d_video=demuxer->video;
     sh_video_t *sh_video=d_video->sh;
index 092be8d..a3e294a 100644 (file)
@@ -57,7 +57,7 @@ static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
   return 0;
 }
 
-static void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags) {
+static void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
   dd_priv_t* priv;
   float pos;
   priv=demuxer->priv;
@@ -66,13 +66,13 @@ static void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,float aud
   priv->sd->stream->eof = 0;
 
   // Seek video
-  demux_seek(priv->vd,rel_seek_secs,audio_delay,flags);
+  demux_seek(priv->vd,rel_seek_secs,flags);
   // Get the new pos
   pos = demuxer->video->pts;
 
   if(priv->ad != priv->vd) {
     sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh;
-    demux_seek(priv->ad,pos,audio_delay,1);
+    demux_seek(priv->ad,pos,1);
     // In case the demuxer don't set pts
     if(!demuxer->audio->pts)
       demuxer->audio->pts = pos-((ds_tell_pts(demuxer->audio)-sh->a_in_buffer_len)/(float)sh->i_bps);
@@ -80,7 +80,7 @@ static void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,float aud
   }
 
   if(priv->sd != priv->vd)
-      demux_seek(priv->sd,pos,audio_delay,1);
+      demux_seek(priv->sd,pos,1);
 
 }
 
index 04e5b95..a15a252 100644 (file)
@@ -46,7 +46,7 @@ typedef struct _film_data_t
   unsigned int film_version;
 } film_data_t;
 
-static void demux_seek_film(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
+static void demux_seek_film(demuxer_t *demuxer, float rel_seek_secs, int flags)
 {
   film_data_t *film_data = (film_data_t *)demuxer->priv;
   int new_current_chunk=(flags&1)?0:film_data->current_chunk;
index 6750a25..2b23835 100644 (file)
@@ -22,7 +22,7 @@ typedef struct _fli_frames_t {
   unsigned int *frame_size;
 } fli_frames_t;
 
-static void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+static void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,int flags){
   fli_frames_t *frames = (fli_frames_t *)demuxer->priv;
   sh_video_t *sh_video = demuxer->video->sh;
   int newpos=(flags&1)?0:frames->current_frame;
index e2aaa64..2ee83e7 100644 (file)
@@ -389,9 +389,9 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
     return 1;
 }
 
-static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags){
+static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, int flags){
     lavf_priv_t *priv = demuxer->priv;
-    mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags);
+    mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %d)\n", demuxer, rel_seek_secs, flags);
     
 #if LIBAVFORMAT_BUILD < 4619
     av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE);
index 771101f..5139640 100644 (file)
@@ -15,7 +15,7 @@
 #include "stheader.h"
 #include "mf.h"
 
-static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,int flags){
   mf_t * mf = (mf_t *)demuxer->priv;
   sh_video_t   * sh_video = demuxer->video->sh;
   int newpos = (flags & 1)?0:mf->curr_frame;
index 3537ce3..ae2b06a 100644 (file)
@@ -2007,7 +2007,7 @@ if(trak->samplesize){
 return pts;
 }
 
-static void demux_seek_mov(demuxer_t *demuxer,float pts,float audio_delay,int flags){
+static void demux_seek_mov(demuxer_t *demuxer,float pts,int flags){
     mov_priv_t* priv=demuxer->priv;
     demux_stream_t* ds;
     mov_track_t* trak;
index 647ece7..9b11dc8 100644 (file)
@@ -676,7 +676,7 @@ do{
 
 extern void skip_audio_frame(sh_audio_t *sh_audio);
 
-void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,float audio_delay, int flags){
+void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags){
     demux_stream_t *d_audio=demuxer->audio;
     demux_stream_t *d_video=demuxer->video;
     sh_audio_t *sh_audio=d_audio->sh;
index 94a0e3f..9294259 100644 (file)
@@ -34,7 +34,7 @@ typedef struct {
 /**
  * Seeking still to be implemented
  */
-static void demux_seek_nsv ( demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags )
+static void demux_seek_nsv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
 {
 // seeking is not yet implemented
 }
index 4263c0e..a09ad71 100644 (file)
@@ -63,7 +63,7 @@ static int nearestBitrate(int bitrate) {
 /**
  * Seek to a position relative to the current position, indicated in time.
  */
-static void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags )
+static void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, int flags )
 {
 #define MAX_TIME 1000000
        nuv_priv_t* priv = demuxer->priv;
index 419536d..0ad8faf 100644 (file)
@@ -466,7 +466,7 @@ int pva_get_payload(demuxer_t * d,pva_payload_t * payload)
        return 1;
 }
 
-static void demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,float audio_delay,int flags)
+static void demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,int flags)
 {
        int total_bitrate=0;
        off_t dest_offset;
index 8163a34..1d4886f 100644 (file)
@@ -36,7 +36,7 @@ typedef struct
    dv_decoder_t *decoder;
 } rawdv_frames_t;
 
-static void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags)
+static void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,int flags)
 {
    rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
    sh_video_t *sh_video = demuxer->video->sh;
index 2f7e9bc..a4acc6f 100644 (file)
@@ -1825,7 +1825,7 @@ static void demux_close_real(demuxer_t *demuxer)
 }
 
 /* please upload RV10 samples WITH INDEX CHUNK */
-static void demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
+static void demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
 {
     real_priv_t *priv = demuxer->priv;
     demux_stream_t *d_audio = demuxer->audio;
index 1346e34..2d4a167 100644 (file)
@@ -341,7 +341,7 @@ static void demux_close_ra(demuxer_t *demuxer)
 
 #if 0
 /* please upload RV10 samples WITH INDEX CHUNK */
-int demux_seek_ra(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
+int demux_seek_ra(demuxer_t *demuxer, float rel_seek_secs, int flags)
 {
     real_priv_t *priv = demuxer->priv;
     demux_stream_t *d_audio = demuxer->audio;
index be3adfc..9e73c01 100644 (file)
@@ -3071,7 +3071,7 @@ extern int videobuf_code_len;
 extern int sync_video_packet(demux_stream_t *);
 extern int skip_video_packet(demux_stream_t *);
 
-static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
+static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, int flags)
 {
        demux_stream_t *d_audio=demuxer->audio;
        demux_stream_t *d_video=demuxer->video;
index d5a0738..385ccbb 100644 (file)
@@ -1237,7 +1237,7 @@ static int demux_ty_fill_buffer( demuxer_t *demux, demux_stream_t *dsds )
    return( 1 );
 }
 
-static void demux_seek_ty( demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags )
+static void demux_seek_ty( demuxer_t *demuxer, float rel_seek_secs, int flags )
 {
    demux_stream_t *d_audio = demuxer->audio;
    demux_stream_t *d_video = demuxer->video;
index 6ce7082..092b0d6 100644 (file)
@@ -179,7 +179,7 @@ static int demux_vqf_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
   return 1;
 }
 
-static void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+static void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,int flags){
 #if 0
   stream_t* s = demuxer->stream;
   sh_audio_t* sh_audio = demuxer->audio->sh;
index 58a8afc..2fe784b 100644 (file)
@@ -231,7 +231,7 @@ static demuxer_t* demux_open_y4m(demuxer_t* demuxer){
     return demuxer;
 }
 
-static void demux_seek_y4m(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags) {
+static void demux_seek_y4m(demuxer_t *demuxer, float rel_seek_secs, int flags) {
     sh_video_t* sh = demuxer->video->sh;
     y4m_priv_t* priv = demuxer->priv;
     int rel_seek_frames = sh->fps*rel_seek_secs;
index 181a16d..8ff2fc7 100644 (file)
@@ -859,7 +859,7 @@ demuxer_t* demux_open(stream_t *vs,int file_format,int audio_id,int video_id,int
 }
 
 
-int demux_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
     demux_stream_t *d_audio=demuxer->audio;
     demux_stream_t *d_video=demuxer->video;
     sh_audio_t *sh_audio=d_audio->sh;
index 51f0b4c..e184280 100644 (file)
@@ -300,7 +300,7 @@ static inline int avi_stream_id(unsigned int id){
 }
 
 demuxer_t* demux_open(stream_t *stream,int file_format,int aid,int vid,int sid,char* filename);
-int demux_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags);
+int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags);
 demuxer_t*  new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd);
 
 // AVI demuxer params:
index bd27465..034bf03 100644 (file)
@@ -1036,12 +1036,12 @@ if (seek_to_sec) {
     else 
         sscanf(seek_to_sec, "%f", &d);
 
-    demux_seek(demuxer, d, audio_delay, 1);
+    demux_seek(demuxer, d, 1);
 //  there is 2 way to handle the -ss option in 3-pass mode:
 // > 1. do the first pass for the whole file, and use -ss for 2nd/3rd pases only
 // > 2. do all the 3 passes with the same -ss value
 //  this line enables behaviour 1. (and kills 2. at the same time):
-//    if(demuxer2) demux_seek(demuxer2, d, audio_delay, 1);
+//    if(demuxer2) demux_seek(demuxer2, d, 1);
 }
 
 if (out_file_format == MUXER_TYPE_MPEG)
@@ -1769,7 +1769,7 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st
     if (sh_video->pts >= next_edl_record->stop_sec) return 1; // nothing to do...
 
     if (!edl_seek_type) {
-        if(demux_seek(demuxer, next_edl_record->stop_sec - sh_video->pts, audio_delay, 0)){
+        if(demux_seek(demuxer, next_edl_record->stop_sec - sh_video->pts, 0)){
             sh_video->pts = demuxer->video->pts;
             //if (vo_vobsub) vobsub_seek(vo_vobsub,sh_video->pts);
             resync_video_stream(sh_video);
index a0ecc2f..77129c0 100644 (file)
--- a/mplayer.c
+++ b/mplayer.c
@@ -4185,7 +4185,7 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
 
 if(rel_seek_secs || abs_seek_pos){
   current_module="seek";
-  if(demux_seek(demuxer,rel_seek_secs,audio_delay,abs_seek_pos)){
+  if(demux_seek(demuxer,rel_seek_secs,abs_seek_pos)){
       // success:
       /* FIXME there should be real seeking for vobsub */
       if(sh_video) sh_video->pts=d_video->pts;