summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-23 20:50:11 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-23 20:50:11 +0300
commitf9d224b1ad2f5488fe0fd1f581c4506a6067aa5a (patch)
tree7292b4023297321c61c7d1b0cfdd92606dd1ae53
parente3bd668ebd5f669e5f7d109191c87c678b569bb7 (diff)
downloadmpv-f9d224b1ad2f5488fe0fd1f581c4506a6067aa5a.tar.bz2
mpv-f9d224b1ad2f5488fe0fd1f581c4506a6067aa5a.tar.xz
Move some sh_audio field setting out of demuxer.c
These fields are decoder details, not information set by the demuxer.
-rw-r--r--libmpcodecs/dec_audio.c5
-rw-r--r--libmpdemux/demuxer.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c
index 60899241ea..1a06b85921 100644
--- a/libmpcodecs/dec_audio.c
+++ b/libmpcodecs/dec_audio.c
@@ -69,6 +69,8 @@ void afm_help(void)
static int init_audio_codec(sh_audio_t *sh_audio)
{
+ assert(!sh_audio->initialized);
+ resync_audio_stream(sh_audio);
if ((af_cfg.force & AF_INIT_FORMAT_MASK) == AF_INIT_FLOAT) {
int fmt = AF_FORMAT_FLOAT_NE;
if (sh_audio->ad_driver->control(sh_audio, ADCTRL_QUERY_FORMAT,
@@ -77,6 +79,7 @@ static int init_audio_codec(sh_audio_t *sh_audio)
sh_audio->samplesize = 4;
}
}
+ sh_audio->audio_out_minsize = 8192; // default, preinit() may change it
if (!sh_audio->ad_driver->preinit(sh_audio)) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "ADecoder preinit failed :(\n");
return 0;
@@ -88,7 +91,6 @@ static int init_audio_codec(sh_audio_t *sh_audio)
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "dec_audio: Allocating %d bytes for input buffer.\n",
sh_audio->a_in_buffer_size);
sh_audio->a_in_buffer = av_mallocz(sh_audio->a_in_buffer_size);
- sh_audio->a_in_buffer_len = 0;
}
const int base_size = 65536;
@@ -474,6 +476,7 @@ int decode_audio(sh_audio_t *sh_audio, int minlen)
void resync_audio_stream(sh_audio_t *sh_audio)
{
sh_audio->a_in_buffer_len = 0; // clear audio input buffer
+ sh_audio->pts = MP_NOPTS_VALUE;
if (!sh_audio->initialized)
return;
sh_audio->ad_driver->control(sh_audio, ADCTRL_RESYNC_STREAM, NULL);
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 3838a5ea84..0dafe16139 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -306,8 +306,6 @@ sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid)
// set some defaults
sh->samplesize = 2;
sh->sample_format = AF_FORMAT_S16_NE;
- sh->audio_out_minsize = 8192; /* default size, maybe not enough for Win32/ACM */
- sh->pts = MP_NOPTS_VALUE;
sh->opts = demuxer->opts;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", aid);
}