type
TAudioVolume = 0..SDL_MIX_MAXVOLUME;
TPlayState = (psPlay, psPause, psResume, psStep, psStop, psEnd);
TRepeatType = (rtNone, rtStop, rtLoop);
TAudioDriver = (adDefault, adDirectSound, adWaveOut);
TVideoDriver = (vdDefault, vdDirectDraw, vdGDI);
THookEvent = procedure(Sender: TObject; ABitmap: TBitmap; const APTS: Int64) of object;
TFileOpenEvent = procedure(Sender: TObject; const ADuration: Int64;
const AFrameWidth, AFrameHeight: Integer; var AScreenWidth, AScreenHeight: Integer) of object;
TPlayStateEvent = procedure(Sender: TObject; const AState: TPlayState) of object;
TPositionEvent = procedure(Sender: TObject; const APTS: Int64) of object;
TCustomPlayer = class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AVLibLoaded: Boolean;
function LoadAVLib(const APath: TPathFileName): Boolean;
procedure UnloadAVLib;
function Open(const AFileName: WideString; const AScreenHandle: PointerHWND): Boolean;
procedure Stop(const AWaitForStop: Boolean = False);
procedure Pause;
procedure Resume;
procedure TogglePause;
procedure ToggleAudioDisplay;
procedure StepToNextFrame;
procedure Seek(const APTS: Int64); overload;
procedure Seek(const ADelta: Double); overload;
function CurrentFrame: TBitmap; overload;
function CurrentFrame(var APTS: Int64): TBitmap; overload;
procedure ParentKey;
procedure SetLicenseKey(const AKey: AnsiString; const ASeed: LongWord; const AHex: Boolean = True);
property DisableAudio: Boolean read Faudio_disable write Faudio_disable;
property DisableVideo: Boolean read Fvideo_disable write Fvideo_disable;
property DisableDisplay: Boolean read Fdisplay_disable write Fdisplay_disable;
property Format: string read GetFormat write SetFormat;
property FrameWidth: Integer read Fframe_width write Fframe_width;
property FrameHeight: Integer read Fframe_height write Fframe_height;
property ScreenWidth: Integer read Fscreen_width write Fscreen_width;
property ScreenHeight: Integer read Fscreen_height write Fscreen_height;
property FileName: WideString read Finput_filename;
property LastErrMsg: string read FLastErrMsg;
property ScreenHandle: PointerHWND read FScreenHandle;
property FullScreen: Boolean read Fis_full_screen;
property AudioStreamIndex: Integer read GetAudioStream write SetAudioStream;
property VideoStreamIndex: Integer read GetVideoStream write SetVideoStream;
property SubtitleStreamIndex: Integer read GetSubtitleStream write SetSubtitleStream;
property AVProbe: TAVProbe read FAVProbe;
property AspectRatio: Single read FAspectRatio write SetAspectRatio;
property AudioDriver: TAudioDriver read FAudioDriver write FAudioDriver;
property AudioVolume: TAudioVolume read FAudioVolume write FAudioVolume;
property Mute: Boolean read FMute write FMute;
property CurrentPTS: Int64 read FCurrentPTS;
property Hook: Boolean read FHook write FHook;
property PlayTime: Int64 read FPlayTime write FPlayTime;
property RepeatType: TRepeatType read FRepeatType write FRepeatType;
property SeekFlags: Integer read FSeekFlags write FSeekFlags;
property SeekBackware: Boolean index AVSEEK_FLAG_BACKWARD read GetSeekFlag write SetSeekFlag;
property SeekByByte: Boolean index AVSEEK_FLAG_BYTE read GetSeekFlag write SetSeekFlag;
property SeekToAny: Boolean index AVSEEK_FLAG_ANY read GetSeekFlag write SetSeekFlag;
property SeekByFrame: Boolean index AVSEEK_FLAG_FRAME read GetSeekFlag write SetSeekFlag;
property TriggerEventInMainThread: Boolean read FTriggerEventInMainThread
write FTriggerEventInMainThread;
property VerticalFlip: Boolean read FVerticalFlip write FVerticalFlip;
property VideoDriver: TVideoDriver read FVideoDriver write FVideoDriver;
property is_full_screen: Boolean read Fis_full_screen write Fis_full_screen;
property wanted_audio_stream: Integer read Fwanted_audio_stream write Fwanted_audio_stream;
property wanted_video_stream: Integer read Fwanted_video_stream write Fwanted_video_stream;
property wanted_subtitle_stream: Integer read Fwanted_subtitle_stream write Fwanted_subtitle_stream;
property start_time: Int64 read Fstart_time write Fstart_time;
property frame_pix_fmt: TAVPixelFormat read Fframe_pix_fmt write Fframe_pix_fmt;
property workaround_bugs: Integer read Fworkaround_bugs write Fworkaround_bugs;
property debug_mv: Integer read Fdebug_mv write Fdebug_mv;
property fast: Boolean read Ffast write Ffast;
property genpts: Boolean read Fgenpts write Fgenpts;
property decoder_reorder_pts: Boolean read Fdecoder_reorder_pts write Fdecoder_reorder_pts;
property lowres: Integer read Flowres write Flowres;
property skip_loop_filter: TAVDiscard read Fskip_loop_filter write Fskip_loop_filter;
property skip_frame: TAVDiscard read Fskip_frame write Fskip_frame;
property skip_idct: TAVDiscard read Fskip_idct write Fskip_idct;
property idct_algo: Integer read Fidct_algo write Fidct_algo;
property error_recognition: Integer read Ferror_recognition write Ferror_recognition;
property error_concealment: Integer read Ferror_concealment write Ferror_concealment;
property av_sync_type: Tav_sync_type read Fav_sync_type write Fav_sync_type;
published
property About: string read FAbout write FAbout;
property Version: string read GetVersion;
property OnFileOpen: TFileOpenEvent read FOnFileOpen write FOnFileOpen;
property OnHook: THookEvent read FOnHook write FOnHook;
property OnPosition: TPositionEvent read FOnPosition write FOnPosition;
property OnState: TPlayStateEvent read FOnState write FOnState;
end;
TFFPlayer = class(TCustomPlayer)
published
property AspectRatio;
property AudioVolume default SDL_MIX_MAXVOLUME;
property DisableAudio default False;
property DisableVideo default False;
property DisableDisplay default False;
property Mute default False;
property FrameWidth default 0;
property FrameHeight default 0;
property Hook default False;
property ScreenWidth default 0;
property ScreenHeight default 0;
property SeekBackware default False;
property SeekByByte default False;
property SeekToAny default False;
property SeekByFrame default False;
property TriggerEventInMainThread default True;
end;
function GetDesktopHandle: PointerHWND;
implementation
function GetDesktopHandle: Pointer;
var
H: HWND;
begin
H := FindWindow('ProgMan', nil);
H := GetWindow(H, GW_CHILD);
H := GetWindow(H, GW_CHILD);
Result := Pointer(H);
end;
function GetDesktopHandle: HWND;
begin
Result := FindWindow('ProgMan', nil);
Result := GetWindow(Result, GW_CHILD);
Result := GetWindow(Result, GW_CHILD);
end;