This project has moved and is read-only. For the latest updates, please go here.

calling from a console application

Jan 11, 2013 at 7:30 AM


Hi -

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


Jan 11, 2013 at 4: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 10:02 PM
Edited Jan 11, 2013 at 10: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);


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


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

Jan 11, 2013 at 10: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 10:07 PM

great, thanks. useful library.

Jan 11, 2013 at 10:08 PM

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