FFmpegSource2: audio indexing bug

Originally committed to SVN as r2385.
This commit is contained in:
Fredrik Mellbin 2008-09-23 23:08:07 +00:00
parent 950c88cf77
commit 403fc0dd38
2 changed files with 9 additions and 2 deletions

View file

@ -242,6 +242,10 @@ static FrameIndex *MakeMatroskaIndex(const char *SourceFile, int IndexMask, int
Size -= Ret;
Data += Ret;
}
if (dbsize > 0)
AudioContexts[Track].CurrentSample += (dbsize * 8) / (av_get_bits_per_sample_format(AudioCodecContext->sample_fmt) * AudioCodecContext->channels);
if (dbsize > 0 && (DumpMask & (1 << Track))) {
// Delay writer creation until after an audio frame has been decoded. This ensures that all parameters are known when writing the headers.
if (!AudioContexts[Track].W64W) {
@ -255,7 +259,6 @@ static FrameIndex *MakeMatroskaIndex(const char *SourceFile, int IndexMask, int
AudioCodecContext->channels, AudioCodecContext->sample_rate, AudioFMTIsFloat(AudioCodecContext->sample_fmt));
}
AudioContexts[Track].CurrentSample += (dbsize * 8) / (av_get_bits_per_sample_format(AudioCodecContext->sample_fmt) * AudioCodecContext->channels);
AudioContexts[Track].W64W->WriteData(db, dbsize);
}
}
@ -357,6 +360,10 @@ FrameIndex *MakeIndex(const char *SourceFile, int IndexMask, int DumpMask, const
Data += Ret;
}
// FIXME currentsample calculation here
if (dbsize > 0)
dbsize = dbsize;
if (dbsize > 0 && (DumpMask & (1 << Packet.stream_index))) {
// Delay writer creation until after an audio frame has been decoded. This ensures that all parameters are known when writing the headers.
if (!AudioContexts[Packet.stream_index].W64W) {

View file

@ -33,7 +33,7 @@ extern "C" {
#include "utils.h"
#include "ffms.h"
#define INDEXVERSION 6
#define INDEXVERSION 7
#define INDEXID 0x53920873
struct IndexHeader {