Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 08/18/21 in Posts

  1. What it's like to be a Delphi Developer https://blogs.embarcadero.com/what-is-it-like-to-be-a-developer-joe-c-hecht/
  2. Image32 is a 2D graphics library written entirely in Delphi Pascal. It provides an extensive range of image manipulation functions and includes a polygon renderer that supports a wide range of filling options. Documentation: http://www.angusj.com/delphi/image32/Docs/_Body.htm Examples: http://www.angusj.com/delphi/image32/Docs/Examples.htm Download: https://sourceforge.net/projects/image32/
  3. Arnaud Bouchez

    Why compiler allows this difference in declaration?

    IIRC it was almost mandatory to work with Ole Automation and Word/Excel. Named parameters are the usual way of calling Word/Excel Ole API, from Office macros or Visual Basic. So Delphi did have to support this too. And it is easy to implement named parameters with OLE. Because in its ABI, parameters are... indeed named. Whereas for regular native code function ABI, parameters are not named, but passed in order on registers or the stack. So implementing named parameters in Delphi would have been feasible, but would require more magic, especially for the "unnamed" parameter. It was requested several times in the past, especially from people coming from Python background. Named parameters can make calls more explicit. So the question is more for Embarcadero people. 😉 You can emulate this using a record or a class to pass the values, but it is not as elegant.
  4. CHackbart

    MacOS AVPlayer and DRM

    Sure, sorry for the delay - I just forgot to post it here. You have to update the FMX.Media.Mac resp. IOS in the following way: constructor TMacMedia.Create(const AFileName: string); var LURL: NSUrl; LAbsoluteFileName: string; LAsset: AVURLAsset; begin inherited Create(AFileName); AVMediaTypeAudio; // Force load the framework if FileExists(FileName) then begin if ExtractFilePath(FileName).IsEmpty then LAbsoluteFileName := TPath.Combine(TPath.GetHomePath, FileName) else LAbsoluteFileName := FileName; LURL := TNSUrl.Wrap(TNSUrl.OCClass.fileURLWithPath(StrToNSStr(LAbsoluteFileName))); end else LURL := StrToNSUrl(FileName); if LURL = nil then raise EFileNotFoundException.Create(SSpecifiedFileNotFound); FPixelBufferBitmap := TBitmap.Create; LAsset := TAVURLAsset.Wrap(TAVURLAsset.OCClass.URLAssetWithURL(LURL, nil)); if LAsset.hasProtectedContent then ContentKeyManager.addContentKeyRecipient(LAsset); FPlayerItem := TAVPlayerItem.Wrap(TAVPlayerItem.OCClass.playerItemWithAsset(LAsset)); FPlayerItem.retain; FPlayer := TAVPlayer.Wrap(TAVPlayer.OCClass.playerWithPlayerItem(FPlayerItem)); FPlayer.retain; FPlayerLayer := TAVPlayerLayer.Wrap(TAVPlayerLayer.OCClass.playerLayerWithPlayer(FPlayer)); FPlayerLayer.retain; FPlayerLayer.setVideoGravity(CocoaNSStringConst(libAVFoundation, 'AVLayerVideoGravityResizeAspectFill')); FPlayerLayer.setAutoresizingMask(kCALayerWidthSizable or kCALayerHeightSizable); FVideoView := TNSView.Create; FVideoView.retain; FVideoView.setWantsLayer(True); FVideoView.layer.addSublayer(FPlayerLayer); SetupVideoOutput; end; The ContentKeyManager needs two callbacks which could look like this: procedure TfrmMain.DoGetCertificate(Sender: TObject; ACert: TMemoryStream); var http: THTTPClient; begin http := THTTPClient.create; try http.ContentType := 'application/octet-stream'; http.Get(FAIRLPLAY_SERVER_URL, ACert); finally http.Free; end; end; procedure TfrmMain.DoRequestContentKey(Sender: TObject; ARequest, AResponse: TMemoryStream); var http: THTTPClient; begin http := THTTPClient.create; try ARequest.Position := 0; http.ContentType := 'application/octet-stream'; http.Post(LS_SERVER_URL, ARequest, AResponse); finally http.Free; end; end; First Fairplay asks for the certificate and returns a request to the license server which should be send as post command. In return it delivers some binary data which is the key to decode the stream. I made an "example" screenshot with a test server here. The annoying thing is that DRM content does not allow to play the video in a texture. If you start to use copyPixelBufferForItemTime in order to get the video content audio and video playback stops (without any notification). I was thinking about how to put some alpha blended NSView or UIView on top which contain the buttons and other things. One of my projects involves a media player on Android, iOS and MacOS (using Metal). It heavily uses Metal and OpenGL for the output and the video view is drawn over it (using regular firemonkey controls). Maybe you have an idea? By default the video is shown on the top right and some ui is drawn above. In fullscreen the video is in the background and the rest of the context is shown in front. You can imagine what happen if DRM is involved. You only see the image, but the ui is hidden. Christian UFairplay.pas.zip
  5. Alexander Elagin

    Why compiler allows this difference in declaration?

    In fact, Delphi supports named parameters, but only for automation (OLE/COM) objects. Like this (from http://www.blong.com/articles/automation in delphi/automation.htm): //An Automation method call, using two named parameters MSWord.Selection.InsertDateTime( DateTimeFormat := 'dddd, dd MMMM yyyy', InsertAsField := False); MSWord.Selection.TypeParagraph;
  6. I would really love that crlt+click would behave same as on inherited keyword. so I could also jump to the palace it is overridden from in interface section as from in implementation (if inherited call is there), this would help even more if the implementation doesn't have inherited call. https://quality.embarcadero.com/browse/RSP-34573 -Tee-
  7. OK, if we're comparing age.... My first computer was an Imsai 8080 , though by the time I got TP 1.0 for Z80, I was running a Z80 with bank-switched RAM. I still have my TP 1.0 manual, by the way. Insert link doesn't seem to be working, so: https://en.wikipedia.org/wiki/IMSAI_8080
  8. And mine too. North Star Horizon in a wooden case. I still have it.
  9. We have this nice CPU in common, but I wouldn't call it a PC at all
  10. David Heffernan

    10.4.1+ Custom Managed Records usable?

    Correct. But there are many possible ternary operators. It's the conditional operator, which is an example of a ternary operator.
  11. Stefan Glienke

    10.4.1+ Custom Managed Records usable?

    Not quite - this is the null coalescing operator ?: is a special version of the conditional operator - it is short for "if <expr> is not null then give <expr> else give <something_else>" Null propagation operator ?. is a special member access operator - short for "if <expr> is not null then access <expr>.<some_member> else do nothing or return null" Given that Delphi does not have a conditional operator I would assume that even though we might get language support for nullable types (reference types fall into that category) we don't get the null coalescing operator but chances are that we get a null propagation operator - but that is just me assuming things.
  12. Hafedh TRIMECHE

    Prevent OnClick to be handled twice

    It's already done: procedure TUButton.Click; begin FlushInput; if MilliSecondsBetween(Now,FLastClicked)<600 then Exit; FLastClicked := Now; inherited; end; No need to set a timer. Any click invoked within 600 milliseconds interval will be discarded. Thanks.
  13. He's one of the guys who tries to prevent Sourceforge from dying ;) Admittedly I forgot my SF password, since I haven't logged in for years.
  14. Vincent Parrett

    Image32 - 2D graphics library (open source freeware)

    Wow, this looks really good - and I have a use for it - in FinalBuilder we use a very old version of ImageEn to do image manipulation (resize, rotate, flip, mirror, convert file type etc) - unfortunately ImageEn is tied to the vcl so won't run in a docker container - I'm defintely going to try this. Pity it's not hosted on Github - would make forking, pull request etc so much easier 😉
  15. I sometimes wish I could call Delphi code in SQL style. Run(aText2='my text'); i.e. specify individual parameter(s) and leave the rest as their default.
  16. the worst I saw was 2,5k LOC to make a deep copy of the Form instead of creating new instance.
×