This project has moved. For the latest updates, please go here.

calling from a console application

Jan 11, 2013 at 6:30 AM

 

Hi -

Can I call MjpegDecoder from a non-UI context (e.g., a console application)?

Thanks.

Coordinator
Jan 11, 2013 at 3:04 PM

It probably will not work in that scenario...the object expects a proper SynchronizationContext which wouldn't be available in a console mode app.

Jan 11, 2013 at 9:02 PM
Edited Jan 11, 2013 at 9:06 PM

 [earlier message got chopped off]

that is what i figured.

will the following hack of the source code work, or the dependencies are deeper?

replace statements like the following:

_context.Post(delegate { Error(this, new ErrorEventArgs() { Message = ex.Message }); }, null);

by:

if (_context == null) 
        Error (.......)
else  
      /* the original thing */

 

i made a similar change to the FrameReady event and things seem to be working. but one wonders ....

Coordinator
Jan 11, 2013 at 9:04 PM

Your message got chopped, but I think you were about to post the right thing.  Check if _context is null, and if it is, just call the event handler directly without the _context.Post() "wrapper".

Jan 11, 2013 at 9:07 PM

great, thanks. useful library.

Coordinator
Jan 11, 2013 at 9:08 PM

Sure thing.  I'll add it to my list of changes for the next version.