Link to home
Start Free TrialLog in
Avatar of asymmetric
asymmetric

asked on

Delphi, DSPack, Directshow, and streaming video Part 1

This is the first part of a three-part question series.  I'll post the other parts after this.  They're related, but different enough to merit another topic and more points.  This question is worth 1000 points.  I'll drop the other 500 in another topic after I've chosen an answer.

Now, on to the question.  First the background.  I've been developing some webcam software for a while now, it's working quite well using the technologies in the question topic; Delphi 6 and DSPack (available at http://www.progdigy.com).  You can check it out at http://asym.macroshell.com/sc2

Ok, so if you've checked out the app, maybe given it a test-spin, or just looked at the screenshot, you know what it's about.  Directshow enabled webcam software, builds a filterchain (thanks to dspack) and captures stills.

I've been working on adding video capture/streaming for a while, and recently I gave TASFWriter a shot, which comes with the latest version of DSPack.  TASFWriter works almost well enough for me to use, it has built in support for capturing the stream to a .asf file, and serving it streams over the network to be viewed by windows media player.

  Question:

  I can't for the life of me figure out how to switch on/off the two modes of operation for TASFWriter.  By default, it captures to a file AND opens a socket for streaming video.  I need the option to do this as-is (archiving live shows I guess), but also options to disable the file creation, or disable the streaming.  Rarely will the user want to stream _and_ capture to a file.  Most often I imagine they'll only want to stream.  Occasionally they may want to capture to a file.  So far I've been unable to get anywhere with this.  The DSPack forums are nearly dead, and searching them resulted in one topic with a how-to that doesn't work, involving deleting the file writing filter and adding the network filter.

  Points go to whoever gives me a working method (with code examples, I'm a DSPack/Directshow newbie) to use TASFWriter but DISABLE it's file output.  That is, to force it to operate in a network-stream-only mode.  I will accept a decendant or derivative of the TASFWriter code if you can't figure out how to make it work as-is.  I don't know enough about COM to figure out where to even start with disabling this; I don't even know where the file writer is getting created.

  I'm also interested in disabling the network stream and doing file-only mode, but that's not nearly as important to me.  People can live with the socket being temporarily open I imagine, especially if I set it to one user maximum and have the program connect itself to tie up that user.  What they can't live with is running a streaming webcam for a few hours or days and being forced to endure a multi-hundred-megabyte .asf file created as a result.
ASKER CERTIFIED SOLUTION
Avatar of rietbergdj
rietbergdj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of asymmetric
asymmetric

ASKER

This looks like it's going to work out ok, I should really work on my COM skills.. :)

I'm almost ready to award you the points, but I do have a question related to this.

Can you see where DSPack is creating the file writer sink?  I'm guessing you may have already looked at this, but I think getting rid of the creation would stop even the zero byte file from being created.

The only downside I can see to this right now are cases where the media is somehow protected and I can't create a file, say if it's running from a CDROM, or if ACLs don't permit for whatever reason.

The problem is that it is not DSPack but the underlaying Microsoft COM object that automaticalyy creates the file..
So you can't really get at it..
I'll have another look at it before i'll start on the second question :-)

Regards,

Dj
Yeah, I thought it might be that.  I wonder if there's another COM object I could use instead of whatever this TASFWriter is wrapping; there must be a way to stream over the network without creating a file.

I'm guessing that object is also responsible for only taking the filename as a param instead of a file handle, which would've made things easier; I was hoping I could do something "tricky" like allocate some small amount of memory, turn it into a memory mapped file, and pass the handle off.. but no luck.

Another would be to use the UNC naming for the file and pass it something that references something other than a real disk file, but I haven't looked into this enough to determine if it's possible.

Anyway, thanks for the response, I look forward to seeing what you come up with for 2 and 3. ;)


The problem is that it is not DSPack but the underlaying Microsoft COM object that automaticalyy creates the file..
So you can't really get at it..
I'll have another look at it before i'll start on the second question :-)

Regards,

Dj
Oh, IServiceProvider is undefined for me.. what am I missing in my uses clause?

This looks very similar to a solution I found on the DSPack forums, but it didn't work out.  I'm going to give it a try though since yours is slightly different, maybe different enough for it to work. ;)

OOpps recommitted the same page...
I think you could connect the network sink to a standard filter maybe, i'll have a look.. problem is that you also lose the asf format that way...

Dj
Forgot about that, add "ActiveX, WMF9" to your uses clause.
Yeah, had WMF9 in there.. I did a filefind for IServiceProvider and found it in ActiveX.  It's working for me now with the 0-byte file.

I'll let this sit open for a little while longer to see if anyone else has suggestions to get rid of the file altogether, or to see if you come up with anything yourself.

Part 2 will be more fun if you haven't looked at it.. Part 3 is by far the most fun.. ;)
Have spent some more time on trying to get rid of the file, but short from having to write my own com filter, i don't think it is possible. I can see no way of linking the networksink to a filter, without it creating a file..

Dj
Yeah I wasn't able to find one either.  Sorry about the delay, monday morning I found the atx connector on my power supply melted to the motherboard.  Took some doing to get this thing back up and running.. heh.

I'll award you the points and drop another comment with a link to the other 500..

Think you're going to try your hand at part 2 or part 3? ;)