Update ffms2 to r234, part 1. Compilation broken in this commit.

Originally committed to SVN as r3814.
This commit is contained in:
Karl Blomster 2009-11-21 21:11:41 +00:00
parent 3e52c7a592
commit 1f4fa82726
10 changed files with 66 additions and 66 deletions

View file

@ -46,18 +46,18 @@
# define FFMS_API(ret) EXTERN_C ret FFMS_CC # define FFMS_API(ret) EXTERN_C ret FFMS_CC
#endif #endif
struct FFMS_ErrorInfo { typedef struct {
int ErrorType; int ErrorType;
int SubType; int SubType;
int BufferSize; int BufferSize;
char *Buffer; char *Buffer;
}; } FFMS_ErrorInfo;
FFMS_CLASS_TYPE FFMS_VideoSource; typedef FFMS_CLASS_TYPE FFMS_VideoSource FFMS_VideoSource;
FFMS_CLASS_TYPE FFMS_AudioSource; typedef FFMS_CLASS_TYPE FFMS_AudioSource FFMS_AudioSource;
FFMS_CLASS_TYPE FFMS_Indexer; typedef FFMS_CLASS_TYPE FFMS_Indexer FFMS_Indexer;
FFMS_CLASS_TYPE FFMS_Index; typedef FFMS_CLASS_TYPE FFMS_Index FFMS_Index;
FFMS_CLASS_TYPE FFMS_Track; typedef FFMS_CLASS_TYPE FFMS_Track FFMS_Track;
enum FFMS_Errors { enum FFMS_Errors {
// No error // No error
@ -174,7 +174,7 @@ enum FFMS_Resizers {
FFMS_RESIZER_SPLINE = 0x0400 FFMS_RESIZER_SPLINE = 0x0400
}; };
struct FFMS_Frame { typedef struct {
uint8_t *Data[4]; uint8_t *Data[4];
int Linesize[4]; int Linesize[4];
int EncodedWidth; int EncodedWidth;
@ -188,20 +188,20 @@ struct FFMS_Frame {
int InterlacedFrame; int InterlacedFrame;
int TopFieldFirst; int TopFieldFirst;
char PictType; char PictType;
}; } FFMS_Frame;
struct FFMS_TrackTimeBase { typedef struct {
int64_t Num; int64_t Num;
int64_t Den; int64_t Den;
}; } FFMS_TrackTimeBase;
#define FFMS_FRAMEINFO_COMMON int64_t DTS; int RepeatPict; int KeyFrame; #define FFMS_FRAMEINFO_COMMON int64_t PTS; int RepeatPict; int KeyFrame;
struct FFMS_FrameInfo { typedef struct {
FFMS_FRAMEINFO_COMMON FFMS_FRAMEINFO_COMMON
}; } FFMS_FrameInfo;
struct FFMS_VideoProperties { typedef struct {
int FPSDenominator; int FPSDenominator;
int FPSNumerator; int FPSNumerator;
int RFFDenominator; int RFFDenominator;
@ -218,9 +218,9 @@ struct FFMS_VideoProperties {
int ColorRange; // 0=unspecified, 1=16-235, 2=0-255 int ColorRange; // 0=unspecified, 1=16-235, 2=0-255
double FirstTime; double FirstTime;
double LastTime; double LastTime;
}; } FFMS_VideoProperties;
struct FFMS_AudioProperties { typedef struct {
int SampleFormat; int SampleFormat;
int SampleRate; int SampleRate;
int BitsPerSample; int BitsPerSample;
@ -229,7 +229,7 @@ struct FFMS_AudioProperties {
int64_t NumSamples; int64_t NumSamples;
double FirstTime; double FirstTime;
double LastTime; double LastTime;
}; } FFMS_AudioProperties;
typedef int (FFMS_CC *TIndexCallback)(int64_t Current, int64_t Total, void *ICPrivate); typedef int (FFMS_CC *TIndexCallback)(int64_t Current, int64_t Total, void *ICPrivate);
typedef int (FFMS_CC *TAudioNameCallback)(const char *SourceFile, int Track, const FFMS_AudioProperties *AP, char *FileName, int FNSize, void *Private); typedef int (FFMS_CC *TAudioNameCallback)(const char *SourceFile, int Track, const FFMS_AudioProperties *AP, char *FileName, int FNSize, void *Private);

View file

@ -97,8 +97,8 @@ SharedAudioContext::~SharedAudioContext() {
TFrameInfo::TFrameInfo() { TFrameInfo::TFrameInfo() {
} }
TFrameInfo::TFrameInfo(int64_t DTS, int64_t SampleStart, unsigned int SampleCount, int RepeatPict, bool KeyFrame, int64_t FilePos, unsigned int FrameSize) { TFrameInfo::TFrameInfo(int64_t PTS, int64_t SampleStart, unsigned int SampleCount, int RepeatPict, bool KeyFrame, int64_t FilePos, unsigned int FrameSize) {
this->DTS = DTS; this->PTS = PTS;
this->RepeatPict = RepeatPict; this->RepeatPict = RepeatPict;
this->KeyFrame = KeyFrame; this->KeyFrame = KeyFrame;
this->SampleStart = SampleStart; this->SampleStart = SampleStart;
@ -108,12 +108,12 @@ TFrameInfo::TFrameInfo(int64_t DTS, int64_t SampleStart, unsigned int SampleCoun
this->OriginalPos = 0; this->OriginalPos = 0;
} }
TFrameInfo TFrameInfo::VideoFrameInfo(int64_t DTS, int RepeatPict, bool KeyFrame, int64_t FilePos, unsigned int FrameSize) { TFrameInfo TFrameInfo::VideoFrameInfo(int64_t PTS, int RepeatPict, bool KeyFrame, int64_t FilePos, unsigned int FrameSize) {
return TFrameInfo(DTS, 0, 0, RepeatPict, KeyFrame, FilePos, FrameSize); return TFrameInfo(PTS, 0, 0, RepeatPict, KeyFrame, FilePos, FrameSize);
} }
TFrameInfo TFrameInfo::AudioFrameInfo(int64_t DTS, int64_t SampleStart, unsigned int SampleCount, bool KeyFrame, int64_t FilePos, unsigned int FrameSize) { TFrameInfo TFrameInfo::AudioFrameInfo(int64_t PTS, int64_t SampleStart, unsigned int SampleCount, bool KeyFrame, int64_t FilePos, unsigned int FrameSize) {
return TFrameInfo(DTS, SampleStart, SampleCount, 0, KeyFrame, FilePos, FrameSize); return TFrameInfo(PTS, SampleStart, SampleCount, 0, KeyFrame, FilePos, FrameSize);
} }
void FFMS_Track::WriteTimecodes(const char *TimecodeFile) { void FFMS_Track::WriteTimecodes(const char *TimecodeFile) {
@ -128,21 +128,21 @@ void FFMS_Track::WriteTimecodes(const char *TimecodeFile) {
Timecodes << "# timecode format v2\n"; Timecodes << "# timecode format v2\n";
for (iterator Cur=begin(); Cur!=end(); Cur++) for (iterator Cur=begin(); Cur!=end(); Cur++)
Timecodes << std::fixed << ((Cur->DTS * TB.Num) / (double)TB.Den) << "\n"; Timecodes << std::fixed << ((Cur->PTS * TB.Num) / (double)TB.Den) << "\n";
} }
int FFMS_Track::FrameFromDTS(int64_t DTS) { int FFMS_Track::FrameFromPTS(int64_t PTS) {
for (int i = 0; i < static_cast<int>(size()); i++) for (int i = 0; i < static_cast<int>(size()); i++)
if (at(i).DTS == DTS) if (at(i).PTS == PTS)
return i; return i;
return -1; return -1;
} }
int FFMS_Track::ClosestFrameFromDTS(int64_t DTS) { int FFMS_Track::ClosestFrameFromPTS(int64_t PTS) {
int Frame = 0; int Frame = 0;
int64_t BestDiff = 0xFFFFFFFFFFFFFFLL; // big number int64_t BestDiff = 0xFFFFFFFFFFFFFFLL; // big number
for (int i = 0; i < static_cast<int>(size()); i++) { for (int i = 0; i < static_cast<int>(size()); i++) {
int64_t CurrentDiff = FFABS(at(i).DTS - DTS); int64_t CurrentDiff = FFABS(at(i).PTS - PTS);
if (CurrentDiff < BestDiff) { if (CurrentDiff < BestDiff) {
BestDiff = CurrentDiff; BestDiff = CurrentDiff;
Frame = i; Frame = i;
@ -234,8 +234,8 @@ void FFMS_Index::CalculateFileSignature(const char *Filename, int64_t *Filesize,
av_sha1_final(ctx, Digest); av_sha1_final(ctx, Digest);
} }
static bool DTSComparison(TFrameInfo FI1, TFrameInfo FI2) { static bool PTSComparison(TFrameInfo FI1, TFrameInfo FI2) {
return FI1.DTS < FI2.DTS; return FI1.PTS < FI2.PTS;
} }
void FFMS_Index::Sort() { void FFMS_Index::Sort() {
@ -244,7 +244,7 @@ void FFMS_Index::Sort() {
for (size_t i = 0; i < Cur->size(); i++) for (size_t i = 0; i < Cur->size(); i++)
Cur->at(i).OriginalPos = i; Cur->at(i).OriginalPos = i;
std::sort(Cur->begin(), Cur->end(), DTSComparison); std::sort(Cur->begin(), Cur->end(), PTSComparison);
std::vector<size_t> ReorderTemp; std::vector<size_t> ReorderTemp;
ReorderTemp.resize(Cur->size()); ReorderTemp.resize(Cur->size());

View file

@ -74,10 +74,10 @@ public:
size_t OriginalPos; size_t OriginalPos;
TFrameInfo(); TFrameInfo();
static TFrameInfo VideoFrameInfo(int64_t DTS, int RepeatPict, bool KeyFrame, int64_t FilePos = 0, unsigned int FrameSize = 0); static TFrameInfo VideoFrameInfo(int64_t PTS, int RepeatPict, bool KeyFrame, int64_t FilePos = 0, unsigned int FrameSize = 0);
static TFrameInfo AudioFrameInfo(int64_t DTS, int64_t SampleStart, unsigned int SampleCount, bool KeyFrame, int64_t FilePos = 0, unsigned int FrameSize = 0); static TFrameInfo AudioFrameInfo(int64_t PTS, int64_t SampleStart, unsigned int SampleCount, bool KeyFrame, int64_t FilePos = 0, unsigned int FrameSize = 0);
private: private:
TFrameInfo(int64_t DTS, int64_t SampleStart, unsigned int SampleCount, int RepeatPict, bool KeyFrame, int64_t FilePos, unsigned int FrameSize); TFrameInfo(int64_t PTS, int64_t SampleStart, unsigned int SampleCount, int RepeatPict, bool KeyFrame, int64_t FilePos, unsigned int FrameSize);
}; };
class FFMS_Track : public std::vector<TFrameInfo> { class FFMS_Track : public std::vector<TFrameInfo> {
@ -87,8 +87,8 @@ public:
int FindClosestVideoKeyFrame(int Frame); int FindClosestVideoKeyFrame(int Frame);
int FindClosestAudioKeyFrame(int64_t Sample); int FindClosestAudioKeyFrame(int64_t Sample);
int FrameFromDTS(int64_t DTS); int FrameFromPTS(int64_t PTS);
int ClosestFrameFromDTS(int64_t DTS); int ClosestFrameFromPTS(int64_t PTS);
void WriteTimecodes(const char *TimecodeFile); void WriteTimecodes(const char *TimecodeFile);
FFMS_Track(); FFMS_Track();

View file

@ -55,8 +55,8 @@ FFLAVFAudio::FFLAVFAudio(const char *SourceFile, int Track, FFMS_Index *Index)
int64_t Dummy; int64_t Dummy;
DecodeNextAudioBlock(&Dummy); DecodeNextAudioBlock(&Dummy);
if (av_seek_frame(FormatContext, AudioTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD) < 0) if (av_seek_frame(FormatContext, AudioTrack, Frames[0].PTS, AVSEEK_FLAG_BACKWARD) < 0)
av_seek_frame(FormatContext, AudioTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY); av_seek_frame(FormatContext, AudioTrack, Frames[0].PTS, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY);
avcodec_flush_buffers(CodecContext); avcodec_flush_buffers(CodecContext);
FillAP(AP, CodecContext, Frames); FillAP(AP, CodecContext, Frames);
@ -116,7 +116,7 @@ void FFLAVFAudio::GetAudio(void *Buf, int64_t Start, int64_t Count) {
const int64_t SizeConst = (av_get_bits_per_sample_format(CodecContext->sample_fmt) * CodecContext->channels) / 8; const int64_t SizeConst = (av_get_bits_per_sample_format(CodecContext->sample_fmt) * CodecContext->channels) / 8;
memset(Buf, 0, static_cast<size_t>(SizeConst * Count)); memset(Buf, 0, static_cast<size_t>(SizeConst * Count));
int PreDecBlocks = 0; unsigned int PreDecBlocks = 0;
uint8_t *DstBuf = static_cast<uint8_t *>(Buf); uint8_t *DstBuf = static_cast<uint8_t *>(Buf);
// Fill with everything in the cache // Fill with everything in the cache
@ -136,8 +136,8 @@ void FFLAVFAudio::GetAudio(void *Buf, int64_t Start, int64_t Count) {
} }
// Did the seeking fail? // Did the seeking fail?
if (av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].DTS, AVSEEK_FLAG_BACKWARD) < 0) if (av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].PTS, AVSEEK_FLAG_BACKWARD) < 0)
av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].DTS, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY); av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].PTS, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY);
avcodec_flush_buffers(CodecContext); avcodec_flush_buffers(CodecContext);
@ -147,15 +147,15 @@ void FFLAVFAudio::GetAudio(void *Buf, int64_t Start, int64_t Count) {
InitNullPacket(Packet); InitNullPacket(Packet);
// Establish where we actually are // Establish where we actually are
// Trigger on packet dts difference since groups can otherwise be indistinguishable // Trigger on packet PTS difference since groups can otherwise be indistinguishable
int64_t LastDTS = - 1; int64_t LastPTS = - 1;
while (av_read_frame(FormatContext, &Packet) >= 0) { while (av_read_frame(FormatContext, &Packet) >= 0) {
if (Packet.stream_index == AudioTrack) { if (Packet.stream_index == AudioTrack) {
if (LastDTS < 0) { if (LastPTS < 0) {
LastDTS = Packet.dts; LastPTS = Packet.dts;
} else if (LastDTS != Packet.dts) { } else if (LastPTS != Packet.dts) {
for (size_t i = 0; i < Frames.size(); i++) for (size_t i = 0; i < Frames.size(); i++)
if (Frames[i].DTS == Packet.dts) { if (Frames[i].PTS == Packet.dts) {
// The current match was consumed // The current match was consumed
CurrentAudioBlock = i + 1; CurrentAudioBlock = i + 1;
break; break;

View file

@ -40,7 +40,7 @@ FFLAVFVideo::FFLAVFVideo(const char *SourceFile, int Track, FFMS_Index *Index,
LAVFOpenFile(SourceFile, FormatContext); LAVFOpenFile(SourceFile, FormatContext);
if (SeekMode >= 0 && av_seek_frame(FormatContext, VideoTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD) < 0) if (SeekMode >= 0 && av_seek_frame(FormatContext, VideoTrack, Frames[0].PTS, AVSEEK_FLAG_BACKWARD) < 0)
throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC, throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC,
"Video track is unseekable"); "Video track is unseekable");
@ -76,8 +76,8 @@ FFLAVFVideo::FFLAVFVideo(const char *SourceFile, int Track, FFMS_Index *Index,
VP.ColorSpace = 0; VP.ColorSpace = 0;
VP.ColorRange = 0; VP.ColorRange = 0;
#endif #endif
VP.FirstTime = ((Frames.front().DTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; VP.FirstTime = ((Frames.front().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
VP.LastTime = ((Frames.back().DTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; VP.LastTime = ((Frames.back().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
if (CodecContext->width <= 0 || CodecContext->height <= 0) if (CodecContext->width <= 0 || CodecContext->height <= 0)
throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC, throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC,
@ -91,8 +91,8 @@ FFLAVFVideo::FFLAVFVideo(const char *SourceFile, int Track, FFMS_Index *Index,
// Adjust framerate to match the duration of the first frame // Adjust framerate to match the duration of the first frame
if (Frames.size() >= 2) { if (Frames.size() >= 2) {
unsigned int DTSDiff = (unsigned int)FFMAX(Frames[1].DTS - Frames[0].DTS, 1); unsigned int PTSDiff = (unsigned int)FFMAX(Frames[1].PTS - Frames[0].PTS, 1);
VP.FPSDenominator *= DTSDiff; VP.FPSDenominator *= PTSDiff;
} }
// Cannot "output" to PPFrame without doing all other initialization // Cannot "output" to PPFrame without doing all other initialization
@ -158,7 +158,7 @@ FFMS_Frame *FFLAVFVideo::GetFrame(int n) {
if (SeekMode == 0) { if (SeekMode == 0) {
if (n < CurrentFrame) { if (n < CurrentFrame) {
av_seek_frame(FormatContext, VideoTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD); av_seek_frame(FormatContext, VideoTrack, Frames[0].PTS, AVSEEK_FLAG_BACKWARD);
avcodec_flush_buffers(CodecContext); avcodec_flush_buffers(CodecContext);
CurrentFrame = 0; CurrentFrame = 0;
} }
@ -167,7 +167,7 @@ FFMS_Frame *FFLAVFVideo::GetFrame(int n) {
if (n < CurrentFrame || ClosestKF > CurrentFrame + 10 || (SeekMode == 3 && n > CurrentFrame + 10)) { if (n < CurrentFrame || ClosestKF > CurrentFrame + 10 || (SeekMode == 3 && n > CurrentFrame + 10)) {
ReSeek: ReSeek:
av_seek_frame(FormatContext, VideoTrack, av_seek_frame(FormatContext, VideoTrack,
(SeekMode == 3) ? Frames[n].DTS : Frames[ClosestKF + SeekOffset].DTS, (SeekMode == 3) ? Frames[n].PTS : Frames[ClosestKF + SeekOffset].PTS,
AVSEEK_FLAG_BACKWARD); AVSEEK_FLAG_BACKWARD);
avcodec_flush_buffers(CodecContext); avcodec_flush_buffers(CodecContext);
HasSeeked = true; HasSeeked = true;
@ -186,7 +186,7 @@ ReSeek:
HasSeeked = false; HasSeeked = false;
// Is the seek destination time known? Does it belong to a frame? // Is the seek destination time known? Does it belong to a frame?
if (StartTime < 0 || (CurrentFrame = Frames.FrameFromDTS(StartTime)) < 0) { if (StartTime < 0 || (CurrentFrame = Frames.FrameFromPTS(StartTime)) < 0) {
switch (SeekMode) { switch (SeekMode) {
case 1: case 1:
// No idea where we are so go back a bit further // No idea where we are so go back a bit further
@ -199,7 +199,7 @@ ReSeek:
goto ReSeek; goto ReSeek;
case 2: case 2:
case 3: case 3:
CurrentFrame = Frames.ClosestFrameFromDTS(StartTime); CurrentFrame = Frames.ClosestFrameFromPTS(StartTime);
break; break;
default: default:
throw FFMS_Exception(FFMS_ERROR_SEEKING, FFMS_ERROR_UNKNOWN, throw FFMS_Exception(FFMS_ERROR_SEEKING, FFMS_ERROR_UNKNOWN,

View file

@ -107,7 +107,7 @@ void FFMatroskaAudio::GetAudio(void *Buf, int64_t Start, int64_t Count) {
const int64_t SizeConst = (av_get_bits_per_sample_format(CodecContext->sample_fmt) * CodecContext->channels) / 8; const int64_t SizeConst = (av_get_bits_per_sample_format(CodecContext->sample_fmt) * CodecContext->channels) / 8;
memset(Buf, 0, static_cast<size_t>(SizeConst * Count)); memset(Buf, 0, static_cast<size_t>(SizeConst * Count));
int PreDecBlocks = 0; unsigned int PreDecBlocks = 0;
uint8_t *DstBuf = static_cast<uint8_t *>(Buf); uint8_t *DstBuf = static_cast<uint8_t *>(Buf);
// Fill with everything in the cache // Fill with everything in the cache

View file

@ -107,8 +107,8 @@ FFMatroskaVideo::FFMatroskaVideo(const char *SourceFile, int Track,
VP.ColorSpace = 0; VP.ColorSpace = 0;
VP.ColorRange = 0; VP.ColorRange = 0;
#endif #endif
VP.FirstTime = ((Frames.front().DTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; VP.FirstTime = ((Frames.front().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
VP.LastTime = ((Frames.back().DTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; VP.LastTime = ((Frames.back().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
if (CodecContext->width <= 0 || CodecContext->height <= 0) if (CodecContext->width <= 0 || CodecContext->height <= 0)
throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC, throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC,
@ -116,8 +116,8 @@ FFMatroskaVideo::FFMatroskaVideo(const char *SourceFile, int Track,
// Calculate the average framerate // Calculate the average framerate
if (Frames.size() >= 2) { if (Frames.size() >= 2) {
double DTSDiff = (double)(Frames.back().DTS - Frames.front().DTS); double PTSDiff = (double)(Frames.back().PTS - Frames.front().PTS);
VP.FPSDenominator = (unsigned int)(DTSDiff * mkv_TruncFloat(TI->TimecodeScale) / (double)1000 / (double)(VP.NumFrames - 1) + 0.5); VP.FPSDenominator = (unsigned int)(PTSDiff * mkv_TruncFloat(TI->TimecodeScale) / (double)1000 / (double)(VP.NumFrames - 1) + 0.5);
VP.FPSNumerator = 1000000; VP.FPSNumerator = 1000000;
} }

View file

@ -217,8 +217,8 @@ void FillAP(FFMS_AudioProperties &AP, AVCodecContext *CTX, FFMS_Track &Frames) {
AP.ChannelLayout = CTX->channel_layout; AP.ChannelLayout = CTX->channel_layout;
AP.SampleRate = CTX->sample_rate; AP.SampleRate = CTX->sample_rate;
AP.NumSamples = (Frames.back()).SampleStart + (Frames.back()).SampleCount; AP.NumSamples = (Frames.back()).SampleStart + (Frames.back()).SampleCount;
AP.FirstTime = ((Frames.front().DTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; AP.FirstTime = ((Frames.front().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
AP.LastTime = ((Frames.back().DTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000; AP.LastTime = ((Frames.back().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
} }
#ifdef HAALISOURCE #ifdef HAALISOURCE

View file

@ -194,7 +194,7 @@ FFMS_VideoSource::~FFMS_VideoSource() {
} }
FFMS_Frame *FFMS_VideoSource::GetFrameByTime(double Time) { FFMS_Frame *FFMS_VideoSource::GetFrameByTime(double Time) {
int Frame = Frames.ClosestFrameFromDTS(static_cast<int64_t>((Time * 1000 * Frames.TB.Den) / Frames.TB.Num)); int Frame = Frames.ClosestFrameFromPTS(static_cast<int64_t>((Time * 1000 * Frames.TB.Den) / Frames.TB.Num));
return GetFrame(Frame); return GetFrame(Frame);
} }

View file

@ -99,7 +99,7 @@ private:
int SeekMode; int SeekMode;
FFSourceResources<FFMS_VideoSource> Res; FFSourceResources<FFMS_VideoSource> Res;
void DecodeNextFrame(int64_t *DTS); void DecodeNextFrame(int64_t *PTS);
protected: protected:
void Free(bool CloseCodec); void Free(bool CloseCodec);
public: public: