diff options
author | Benjamin Otte <otte@gnome.org> | 2008-12-16 13:08:55 +0100 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2008-12-16 13:08:55 +0100 |
commit | c60581f4c20fe566e147e769775551f74a8d251a (patch) | |
tree | a18f4d5b29bf86c0e23104170610ab25982420f8 | |
parent | 8132dc877d46c74c132ad1703ff2df35ee7b6f3e (diff) |
add a hack that makes codec setup data survive seeks
-rw-r--r-- | swfdec/swfdec_audio_flv.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/swfdec/swfdec_audio_flv.c b/swfdec/swfdec_audio_flv.c index d3f8dbb1..4595f074 100644 --- a/swfdec/swfdec_audio_flv.c +++ b/swfdec/swfdec_audio_flv.c @@ -95,6 +95,18 @@ swfdec_audio_flv_decode_one (SwfdecAudioFlv *flv) flv->decoder = swfdec_audio_decoder_new (flv->format, flv->in); if (flv->decoder == NULL) return NULL; + /* This is a hack that ensures AAC codec data is always present, even if + * the decoder gets initialized in the middle of the stream */ + if (format == SWFDEC_AUDIO_CODEC_AAC) { + SwfdecBuffer *tmp = swfdec_flv_decoder_get_audio (flv->flvdecoder, + 0, &format, NULL, NULL, NULL); + if (format == SWFDEC_AUDIO_CODEC_AAC && tmp->data[0] == 0 && + tmp->length > 1) { + tmp = swfdec_buffer_new_subbuffer (tmp, 1, tmp->length - 1); + swfdec_audio_decoder_set_codec_data (flv->decoder, tmp); + swfdec_buffer_unref (tmp); + } + } } else if (format != flv->format || in != flv->in) { SWFDEC_ERROR ("FIXME: format change not implemented"); |