type
  TCustomPlayer = class(TFFBasePlayer)
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

    // open the media file to play, render on the custom window specified by handle
    function Open(const AFileName: TPathFileName; AScreenHandle: {$IFDEF BCB}Pointer{$ELSE}HWND{$ENDIF};
      const AOptions: string = ''): Boolean;
    procedure TryOpen(const AFileName: TPathFileName; AScreenHandle: {$IFDEF BCB}Pointer{$ELSE}HWND{$ENDIF};
      const AOptions: string = '');
    function CurrentFrame(var ABitmap: TBitmap; out APTS: Int64): Boolean; overload; override;
    function DisplayToActualRect(ADisplayRect: TRect): TRect;
    procedure RecreateScreen;
    function TryScreenHandle(AScreenHandle: {$IFDEF BCB}Pointer{$ELSE}HWND{$ENDIF}): Boolean;

    // after video stopped, whether clear screen(fill with BackColor) or not:
    //    -1, don't clear screen on switching video, clear screen otherwise, defualt value
    //     0, don't clear screen
    //     1, always clear screen
    property ClearScreenAfterStop: Integer read FClearScreenAfterStop write FClearScreenAfterStop;
    // initial displayed width
    property ScreenWidth: Integer read Fscreen_width write Fscreen_width;
    // initial displayed height
    property ScreenHeight: Integer read Fscreen_height write Fscreen_height;
    property ScreenHandle: {$IFDEF BCB}Pointer{$ELSE}HWND{$ENDIF} read FScreenHandle write SetScreenHandle;
    property ScreenWindow: PSDL_Window read Fwindow;
    property HijackWndProc: Boolean read FHijackWndProc write FHijackWndProc;
    // AspectRatio: = 0 means keeping original, < 0 means scaling to fit, > 0 means customization
    property AspectRatio: Double read FAspectRatio write SetAspectRatio;
    // get all video drivers after SDL2 loaded, SDL2 will be loaded in LoadAVLib() function
    property VideoDrivers: TStringList read GetVideoDrivers;
    // set video driver before InitSDL(), or leave it empty for default
    // get current video driver after InitSDL()
    property VideoDriver: string read GetVideoDriver write FVideoDriver;
    // enable/disable video hook event
    property VideoHook: Boolean read FVideoHook write FVideoHook;
    property WindowTitle: string read Fwindow_title write Fwindow_title;
    property ShowMode: TShowMode read FShowMode write SetShowMode;
    // specifies the number of adjacent color bits on each plane needed to define a pixel.
    // one of (8, 15[555, BI_RGB], 16[565, BI_BITFIELDS], 24, 32), default to 32
    property VideoHookBitsPixel: Integer read GetVideoHookBitsPixel write SetVideoHookBitsPixel;
    // rdft speed in second
    property rdftspeed: Double read Frdftspeed write Frdftspeed;
  published
    property OnVideoHook: TVideoHookEvent read FOnVideoHook write FOnVideoHook;
    property OnVideoRender: TNotifyEvent read FOnVideoRender write FOnVideoRender;
  end;

  TFFPlayer = class(TCustomPlayer)
  published
    property AspectRatio;
    property AudioDriver;
    property AudioHook default False;
    property AudioVolume default SDL_MIX_MAXVOLUME;
    property Mute default False;
    property FrameHook default False;
    property ScreenWidth default 0;
    property ScreenHeight default 0;
    property TriggerEventInMainThread default True;
    property VideoDriver;
    property VideoHook default False;
  end;

