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.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13358 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2004-09-16 19:51:13 +00:00
parent 378ded9169
commit 6068c1846e
3 changed files with 7 additions and 20 deletions

View File

@ -49,25 +49,6 @@ void afm_help(){
int init_audio_codec(sh_audio_t *sh_audio) 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)) if(!mpadec->preinit(sh_audio))
{ {
mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ADecoderPreinitFailed); mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ADecoderPreinitFailed);

View File

@ -373,7 +373,6 @@ void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
priv = demuxer->priv; priv = demuxer->priv;
if(priv->frmt == MP3 && hr_mp3_seek && !(flags & 2)) { 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; len = (flags & 1) ? rel_seek_secs - priv->last_pts : rel_seek_secs;
if(len < 0) { if(len < 0) {
stream_seek(s,demuxer->movi_start); stream_seek(s,demuxer->movi_start);

View File

@ -18,6 +18,7 @@
#include "stheader.h" #include "stheader.h"
#include "mf.h" #include "mf.h"
#include "../libao2/afmt.h"
#include "../libvo/fastmemcpy.h" #include "../libvo/fastmemcpy.h"
void free_demuxer_stream(demux_stream_t *ds){ void free_demuxer_stream(demux_stream_t *ds){
@ -79,9 +80,15 @@ sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
if(demuxer->a_streams[id]){ if(demuxer->a_streams[id]){
mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id); mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id);
} else { } else {
sh_audio_t *sh;
mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundAudioStream,id); mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_FoundAudioStream,id);
demuxer->a_streams[id]=malloc(sizeof(sh_audio_t)); demuxer->a_streams[id]=malloc(sizeof(sh_audio_t));
memset(demuxer->a_streams[id],0,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]; return demuxer->a_streams[id];
} }