ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEMediaReader Error

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
wesleybobato Posted - Jan 18 2013 : 09:25:27
Hello Nigel Below is the code giving an error.
Invalid floating point operation at the Next Function.
TIEMediaReader.GetSample procedure (frame: int64; OutBitmap: TIEBitmap);
In this line fMediaDet.GetBitmapBits (frame / fFrameRate, nil, fFrameBuffer, fFrameWidth, fFrameHeight);
is because it is a division by zero 0.


var media:TIEMediaReader;
begin
media := TIEMediaReader.Create(ImageEnView1.IO.ExecuteOpenDialog);

// get frame 0 and save to sample0.jpeg
media.GetSample( 0, ImageEnView1.IEBitmap );
ImageEnView1.IO.SaveToFile('sample0.jpeg');

// get frame 1 and save to sample1.jpeg
media.GetSample( 1, ImageEnView1.IEBitmap );
ImageEnView1.IO.SaveToFile('sample1.jpeg');


media.free;
3   L A T E S T    R E P L I E S    (Newest First)
wesleybobato Posted - Jan 22 2013 : 13:32:01
Thank Fabricio a Big Hug
fab Posted - Jan 22 2013 : 10:41:41
With that fix you can use TIEMediaReader to add images in TImageEnMView:

var
  media: TIEMediaReader;
  bmp: TIEBitmap;
  idx: integer;
begin
  media := TIEMediaReader.Create('test.wmv');
  idx := ImageEnMView1.AppendImage(100, 100);
  bmp := ImageEnMView1.GetTIEBitmap(idx);
  media.GetSample(0, bmp);
  ImageEnMView1.ReleaseBitmap(idx);
  media.Free();
end;
fab Posted - Jan 22 2013 : 10:40:36
Actually TIEMediaReader has a bug. To fix it open ieds.pas and locate TIEMediaReader.GetSample method. Now replace it with:

procedure TIEMediaReader.GetSample(frame:int64; OutBitmap:TIEBitmap);
var
  bf: integer;
  frameBuffer: pointer;
begin
  fMediaDet.GetBitmapBits(frame / fFrameRate, @bf, nil, fFrameWidth, fFrameHeight);
  GetMem(frameBuffer, bf);
  try
    fMediaDet.GetBitmapBits(frame / fFrameRate, nil, frameBuffer, fFrameWidth, fFrameHeight);
    OutBitmap.CopyFromDIB(frameBuffer);
  finally
    freemem(frameBuffer);
  end;
end;


The complete fix will be available in next release.