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

📄 dspack.pas

📁 摄像头视频捕捉程序
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      FOnDVDAnglesAvailable         : TOnDVDAnglesAvailable       ;
      FOnDVDPlayPeriodAutoStop      : TOnDVDPlayPeriodAutoStop    ;
      FOnDVDButtonAutoActivated     : TOnDVDButtonAutoActivated   ;
      FOnDVDCMDStart                : TOnDVDCMDStart              ;
      FOnDVDCMDEnd                  : TOnDVDCMDEnd                ;
      FOnDVDDiscEjected             : TOnDVDDiscEjected           ;
      FOnDVDDiscInserted            : TOnDVDDiscInserted          ;
      FOnDVDCurrentHMSFTime         : TOnDVDCurrentHMSFTime       ;
      FOnDVDKaraokeMode             : TOnDVDKaraokeMode           ;
      // DVD Warning
      FOnDVDWarningInvalidDVD1_0Disc  : TOnDVDWarning;//=1,
      FOnDVDWarningFormatNotSupported : TOnDVDWarning;//=2,
      FOnDVDWarningIllegalNavCommand  : TOnDVDWarning;//=3
      FOnDVDWarningOpen               : TOnDVDWarning;//=4
      FOnDVDWarningSeek               : TOnDVDWarning;//=5
      FOnDVDWarningRead               : TOnDVDWarning;//=6
      // DVDDomain
      FOnDVDDomainFirstPlay         : TOnDVDDomain;
      FOnDVDDomainVideoManagerMenu  : TOnDVDDomain;
      FOnDVDDomainVideoTitleSetMenu : TOnDVDDomain;
      FOnDVDDomainTitle             : TOnDVDDomain;
      FOnDVDDomainStop              : TOnDVDDomain;
      // DVDError
      FOnDVDErrorUnexpected                          : TOnDVDError;
      FOnDVDErrorCopyProtectFail                     : TOnDVDError;
      FOnDVDErrorInvalidDVD1_0Disc                   : TOnDVDError;
      FOnDVDErrorInvalidDiscRegion                   : TOnDVDError;
      FOnDVDErrorLowParentalLevel                    : TOnDVDError;
      FOnDVDErrorMacrovisionFail                     : TOnDVDError;
      FOnDVDErrorIncompatibleSystemAndDecoderRegions : TOnDVDError;
      FOnDVDErrorIncompatibleDiscAndDecoderRegions   : TOnDVDError;
  protected
    procedure InitServerData; override;
    procedure DoEvent(Event, Param1, Param2: longint); override;
  public
    DvdGraphBuilder : IDvdGraphBuilder;
    DvdControl2     : IDvdControl2;
    DvdInfo2        : IDvdInfo2;
    AMLine21Decoder : IAMLine21Decoder;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Connect; override;
    procedure Disconnect; override;
    procedure QueryInterfaces; override;
    procedure SaveBookmark(BookMarkFile: string);
    procedure RestoreBookmark(BookMarkFile: string);
  published
      property OnDVDAudioStreamChange     : TOnDVDAudioStreamChange      read FOnDVDAudioStreamChange      write FOnDVDAudioStreamChange     ;
      property OnDVDCurrentTime           : TOnDVDCurrentTime            read FOnDVDCurrentTime            write FOnDVDCurrentTime           ;
      property OnDVDTitleChange           : TOnDVDTitleChange            read FOnDVDTitleChange            write FOnDVDTitleChange           ;
      property OnDVDChapterStart          : TOnDVDChapterStart           read FOnDVDChapterStart           write FOnDVDChapterStart          ;
      property OnDVDAngleChange           : TOnDVDAngleChange            read FOnDVDAngleChange            write FOnDVDAngleChange           ;
      property OnDVDValidUOPSChange       : TOnDVDValidUOPSChange        read FOnDVDValidUOPSChange        write FOnDVDValidUOPSChange       ;
      property OnDVDButtonChange          : TOnDVDButtonChange           read FOnDVDButtonChange           write FOnDVDButtonChange          ;
      property OnDVDChapterAutoStop       : TOnDVDChapterAutoStop        read FOnDVDChapterAutoStop        write FOnDVDChapterAutoStop       ;
      property OnDVDStillOn               : TOnDVDStillOn                read FOnDVDStillOn                write FOnDVDStillOn               ;
      property OnDVDStillOff              : TOnDVDStillOff               read FOnDVDStillOff               write FOnDVDStillOff              ;
      property OnDVDSubpictureStreamChange: TOnDVDSubpictureStreamChange read FOnDVDSubpictureStreamChange write FOnDVDSubpictureStreamChange;
      property OnDVDNoFP_PGC              : TOnDVDNoFP_PGC               read FOnDVDNoFP_PGC               write FOnDVDNoFP_PGC              ;
      property OnDVDPlaybackRateChange    : TOnDVDPlaybackRateChange     read FOnDVDPlaybackRateChange     write FOnDVDPlaybackRateChange    ;
      property OnDVDParentalLevelChange   : TOnDVDParentalLevelChange    read FOnDVDParentalLevelChange    write FOnDVDParentalLevelChange   ;
      property OnDVDPlaybackStopped       : TOnDVDPlaybackStopped        read FOnDVDPlaybackStopped        write FOnDVDPlaybackStopped       ;
      property OnDVDAnglesAvailable       : TOnDVDAnglesAvailable        read FOnDVDAnglesAvailable        write FOnDVDAnglesAvailable       ;
      property OnDVDPlayPeriodAutoStop    : TOnDVDPlayPeriodAutoStop     read FOnDVDPlayPeriodAutoStop     write FOnDVDPlayPeriodAutoStop    ;
      property OnDVDButtonAutoActivated   : TOnDVDButtonAutoActivated    read FOnDVDButtonAutoActivated    write FOnDVDButtonAutoActivated   ;
      property OnDVDCMDStart              : TOnDVDCMDStart               read FOnDVDCMDStart               Write FOnDVDCMDStart              ;
      property OnDVDCMDEnd                : TOnDVDCMDEnd                 read FOnDVDCMDEnd                 Write FOnDVDCMDEnd                ;
      property OnDVDDiscEjected           : TOnDVDDiscEjected            read FOnDVDDiscEjected            Write FOnDVDDiscEjected           ;
      property OnDVDDiscInserted          : TOnDVDDiscInserted           read FOnDVDDiscInserted           write FOnDVDDiscInserted          ;
      property OnDVDCurrentHMSFTime       : TOnDVDCurrentHMSFTime        read FOnDVDCurrentHMSFTime        write FOnDVDCurrentHMSFTime       ;
      property OnDVDKaraokeMode           : TOnDVDKaraokeMode            read FOnDVDKaraokeMode            write FOnDVDKaraokeMode           ;
      //DVD Domain
      property OnDVDDomainFirstPlay         : TOnDVDDomain read FOnDVDDomainFirstPlay         write FOnDVDDomainFirstPlay         ;
      property OnDVDDomainVideoManagerMenu  : TOnDVDDomain read FOnDVDDomainVideoManagerMenu  write FOnDVDDomainVideoManagerMenu  ;
      property OnDVDDomainVideoTitleSetMenu : TOnDVDDomain read FOnDVDDomainVideoTitleSetMenu write FOnDVDDomainVideoTitleSetMenu ;
      property OnDVDDomainTitle             : TOnDVDDomain read FOnDVDDomainTitle             write FOnDVDDomainTitle             ;
      property OnDVDDomainStop              : TOnDVDDomain read FOnDVDDomainStop              write FOnDVDDomainStop              ;
      //DVD Error
      property OnDVDErrorUnexpected                          : TOnDVDError read FOnDVDErrorUnexpected                          write FOnDVDErrorUnexpected;
      property OnDVDErrorCopyProtectFail                     : TOnDVDError read FOnDVDErrorCopyProtectFail                     write FOnDVDErrorCopyProtectFail;
      property OnDVDErrorInvalidDVD1_0Disc                   : TOnDVDError read FOnDVDErrorInvalidDVD1_0Disc                   write FOnDVDErrorInvalidDVD1_0Disc;
      property OnDVDErrorInvalidDiscRegion                   : TOnDVDError read FOnDVDErrorInvalidDiscRegion                   write FOnDVDErrorInvalidDiscRegion;
      property OnDVDErrorLowParentalLevel                    : TOnDVDError read FOnDVDErrorLowParentalLevel                    write FOnDVDErrorLowParentalLevel;
      property OnDVDErrorMacrovisionFail                     : TOnDVDError read FOnDVDErrorMacrovisionFail                     write FOnDVDErrorMacrovisionFail;
      property OnDVDErrorIncompatibleSystemAndDecoderRegions : TOnDVDError read FOnDVDErrorIncompatibleSystemAndDecoderRegions write FOnDVDErrorIncompatibleSystemAndDecoderRegions;
      property OnDVDErrorIncompatibleDiscAndDecoderRegions   : TOnDVDError read FOnDVDErrorIncompatibleDiscAndDecoderRegions   write FOnDVDErrorIncompatibleDiscAndDecoderRegions;
      //DVD Warning
      property OnDVDWarningInvalidDVD1_0Disc  : TOnDVDWarning read FOnDVDWarningInvalidDVD1_0Disc  write FOnDVDWarningInvalidDVD1_0Disc  ; //=1,
      property OnDVDWarningFormatNotSupported : TOnDVDWarning read FOnDVDWarningFormatNotSupported write FOnDVDWarningFormatNotSupported ; //=2,
      property OnDVDWarningIllegalNavCommand  : TOnDVDWarning read FOnDVDWarningIllegalNavCommand  write FOnDVDWarningIllegalNavCommand  ; //=3
      property OnDVDWarningOpen               : TOnDVDWarning read FOnDVDWarningOpen               write FOnDVDWarningOpen               ; //=4
      property OnDVDWarningSeek               : TOnDVDWarning read FOnDVDWarningSeek               write FOnDVDWarningSeek               ; //=5
      property OnDVDWarningRead               : TOnDVDWarning read FOnDVDWarningRead               write FOnDVDWarningRead               ; //=6
  end;

//******************************************************************************
//
// TDSCaptureGraph declaration
//
//******************************************************************************
  TDSCaptureGraph = class(TDSFilterGraph2)
  private
  protected
    procedure InitServerData; override;
  public
    CaptureGraphBuilder2 : ICaptureGraphBuilder2;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Connect; override;
    procedure Disconnect; override;
    procedure QueryInterfaces; override;
  published
  end;

//******************************************************************************
//
// TDSSysDevEnum declaration
//
//******************************************************************************
  PDSFilCatNode = ^TDSFilCatNode;
  TDSFilCatNode = record
    FriendlyName : Shortstring;
    CLSID        : TGUID;
  end;

  TDSSysDevEnum = class
    private
      FGUID       : TGUID;
      FCategories : TList;
      FFilters    : TList;
      ACategory   : PDSFilCatNode;
      procedure   GetCat(catlist: TList; CatGUID: TGUID);
      function    GetCountCategories: integer;
      function    GetCountFilters: integer;
      function    GetCategory(item: integer): TDSFilCatNode;
      function    GetFilter(item: integer): TDSFilCatNode;
    public
      procedure SelectGUIDCategory(GUID: TGUID);
      procedure SelectIndexCategory(index: integer);
      property CountCategories: integer read GetCountCategories;
      property CountFilters: integer read GetCountFilters;
      property Categories[item: integer]: TDSFilCatNode read GetCategory;
      property Filters[item: integer]: TDSFilCatNode read GetFilter;
      function GetBaseFilterByIndex(index: integer): IBaseFilter;
      Constructor Create;
      destructor Destroy; override;
    end;
//******************************************************************************

procedure Register;

//##############################################################################

implementation
//******************************************************************************
//
// TDSVideoWindow implementation
//
//******************************************************************************
  constructor TDSVideoWindow.Create(AOwner: TComponent);
  begin
    inherited Create(AOwner);
    self.Height := 120;
    self.Width  := 160;
    self.color  := $00000000;
    FVidHandle := AllocateHWnd(VidWndProc);
    canvas.OnChanging := CaptureCanvas;
    canvas.OnChange   := ReleaseCanvas;
  end;

  destructor TDSVideoWindow.Destroy;
  begin
    DeallocateHWnd(FVidHandle);
    inherited destroy;
  end;

  procedure TDSVideoWindow.VidWndProc(var Msg: TMessage);
  var
    ShiftState: TShiftState;
    hnd : HWND;
  begin
  with Msg do
        try
          case Msg of
            WM_KEYDOWN         :
              if assigned(FOnVidKeyDown) then
              begin
                ShiftState := KeyDataToShiftState(LPARAM);
                FOnVidKeyDown(self, WPARAMLO, ShiftState);
                if WPARAM = 0 then Exit;
              end;
            WM_KEYUP           :
              if assigned(FOnVidKeyUp) then
              begin
                ShiftState := KeyDataToShiftState(LPARAM);
                FOnVidKeyUp(self, WPARAMLO, ShiftState);
                if WPARAM = 0 then Exit;
              end;
            WM_LBUTTONDBLCLK   :
              if assigned(FOnVidDblClick) then
              begin
                FOnVidDblClick(self,mbLeft,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
              end;
            WM_MBUTTONDBLCLK   :
              if assigned(FOnVidDblClick) then
              begin
                FOnVidDblClick(self,mbMiddle,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
              end;
            WM_RBUTTONDBLCLK   : if assigned(FOnVidDblClick) then FOnVidDblClick(self,mbRight,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
            WM_LBUTTONDOWN     :
              if assigned(FOnVidMouseDown) then
              begin
                FOnVidMouseDown(self,mbLeft,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
              end;
            WM_MBUTTONDOWN     :
              if assigned(FOnVidMouseDown) then
              begin
                FOnVidMouseDown(self,mbMiddle,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
              end;
            WM_RBUTTONDOWN     :
              if assigned(FOnVidMouseDown) then
              begin
                FOnVidMouseDown(self,mbRight,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
              end;
            WM_LBUTTONUP       :
              if assigned(FOnVidMouseUp) then
              begin
                FOnVidMouseUp(self,mbLeft,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
                if GetVideoHandle(hnd) then windows.SetFocus(hnd);
              end;
            WM_MBUTTONUP       :
              if assigned(FOnVidMouseUp) then
              begin
                FOnVidMouseUp(self,mbMiddle,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
                if GetVideoHandle(hnd) then windows.SetFocus(hnd);
              end;
            WM_RBUTTONUP       :
              begin
                if assigned(PopupMenu) then PopupMenu.Popup(mouse.CursorPos.x,mouse.CursorPos.y);
                if assigned(FOnVidMouseUp) then FOnVidMouseUp(self,mbRight,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
                if GetVideoHandle(hnd) then windows.SetFocus(hnd);
              end;
            WM_MOUSEMOVE       :
              if assigned(FOnVidMouseMove) then
              begin
                FOnVidMouseMove(self,KeyDataToShiftState(WPARAM),LPARAMLO,LPARAMHI);
              end;
          else
            begin
              Result := DefWindowProc(FVidHandle, Msg, wParam, lParam);
            end;
          end;
        except
          Application.HandleException(Self);
        end;
  end;

  procedure TDSVideoWindow.SetGraph(grf: TDSGraph);
  begin
    if assigned(FGraph) then FGraph.FVW := nil;
    FGraph := grf;
    if assigned(FGraph) then
    begin
      FGraph.FVW := self;
      if VideoAvailable then
      begin
        with FGraph.VideoWindow do
        begin
          put_Owner(self.Parent.Handle);
          put_WindowStyle(WS_CHILD or WS_CLIPSIBLINGS);
          SetWindowPosition(self.Left,self.Top,self.Width,self.Height);
          put_MessageDrain(self.FVidHandle);
        end;
      end;
    end;
  end;

  procedure TDSVideoWindow.Resize;
  begin
    inherited Resize;
    if VideoAvailable then
    begin
      FGraph.VideoWindow.SetWindowPosition(self.Left,self.Top,self.Width,self.Height);
    end;
  end;

  function TDSVideoWindow.GetVideoHandle(out VideoHandle: HWND): boolean;
  var renderer : IBaseFilter;
      input    : IPin;
      enum     : IEnumPins;
      Overlay  : IOverlay;
  begin
    result := false;
    if assigned(FGraph) then
    begin
      if (FGraph.GraphBuilder.FindFilterByName('Video Renderer', renderer) = S_OK) then
      begin
        renderer.EnumPins(enum);
        enum.Next(1,input,nil);

⌨️ 快捷键说明

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