Question

I'm able to render a video from the file system using a TFilterGraph and a TVideoWindow within Delphi 2010. I'd like to render the video from a MemoryStream instead of directly from the file system. Here's the concept:

  1. Store the video in a database blob field.
  2. Read the blob (video) into a MemoryStream.
  3. Render the blob (video) using DSPack.

How do I tell the FilterGraph to use a MemoryStream instead of a file?

Was it helpful?

Solution

There's a working demo published on Ciuly's web corner answering the last part of your question: http://www.ciuly.com/delphi/multimedia/using-directshow-with-dspack-play-multimedia-content-from-stream/

As for the other two parts, loading to and reading from a database blob field:

//add a file stream to a blob field
MemoryStream:= TMemoryStream.Create;
try
  MemoryStream.LoadFromFile(VideoFileName);
  MemoryStream.Position:= 0;
  ClientDataSet1.Edit;
  ClientDataSet1YOURBLOBFIELD.LoadFromStream(MemoryStream);
  ClientDataSet1.Post;
finally
  MemoryStream.Free;
end;

//read a memory stream from a blob field
MemoryStream:= TMemoryStream.Create;
try
  ClientDataSet1YOURBLOBFIELD.SaveToStream(MemoryStream);
  MemoryStream.Position:= 0;
  //do your magic with the memory stream here
finally
  MemoryStream.Free;
end; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top