Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 08/19/21 in all areas

  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. Stefan Glienke

    10.4.1+ Custom Managed Records usable?

    IMO the only true way to do this in pascal is as they done in Oxygene - see "if expressions": https://docs.elementscompiler.com/Oxygene/Delphi/NewFeatures/
  3. Lars Fosdal

    What it's like to be a Delphi Developer

    Lots of good advice and my kind of humor, Joe! Great interview!
  4. Lars Fosdal

    upcoming language enhancements?

    It works for global vars, though. unit MiscTestMore; interface uses System.SysUtils; type TOutput = reference to procedure(const aText: string); TRec = record a: string; b: integer; end; const c_TRec: TRec = (a:'A'; b:1); // Works c_TRec2: TRec = (a:'A2'); var v_TRec: TRec = (a:'A3'; b:2); // Works v_TRec2: TRec = (a:'A4'); procedure RecordConstTest(const Output:TOutput); implementation function Fmt(const aTitle: string; const aRec: TRec):String; begin Result := Format('%s a:"%s" b:%d', [aTitle, aRec.a, aRec.b]); end; procedure RecordConstTest(const Output:TOutput); begin Output(Fmt('c_TRec ', c_TRec)); Output(Fmt('c_TRec2', c_TRec2)); Output(Fmt('v_TRec ', v_TRec)); Output(Fmt('v_TRec2', v_TRec2)); // var l_TRec1: TRec := (a:'A5'; b:3); // Fails // var l_TRec2: TRec := (a:'A6'); var l_TRec: TRec := v_TRec; // Works Output(Fmt('l_TRec ', l_TRec)); end; end. Output: c_TRec a:"A" b:1 c_TRec2 a:"A2" b:0 v_TRec a:"A3" b:2 v_TRec2 a:"A4" b:0 l_TRec a:"A3" b:2
  5. angusj

    SVG Library

    Image32 will happily convert SVG to PNG/BMP/JPEG. http://www.angusj.com/delphi/image32/Docs/Overview.htm http://www.angusj.com/delphi/image32/Docs/Units/Img32.Fmt.SVG/_Body.htm
  6. 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
  7. Remy Lebeau

    Handlin the message and returning value to the caller

    Yes, that will work fine. The VCL's internal WndProc that will first receive the message (StdWndProc() in System.Classes.pas) copies the tagMSG values to a local TMessage, then dispatches that TMessage to handlers, and then returns the TMessage.Result value back to the original sender.
  8. Stefan Glienke

    upcoming language enhancements?

    We know they never do that but rather hope they be ready when they ship which also as we know it not the case either.
×