Nice thanks,
i'm trying with MediaFoundation but i have problem.
The video is visualized into a TImageEnView component using this code (from the demo app):
ImageEnView1.IO.MediaFoundationSourceReader.SelectMediaType(mmf_VIDEO_STREAM, 0);
ImageEnView1.IO.MediaFoundationSourceReader.VideoProcessor.SetMirror(mfpmHorizontal);
ImageEnView1.IO.MediaFoundationSourceReader.VideoProcessor.SetRotation(mfprNormal);
ImageEnView1.IO.MediaFoundationSourceReader.StartCapture();
When a button is clicked i need to get the current frame and visualize it into another TImageEnView component.
With DirectShow i use this code:
with ImageEnView1.IO.DShowParams do
begin
GetSample(ImageEnView1.IEBitmap);
ImageEnView1.Update;
frame.IEBitmap.Assign(ImageEnView1.IEBitmap); // Frame is a TImageEnView component
frame.IO.fParams.Assign(ImageEnView1.IO.fParams);
frame.Update;
modalresult := mrOk;
end;
I need to do the same thing with MediaFoundation. I have tryed with this code but i guess it's only valid if used inside the ImageEnView1MediaFoundationNotify event:
with ImageEnView1.IO.MediaFoundationSourceReader do
begin
sample := GetNextSample();
try
if sample.StreamType = mmf_VIDEO_STREAM then
begin
sample.DecodeSample(ImageEnView1.IEBitmap);
ImageEnView1.Update();
frame.IEBitmap.Assign(ImageEnView1.IEBitmap);
frame.IO.fParams.Assign(ImageEnView1.IO.fParams);
frame.Update;
modalresult := mrOk;
end;
finally
sample.Free();
end;
end;
sample.StreamType is empty so the code is not executed.
Is there a solution ?
thanks
Roberto Nicchi
Master Informatica
Italy