type
  // events
  TDisplayFrameEvent = procedure(Sender: TObject; APicture: PAVPicture; APixFmt: TAVPixelFormat;
    AWidth, AHeight: Integer; const AAspectRatio: Single; const APTS: Int64) of object;
  TDisplayEvent = procedure(Sender: TObject; ABitmap: TBitmap;
    const AAspectRatio: Single; const APTS: Int64) of object;
  TMeasureScreenEvent = procedure(Sender: TObject; var AWidth, AHeight: Integer) of object;

  TCustomPlayerX = 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; const AOptions: string = ''): Boolean;
    procedure TryOpen(const AFileName: TPathFileName; const AOptions: string = '');
    function CurrentFrame(var ABitmap: TBitmap; out APTS: Int64): Boolean; overload; override;
    function DisplayToActualRect(ADisplayRect, ASelectRect: TRect): TRect;
    procedure Repaint;

    // desire frame format
    property FrameFormat: TAVPixelFormat read FFrameTgtFmt write SetFrameTgtFmt;
    property ConvertToBitmapWhileDecoding: Boolean read FConvertToBitmapWhileDecoding write FConvertToBitmapWhileDecoding;
//    property VideoHook: Boolean read FVideoHook write FVideoHook;
    // audio sample show mode
    property ShowMode: TShowMode read FShowMode write SetShowMode;
{$IFNDEF FFFMX}
    // 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 VideoBitsPixel: Integer read GetVideoBitsPixel write SetVideoBitsPixel;
{$ENDIF}
  published
//    property OnVideoHook: TVideoHookEvent read FOnVideoHook write FOnVideoHook;
    property OnClearAudio: TNotifyEvent read FOnClearAudio write FOnClearAudio;
    property OnClearVideo: TNotifyEvent read FOnClearVideo write FOnClearVideo;
    property OnDisplayAudio: TDisplayEvent read FOnDisplayAudio write FOnDisplayAudio;
    property OnDisplayFrame: TDisplayFrameEvent read FOnDisplayFrame write FOnDisplayFrame;
    property OnDisplayVideo: TDisplayEvent read FOnDisplayVideo write FOnDisplayVideo;
    property OnMeasureAudioScreen: TMeasureScreenEvent read FOnMeasureAudioScreen write FOnMeasureAudioScreen;
  end;

  TFXPlayer = class(TCustomPlayerX)
  published
    property AudioDriver;
    property AudioHook default False;
    property AudioVolume default SDL_MIX_MAXVOLUME;
    property Mute default False;
    property FrameHook default False;
    property TriggerEventInMainThread default True;
  end;
