2

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?

  • 1
    There is no stock DirectShow filter to do that, however there is a sample in Windows SDK that does a close thing. Not sure if DSPack has an equivalent available. – Roman R. Jan 06 '13 at 15:19

1 Answers1

2

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; 
TildalWave
  • 1,677
  • 1
  • 14
  • 20
  • It's an easy thing. The main problem is that you cannot convert memory stream into DirectShow pipeline using readily available components. – Roman R. Jan 06 '13 at 21:05
  • That's exactly what Ciuly's package I've linked to does. It's a set of components and accompanying tools written on top of DSPack extending it's capabilities using DirectShow API in a way that it will take a memory stream as an input instead of a file. – TildalWave Jan 10 '13 at 23:09
  • I looked at Ciuly's page but I can't make it work. Not sure if it's because installed the DSPack code from a different location than Ciuly's page or not. – Michael Riley - AKA Gunny Feb 21 '13 at 23:38
  • A bit late, but since I'm quoted with a "no working" problem, I felt like I should clarify. progdigy.com is down for quite some while now. No clue why. Sourceforge page is out of date and the google code page it refers to is also quite old (2010) and it has the exact same version I was using at the time of the referred demo (2.3.4 for posterity note). If there are problems, you most likely didn't do things properly (or you don't have the necessary directshow filters installed in order to be able to play the media file). But in order to fix it for you, I need more than "can't make it work" – ciuly Aug 14 '13 at 14:51