From 6e6d85df7c96bc5e298aeb811082de39d094d257 Mon Sep 17 00:00:00 2001 From: Fredrik Mellbin Date: Tue, 2 Sep 2008 19:48:22 +0000 Subject: [PATCH] FFmpegSource2: add missing api parts Originally committed to SVN as r2309. --- FFmpegSource2/ffavsfilters.cpp | 4 ++-- FFmpegSource2/ffms.cpp | 4 ++-- FFmpegSource2/ffms.h | 5 ++++- FFmpegSource2/indexing.cpp | 6 +++--- FFmpegSource2/indexing.h | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/FFmpegSource2/ffavsfilters.cpp b/FFmpegSource2/ffavsfilters.cpp index ed4625759..2058cbefb 100644 --- a/FFmpegSource2/ffavsfilters.cpp +++ b/FFmpegSource2/ffavsfilters.cpp @@ -56,7 +56,7 @@ AVSValue __cdecl CreateFFIndex(AVSValue Args, void* UserData, IScriptEnvironment FrameIndex *Index = FFMS_CreateFrameIndex(); if (OverWrite || FFMS_ReadIndex(CacheFile, Index, ErrorMsg, MsgSize)) { - if (FFMS_MakeIndex(Source, Index, TrackMask, AudioFile, ErrorMsg, MsgSize)) + if (FFMS_MakeIndex(Source, Index, TrackMask, AudioFile, NULL, ErrorMsg, MsgSize)) Env->ThrowError("FFIndex: %s", ErrorMsg); if (FFMS_WriteIndex(CacheFile, Index, ErrorMsg, MsgSize)) Env->ThrowError("FFIndex: %s", ErrorMsg); @@ -108,7 +108,7 @@ AVSValue __cdecl CreateFFVideoSource(AVSValue Args, void* UserData, IScriptEnvir FrameIndex *Index = FFMS_CreateFrameIndex(); if (Cache) { if (FFMS_ReadIndex(CacheFile, Index, ErrorMsg, MsgSize)) { - if (FFMS_MakeIndex(Source, Index, 0, NULL, ErrorMsg, MsgSize)) + if (FFMS_MakeIndex(Source, Index, 0, NULL, NULL, ErrorMsg, MsgSize)) Env->ThrowError("FFVideoSource: %s", ErrorMsg); if (Cache) diff --git a/FFmpegSource2/ffms.cpp b/FFmpegSource2/ffms.cpp index 3224ccdd6..7f11b1ef2 100644 --- a/FFmpegSource2/ffms.cpp +++ b/FFmpegSource2/ffms.cpp @@ -116,8 +116,8 @@ FFMS_API(int) FFMS_WriteTimecodes(FrameInfoVector *FIV, const char *TimecodeFile return FIV->WriteTimecodes(TimecodeFile, ErrorMsg, MsgSize); } -FFMS_API(int) FFMS_MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, char *ErrorMsg, unsigned MsgSize) { - return MakeIndex(SourceFile, TrackIndices, AudioTrackMask, AudioFile, ErrorMsg, MsgSize); +FFMS_API(int) FFMS_MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, IndexProgress *IP, char *ErrorMsg, unsigned MsgSize) { + return MakeIndex(SourceFile, TrackIndices, AudioTrackMask, AudioFile, IP, ErrorMsg, MsgSize); } FFMS_API(int) FFMS_ReadIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize) { diff --git a/FFmpegSource2/ffms.h b/FFmpegSource2/ffms.h index 9939519f8..1aabe480c 100644 --- a/FFmpegSource2/ffms.h +++ b/FFmpegSource2/ffms.h @@ -41,6 +41,8 @@ class VideoBase; class FrameIndex; class FrameInfoVector; +typedef int (*IndexProgress)(int64_t, int); + // This is a subset of the original AVFrame only containing the most used parts. // Even if it might seem like a good idea to cast it back to a full AVFrame to // access a few more values you really shouldn't do that. Only the values present @@ -90,6 +92,7 @@ FFMS_API(const AVFrameLite *) FFMS_GetFrame(VideoBase *VB, int n, char *ErrorMsg FFMS_API(FrameIndex *) FFMS_CreateFrameIndex(); FFMS_API(void) FFMS_DestroyFrameIndex(FrameIndex *FI); FFMS_API(int) FFMS_GetNumTracks(FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize); +FFMS_API(int) FFMS_GetNumFrames(FrameInfoVector *FIV, char *ErrorMsg, unsigned MsgSize); FFMS_API(const FrameInfo *) FFMS_GetFrameInfo(FrameInfoVector *FIV, int Frame, char *ErrorMsg, unsigned MsgSize); FFMS_API(FrameInfoVector *) FFMS_GetTITrackIndex(FrameIndex *TrackIndices, int Track, char *ErrorMsg, unsigned MsgSize); FFMS_API(FrameInfoVector *) FFMS_GetVSTrackIndex(VideoBase *VB, char *ErrorMsg, unsigned MsgSize); @@ -98,7 +101,7 @@ FFMS_API(int) FFMS_FrameFromDTS(FrameInfoVector *FIV, int64_t DTS, char *ErrorMs FFMS_API(int) FFMS_ClosestFrameFromDTS(FrameInfoVector *FIV, int64_t DTS, char *ErrorMsg, unsigned MsgSize); FFMS_API(const TrackTimeBase *) FFMS_GetTimeBase(FrameInfoVector *FIV, char *ErrorMsg, unsigned MsgSize); FFMS_API(int) FFMS_WriteTimecodes(FrameInfoVector *FIV, const char *TimecodeFile, char *ErrorMsg, unsigned MsgSize); -FFMS_API(int) FFMS_MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, char *ErrorMsg, unsigned MsgSize); +FFMS_API(int) FFMS_MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, IndexProgress *IP, char *ErrorMsg, unsigned MsgSize); FFMS_API(int) FFMS_ReadIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize); FFMS_API(int) FFMS_WriteIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize); diff --git a/FFmpegSource2/indexing.cpp b/FFmpegSource2/indexing.cpp index 97a145ab2..32ca3e87b 100644 --- a/FFmpegSource2/indexing.cpp +++ b/FFmpegSource2/indexing.cpp @@ -91,7 +91,7 @@ int WriteIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, return 0; } -static int MakeMatroskaIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, char *ErrorMsg, unsigned MsgSize) { +static int MakeMatroskaIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, IndexProgress *IP, char *ErrorMsg, unsigned MsgSize) { TrackIndices->Decoder = 1; MatroskaFile *MF; @@ -213,7 +213,7 @@ static int MakeMatroskaIndex(const char *SourceFile, FrameIndex *TrackIndices, i return 0; } -int MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, char *ErrorMsg, unsigned MsgSize) { +int MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, IndexProgress *IP, char *ErrorMsg, unsigned MsgSize) { TrackIndices->Decoder = 0; TrackIndices->clear(); @@ -227,7 +227,7 @@ int MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMa // Do matroska indexing instead? if (!strcmp(FormatContext->iformat->name, "matroska")) { av_close_input_file(FormatContext); - return MakeMatroskaIndex(SourceFile, TrackIndices, AudioTrackMask, AudioFile, ErrorMsg, MsgSize); + return MakeMatroskaIndex(SourceFile, TrackIndices, AudioTrackMask, AudioFile, IP, ErrorMsg, MsgSize); } if (av_find_stream_info(FormatContext) < 0) { diff --git a/FFmpegSource2/indexing.h b/FFmpegSource2/indexing.h index 236a87e80..ec81749bd 100644 --- a/FFmpegSource2/indexing.h +++ b/FFmpegSource2/indexing.h @@ -61,7 +61,7 @@ public: int Decoder; }; -int MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, char *ErrorMsg, unsigned MsgSize); +int MakeIndex(const char *SourceFile, FrameIndex *TrackIndices, int AudioTrackMask, const char *AudioFile, IndexProgress *IP, char *ErrorMsg, unsigned MsgSize); int ReadIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize); int WriteIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize);