type
TFileStreamInfo = record
StartTime: Int64;
Duration: Int64;
BitRate: Integer;
TimeStamp: Int64;
Year: Integer;
Track: Integer;
Title: string;
Author: string;
Copyright: string;
Comment: string;
Album: string;
Genre: string;
end;
TAudioStreamInfo = record
Language: string;
CodecName: string;
StartTime: Int64;
StartTimeScaled: Int64;
Duration: Int64;
DurationScaled: Int64;
BitRate: Integer;
Channels: Integer;
SampleRate: Integer;
SampleFormat: TSampleFormat;
end;
TVideoStreamInfo = record
Language: string;
CodecName: string;
StartTime: Int64;
StartTimeScaled: Int64;
Duration: Int64;
DurationScaled: Int64;
BitRate: Integer;
Height: Integer;
Width: Integer;
AspectRatio: Single;
PixFmt: TAVPixelFormat;
FrameRate: TAVRational;
end;
TSubtitleStreamInfo = record
Language: string;
CodecName: string;
end;
TCustomAVProbe = class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AVLibLoaded: Boolean;
function LoadAVLib(const APath: TPathFileName): Boolean;
procedure UnloadAVLib;
function LoadFile(const AFileName: WideString; const AFormatName: string = ''): Boolean;
procedure CloseFile; virtual;
function IsAudioStream(AStreamIndex: Integer): Boolean;
function IsVideoStream(AStreamIndex: Integer): Boolean;
function IsSubtitleStream(AStreamIndex: Integer): Boolean;
procedure ParentKey;
procedure SetLicenseKey(const AKey: AnsiString; ASeed: LongWord; AHex: Boolean = True);
property FileHandle: PAVFormatContext read FFileHandle write SetFileHandle;
property FileName: WideString read GetFileName;
property FileSize: Int64 read FFileSize;
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;
TPictureType = (
ptUnknown = 0,
ptI = 1,
ptP = 2,
ptB = 3,
ptS = 4,
ptSI = 5,
ptSP = 6,
ptBI = 7);
TSeekFlag = (
sfBackward,
sfByte,
sfAny);
TSeekFlags = set of TSeekFlag;
TFrameInfo = record
PixFmt: TAVPixelFormat;
Width: Integer;
Height: Integer;
IsKeyFrame: Boolean;
PictureType: TPictureType;
PTS: Int64;
OriginalDTS: Int64;
OriginalPTS: Int64;
StreamIndex: Integer;
Ready: Boolean;
Picture: TAVPicture;
Buffer: PByte;
Size: Integer;
end;
TAVProbe = class(TCustomAVProbe)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure CloseFile; override;
function Seek(const APTS: Int64; ASeekFlags: TSeekFlags = []): Boolean;
function Decode(AStreamIndex: Integer = -1): Boolean;
function CopyToBitmap(ABitmap: TBitmap): Boolean;
property EOF: Boolean read FEOF;
property FrameInfo: TFrameInfo read FPicture;
property Position: Int64 read GetPosition;
end;