unit MPlayerUnit;
interface
uses
Forms, Classes, Controls, MPlayer;
type
THiddenForm =
class(TForm)
MediaPlayer: TMediaPlayer;
public
procedure GetProperties(FileName:
string;
var MediaFrames, MediaLength, MediaWidth, MediaHeight: Integer);
end;
var
HiddenForm: THiddenForm;
implementation
{$R *.dfm}
procedure THiddenForm.GetProperties(FileName:
string;
var MediaFrames, MediaLength, MediaWidth, MediaHeight: Integer);
begin
MediaPlayer.FileName := FileName;
MediaPlayer.Wait := False;
MediaPlayer.Open;
MediaPlayer.TimeFormat := tfFrames;
MediaFrames := MediaPlayer.Length;
MediaPlayer.TimeFormat := tfMilliseconds;
MediaLength := MediaPlayer.Length;
MediaPlayer.DisplayRect := Rect(1, 1, 0, 0);
{"0, 0" forces resolution autodetect}
MediaWidth := MediaPlayer.DisplayRect.Right;
MediaHeight := MediaPlayer.DisplayRect.Bottom;
if (MediaWidth <= 0)
or (MediaHeight <= 0)
then
begin {invalid values mean not video}
MediaWidth := 0;
MediaHeight := 0;
end;
MediaPlayer.Close;
end;
end.