Goede morgen allemaal, ik probeer een firemonkey wrapper component voor LibVLC te gebruiken.
https://github.com/relativ/firemonkey-libvlc
Echter is dit in een oudere versie van delphi dan wel firemonkey gemaakt,
met name een aantal TBitmap veranderingen zorgen ervoor dat het niet onder recentere versies compileerd.
Ik hoop dat hier iemand mee leest die daar meer ervaring mee heeft.
( Om heel eerlijk te zijn, begrijp ik de hele werking van beneden beschreven functie(s) niet/niet goed. )
In het bestand: Serkan.VLCVideo.pas tref ik de volgende problemen:
TBitmap.StartLine
TBitmap.UpdateHandles
TBitmap.BitmapChanged
Voor zover ik het begrijp moeten bitmap bewerkingen op pixel niveau gedaan worden via
TBitmap.Map
("Use Map to get access to the data of the current bitmap. ")
("Data specifies the TBitmapData to which the data of the current bitmap is mapped.")
Het probleem is dat ik ik geen idee heb wat TBitmap.StartLine doet (deed)
ik heb geen versie van FMX.Types.TBitmap om dit op te zoeken.
Hopelijk kan iemand hier me wat meer inzicht geven in hoe dit op te lossen.
Bij voorbaad dank,
Jonathan Lourens
Code:
function TVLCVideo.Make3D(tBits: PAlphaColorArray): TBitmap;
const
red = 0.299;
green = 0.587;
blue = 0.114;
var
Bits,lBits, rBits: PAlphaColorArray;
w, h, x, y, i: Integer;
rLeft : integer;
gRight, bRight : integer;
alpha: integer;
lImg: TBitmap;
leftRed, leftBlue, iTmp: integer;
begin
h := Round(Height);
w := Round(Width);// MaxIntValue([lImg.Width, rImg.Width]);
GetMem(lBits, w*h*4);
FillChar(lBits^, w*h*4, 0);
CopyMemory(lBits, tBits, w*h*4);
GetMem(rBits, w*h*4);
FillChar(rBits^, w*h*4, 0);
CopyMemory(rBits, tBits, w*h*4);
lImg:= TBitmap.Create(w,h);
**Bits := lImg.StartLine; <=====================
try
i := 0;
iCutSize := 0;
for y := 0 to h-1 do
for x := 0 to w-1 do
begin
leftBlue := Round(((FTrimOut * 3) - leftRed) / 2) ;
leftRed := leftRed + 5;
iCutSize := MaxIntValue([iCutSize, leftRed]);
if F3DType = dOut then
begin
iTmp := leftBlue;
leftBlue := leftRed;
leftRed := iTmp;
end;
rLeft := (rBits[i + leftRed] shr 16) and $FF;
gRight := ((lBits[i + leftBlue] shr 8) and $FF); //right
bRight := lBits[i + leftBlue] and $FF; //right
alpha := (lBits[i + leftBlue] shr 24) and $FF; //right
** Bits[i+1] := ((alpha shl 24) or (rLeft shl 16) or (gRight shl 8) or bRight); <=====================
inc(i);
end;
finally
FreeMem(lBits);
FreeMem(rBits);
Result := lImg;
end;
end;
Code:
procedure TVLCVideo.Paint;
var
tbmp: TBitmap;
begin
inherited Paint;
if (CTX.FBuffer <> nil) and (CTX.bStart) then
begin
if ctx.Parent.Anaglyph3D then
begin
** tbmp := Make3D(CTX.FBuffer.StartLine); <=====================
Bitmap.Canvas.BeginScene;
Bitmap.Canvas.DrawBitmap(tbmp, RectF(0,0, tbmp.Width - iCutSize, tbmp.Height),
RectF(Position.X,Position.Y, Position.X + Width, Position.Y + Height), 1, true);
Bitmap.Canvas.EndScene;
end else begin
tbmp := TBitmap.Create(Round(Width),Round(Height));
** CopyMemory(tbmp.StartLine, CTX.FBuffer.StartLine, Round(Width)*Round(Height)*4); <=====================
Bitmap.Assign(tbmp);
end;
FreeAndNil(tbmp);
end;
end;
Code:
function VLCdisplay(opaque, picture: Pointer): pointer; cdecl;
var
ctx: TCTX;
begin
Result := nil;
if opaque <> nil then
begin
ctx := TCTX(opaque^);
** ctx.FBuffer.UpdateHandles; <=====================
** ctx.FBuffer.BitmapChanged; <=====================
ctx.bStart := true;
ctx.Parent.InvalidateRect(ctx.Parent.BoundsRect);
end;
end;
Code:
function VLCLock(opaque, plane: Pointer): Pointer; cdecl;
var
ctx: TCTX;
begin
mutexGraph.Enter;
ctx := TCTX(opaque^);
**Pointer(plane^) := @(ctx.FBuffer.StartLine[0]); <=====================
Result := nil;
end;
Bookmarks