views:

33

answers:

2
HRESULT GrabberCB :: SampleCB ( double SampleTime , IMediaSample * pSample )   {      

How to send the pSample content via pipe?

}  

I know how to send/receive string by WriteFile/ReadFile after reading this sample:

http://msdn.microsoft.com/en-us/library/aa365592%28v=VS.85%29.aspx

But how to send a pSample over?

A: 

Why are you trying to send it on a pipe? It would be a lot easier if the pipe reader were a COM object instead and you just let the COM framework take care of everything. That being said, you can marshal a COM object into a stream (even out-of-process) with CoMarshalInterface; perhaps you could then send that stream across the pipe and reconstitute it with CoUnmarshalInterface.

Luke
A: 

You need to serialize your data before sending over any transport and at the other end you need to deserialize the data to convert it back. There are lots and lots of ways to do it depending on simple / complex your data is.

You could roll your own or use some sort of framework like Google Protocol Buffers or COM. There is no right answer, it all depends on what you are trying to do, how complex your data is and what sort of performance you require.

Shane Powell
@Shane Powell,Can you illustrate how `COM` can be used to do the job?
wamp
You just use the COM Framework to create server components that you use in the client. So the client just creates the server com class and calls it's methods. All the call / argument passing is doing all the marshaling for you. If you want the server component to notify the client of events, then you would use COM Connection Points (http://www.codeproject.com/KB/COM/connection.aspx) which are just callbacks. So you have to think of the solution in a different way than you would if using some sort of transportation pipe.
Shane Powell