Skip to content

Instantly share code, notes, and snippets.

@pliablepixels
Last active December 24, 2016 01:05
Show Gist options
  • Save pliablepixels/ae7de9f52bf82b59835e9b0775ba0139 to your computer and use it in GitHub Desktop.
Save pliablepixels/ae7de9f52bf82b59835e9b0775ba0139 to your computer and use it in GitHub Desktop.
// create a dummy frame provider with the same dimensions as the original feed
Options options;
options.add( "width", IMG_W );
options.add( "height", IMG_H );
options.add( "pixelFormat", (PixelFormat)AV_PIX_FMT_RGB24 );
DummyInput dummyInput( "dummy", options );
app.addThread( &dummyInput );
// Instantiate a fallback class that looks for frames from "detector"
// and if none are received in 2 seconds, switches to dummy frames
InputFallback fallbackInput( "fallback", 2.0 );
fallbackInput.registerProvider( *detector );
fallbackInput.registerProvider( dummyInput );
app.addThread( &fallbackInput );
// connect HTTP renderer to fallbackInput
HttpController httpController( "http", 9292 );
httpController.addStream( "live",*input );
httpController.addStream( "detect", *detector );
httpController.addStream( "fallback", fallbackInput );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment