DSPACK进行视频录像,如何将时间叠加到画面上?

解决方案 »

  1.   

    显示时间的filter应该怎么写?
      

  2.   

    //在图像上增加时间
    procedure TFromVdisplayWin.AddTimeTitle(var lpVhdr: PVIDEOHDR);
    var
        pDataBuf,pBitsMem : Pointer;
        DC : HDC;
        BMHandle : HBITMAP;
        b : TBitmap;
        sDatetime : string;
    begin
            if lpVhdr^.lpData=nil then
            begin
                FVideoStreamReading := False;
                Exit;
            end;        if bBitMapInFo=nil then
            begin
                FVideoStreamReading := false;
                Exit;
            end;        pDataBuf := lpVhdr^.lpData;
            DC := GetDC(0);
            try
                BMHandle := CreateDIBSection(DC,bBitMapInFo^,DIB_RGB_COLORS,pBitsMem,0,0);
                if BMHandle<>0 then
                begin
                    try
                        Move(pDataBuf^,pBitsMem^,lpvhdr^.dwBytesUsed);
                    except
                        DeleteObject(BMHandle);
                        BMHandle :=0;
                    end;
                end;
            finally
                ReleaseDC(0,DC);
            end;        if BMHandle=0 then
            begin
                FVideoStreamReading := False;
                Exit;
            end;        b := TBitmap.Create;
            b.Handle := BMHandle;
            SetBkMode(b.Canvas.Handle,TRANSPARENT);
            b.Canvas.Font.Size :=16 ;
            sDatetime := DateToStr(Now)+'  '+ FormatDateTime('HH:mm:ss',now);
            B.Canvas.Font.Color := clBlack;
            b.Canvas.TextOut(20,5,sDatetime);        try
                Move(pBitsMem^,pDataBuf^,lpvhdr^.dwBytesUsed);
            except
                
            end;
            b.Free;