⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video.pas.~5~

📁 delphi2007写的播放器源码。效果类似于千千静听。
💻 ~5~
字号:
unit Video;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,Bass,BassVideo,ComVariable, Menus;

type
  TfrmVideo = class(TForm)
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N431: TMenuItem;
    N1691: TMenuItem;
    N2: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure FormDblClick(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure N1691Click(Sender: TObject);
    procedure N431Click(Sender: TObject);
    procedure N1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure WndProc(var Msg : TMessage); override;
    //procedure ActiveSomeStuff;
    procedure WhenFormResize;
  end;

var
  frmVideo: TfrmVideo;
  isFullScreen : Boolean;
  OldRect : TRect;
  OldStyle : Longint;

implementation

{$R *.dfm}

procedure TfrmVideo.WndProc(var Msg: TMessage);
var dc : HDC;
    ps : TPaintStruct;
begin
  if chan <> 0 then
  case Msg.Msg of
   WM_MOVE  : begin
                // apply for Windowed Renderer
                BassVideo_WindowMove(chan, Msg.Msg, Msg.WParam, Msg.LParam, 0);
              end;

   WM_SIZE  : begin
               WhenFormResize;
              end;

   WM_PAINT : begin
                 // this apply for application that use VMR9-Windowless
                 dc := BeginPaint(Handle, ps);
                 BASSVideo_Repaint(chan, Handle, DC, 0);
                 EndPaint(Handle, ps);
              end;
  end;
   inherited;
end;

procedure TfrmVideo.WhenFormResize;
var R : TRect;
begin
  R := frmVideo.ClientRect;
  R.Left := 0; R.Top := 0;
  R.Bottom := R.Bottom;
  BassVideo_WindowResize(chan, R, 0);
end;

procedure TfrmVideo.FormCreate(Sender: TObject);
var
  R:TRect;
begin
  R:=frmVideo.ClientRect;
  BassVideo_SetVideoWindow(0, frmVideo.Handle,  R, 0);
end;

procedure TfrmVideo.FormDblClick(Sender: TObject);
begin
  isFullScreen := not isFullScreen;
 if isFullScreen then
  begin
    OldRect.Left := Left;
    OldRect.Top := Top;
    OldRect.Right := Width;
    OldRect.Bottom := Height;
    OldStyle := GetWindowLong(Handle, GWL_STYLE);
    SetWindowLong(Handle, GWL_STYLE, integer(WS_POPUPWINDOW or WS_VISIBLE));
    Left := 0;
    Top := 0;
    Height := Screen.Height;
    Width := Screen.Width;
  end
 else
  begin
   SetWindowLong(Handle, GWL_STYLE, OldStyle);
   SetWindowPos(Handle, 0, OldRect.Left , OldRect.Top, OldRect.Right, OldRect.Bottom , 0);
  end;
end;

procedure TfrmVideo.N1691Click(Sender: TObject);
begin
  BassVideo_SetRatio(chan, R169, 0, 0);
  WhenFormResize;
end;

procedure TfrmVideo.N1Click(Sender: TObject);
begin
  BassVideo_SetRatio(chan, RSource, 0, 0);
  WhenFormResize;
end;

procedure TfrmVideo.N2Click(Sender: TObject);
begin
  BassVideo_SetRatio(chan, RFree, 0, 0);
  WhenFormResize;
end;

procedure TfrmVideo.N431Click(Sender: TObject);
begin
  BassVideo_SetRatio(chan, R43, 0, 0);
  WhenFormResize;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -