changeset 13357:c605df89ca9f

moved sh_audio initialization from dec_audio to demuxer.c to fix -hr-mp3-seek bug (pts was -inf after seeking) and remove the workaround from demux_audio.c.
author reimar
date Thu, 16 Sep 2004 19:51:13 +0000
parents f5fc90320aef
children 567875b88aab
files libmpcodecs/dec_audio.c libmpdemux/demux_audio.c libmpdemux/demuxer.c
diffstat 3 files changed, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_audio.c	Thu Sep 16 19:42:54 2004 +0000
+++ b/libmpcodecs/dec_audio.c	Thu Sep 16 19:51:13 2004 +0000
@@ -49,25 +49,6 @@
 
 int init_audio_codec(sh_audio_t *sh_audio)
 {
-
-  // reset in/out buffer size/pointer:
-  sh_audio->a_buffer_size=0;
-  sh_audio->a_buffer=NULL;
-  sh_audio->a_in_buffer_size=0;
-  sh_audio->a_in_buffer=NULL;
-
-  // Set up some common usefull defaults. ad->preinit() can override these:
-  
-  sh_audio->samplesize=2;
-  sh_audio->sample_format=AFMT_S16_NE;
-  sh_audio->samplerate=0;
-  sh_audio->channels=0;
-  sh_audio->i_bps=0;  // input rate (bytes/sec)
-  sh_audio->o_bps=0;  // output rate (bytes/sec)
-
-  sh_audio->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/
-  sh_audio->audio_in_minsize=0;
-  
   if(!mpadec->preinit(sh_audio))
   {
       mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ADecoderPreinitFailed);
--- a/libmpdemux/demux_audio.c	Thu Sep 16 19:42:54 2004 +0000
+++ b/libmpdemux/demux_audio.c	Thu Sep 16 19:51:13 2004 +0000
@@ -373,7 +373,6 @@
   priv = demuxer->priv;
 
   if(priv->frmt == MP3 && hr_mp3_seek && !(flags & 2)) {
-    if(isinf(priv->last_pts)) priv->last_pts=0;
     len = (flags & 1) ? rel_seek_secs - priv->last_pts : rel_seek_secs;
     if(len < 0) {
       stream_seek(s,demuxer->movi_start);
--- a/libmpdemux/demuxer.c	Thu Sep 16 19:42:54 2004 +0000
+++ b/libmpdemux/demuxer.c	Thu Sep 16 19:51:13 2004 +0000
@@ -18,6 +18,7 @@
 #include "stheader.h"
 #include "mf.h"
 
+#include "../libao2/afmt.h"
 #include "../libvo/fastmemcpy.h"
 
 void free_demuxer_stream(demux_stream_t *ds){
@@ -79,9 +80,15 @@
     if(demuxer->a_streams[id]){
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id);
     } else {
+        sh_audio_t *sh;
         mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundAudioStream,id);
         demuxer->a_streams[id]=malloc(sizeof(sh_audio_t));
         memset(demuxer->a_streams[id],0,sizeof(sh_audio_t));
+        sh = demuxer->a_streams[id];
+        // set some defaults
+        sh->samplesize=2;
+        sh->sample_format=AFMT_S16_NE;
+        sh->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/
     }
     return demuxer->a_streams[id];
 }