type
TFileStreamInfo = packed record
StartTime: Int64;
Duration: Int64;
BitRate: Integer;
TimeStamp: Int64;
Title: array[0..512-1] of AnsiChar;
Author: array[0..512-1] of AnsiChar;
Copyright: array[0..512-1] of AnsiChar;
Comment: array[0..512-1] of AnsiChar;
Album: array[0..512-1] of AnsiChar;
Year: Integer;
Track: Integer;
Genre: array[0..32-1] of AnsiChar;
end;
TAudioStreamInfo = packed record
Language: array[0..3] of AnsiChar;
CodecName: array[0..31] of AnsiChar;
StartTime: Int64;
StartTimeScaled: Int64;
Duration: Int64;
DurationScaled: Int64;
BitRate: Integer;
Channels: Integer;
SampleRate: Integer;
SampleFormat: TSampleFormat;
end;
TVideoStreamInfo = packed record
Language: array[0..3] of AnsiChar;
CodecName: array[0..31] of AnsiChar;
StartTime: Int64;
StartTimeScaled: Int64;
Duration: Int64;
DurationScaled: Int64;
BitRate: Integer;
Height: Integer;
Width: Integer;
AspectRatio: Single;
PixFmt: TAVPixelFormat;
FrameRate: TAVRational;
end;
TSubtitleStreamInfo = packed record
Language: array[0..3] of AnsiChar;
CodecName: array[0..31] of AnsiChar;
end;
TCustomAVProbe = class
public
constructor Create; virtual;
destructor Destroy; override;
function LoadAVLib(const APath: string; const AWithVerNum: Boolean): Boolean;
procedure UnloadAVLib;
function LoadFile(const AFileName: string; const AFormatName: string = ''): Boolean;
procedure CloseFile; virtual;
function IsAudioStream(const AStreamIndex: Integer): Boolean;
function IsVideoStream(const AStreamIndex: Integer): Boolean;
function IsSubtitleStream(const AStreamIndex: Integer): Boolean;
procedure SetLicenseKey(const AKey: AnsiString; const ASeed: LongWord;
const AHex: Boolean = True); overload;
procedure SetLicenseKey; overload;
property FileHandle: PAVFormatContext read FFileHandle write SetFileHandle;
property FileName: string read GetFileName;
property FileSize: Int64 read GetFileSize;
property ForceFormat: string read FForceFormat;
property FormatName: string read GetFormatName;
property FormatLongName: string read GetFormatLongName;
property StreamCount: Integer read FStreamCount;
property ProgramCount: Integer read FProgramCount;
property Programs[Index: Integer]: TAVProgram read GetProgrames;
property AudioStreamCount: Integer read FAudioStreamCount;
property VideoStreamCount: Integer read FVideoStreamCount;
property SubtitleStreamCount: Integer read FSubtitleStreamCount;
property FileStreamInfo: TFileStreamInfo read GetFileStreamInfo;
property AudioStreamInfos[Index: Integer]: TAudioStreamInfo read GetAudioStreamInfos;
property VideoStreamInfos[Index: Integer]: TVideoStreamInfo read GetVideoStreamInfos;
property SubtitleStreamInfos[Index: Integer]: TSubtitleStreamInfo
read GetSubtitleStreamInfos;
property FileInfoText: string read GetFileInfoText;
property FirstAudioStreamIndex: Integer read FFirstAudioStreamIndex;
property FirstVideoStreamIndex: Integer read FFirstVideoStreamIndex;
property FirstSubtitleStreamIndex: Integer read FFirstSubtitleStreamIndex;
property FirstAudioStreamInfo: TAudioStreamInfo read GetAudioStreamInfo;
property FirstVideoStreamInfo: TVideoStreamInfo read GetVideoStreamInfo;
property FirstSubtitleStreamInfo: TSubtitleStreamInfo read GetSubtitleStreamInfo;
property LastErrMsg: string read FLastErrMsg;
end;
TAVProbe = class(TCustomAVProbe)
public
constructor Create; override;
destructor Destroy; override;
procedure CloseFile; override;
function SeekFrame(const APTS: Int64; const AStreamIndex: Integer = -1): Boolean;
function ReadFramePicture(const AStreamIndex: Integer = -1): TBitmap;
property FramePicture: TBitmap read GetFramePicture;
end;