Skip to content

Framework for dynamic videoio backends, FFmpeg and GStreamer plugins#13677

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
mshabunin:video_plugins
Feb 26, 2019
Merged

Framework for dynamic videoio backends, FFmpeg and GStreamer plugins#13677
opencv-pushbot merged 1 commit intoopencv:masterfrom
mshabunin:video_plugins

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

@mshabunin mshabunin commented Jan 23, 2019

This pullrequest changes

Added ability to build plugins for videoio module. Implemented for two most popular backends: FFmpeg and GStreamer.

  • Defined C-interface for plugins
  • Added wrapper classes for dynamically loaded backends
  • Created cmake function for plugin creation
  • Created GStreamer plugin
    • minor cleanup, use logging
  • Created FFmpeg plugin
    • moved library initialization from static scope to first function call
  • Created script to build several configurations of plugins in Docker containers: ./opencv/modules/videoio/misc/build_plugins.sh <path-to-dst-dir> <cmake-build-config>
  • environment variables to control plugin search:
    • OPENCV_VIDEOIO_PLUGIN_PATH - list of directories to search for plugins (default is location of libopencv_videoio.so)
    • OPENCV_VIDEOIO_PLUGIN_NAME - glob expression to match plugin binaries (default is libopencv_videoio_*.so)
Public interfaces
  • core: added two utility functions (getBinLocation, getParent)
  • videoio: added one registry function (hasBackend + enum)
Tests
  • FFmpeg and GStreamer tests are always enabled, will be skipped if backend is not available
  • Refactored FFmpeg parallel test
  • Removed fourcc test
  • renamed all test cases: videoio_xxx.yyy
Other changes
  • Refactored videoio registry

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@mshabunin mshabunin force-pushed the video_plugins branch 2 times, most recently from 219e83d to 4447253 Compare February 1, 2019 10:04
{
Read,
Write,
ReadWrite
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camera?

}
catch (...)
{
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some logging message would be useful here.

and below for "catch (...)"

{
CV_LOG_INFO(NULL, "VIDEOIO: Disable backend: " << info.name);
const int env_priority2 = static_cast<int>(backendOrder.end() - backendPos - 1);
be.priority = 10000 + 1000 * env_priority2;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was:

info.priority = (int)(100000 + (names.size() - i) * 1000);

Most part of changes here doesn't look necessary to add plugin support.

{
info.priority = (int)param_priority;
enabled++;
Ptr<DynamicBackend> plugin = DynamicBackend::load(be.id, (int)be.mode);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not load plugins here.
Lets just assign priorities (keep old code).

At least, there is no way to bypass plugin loading via OPENCV_VIDEOIO_PRIORITY_XXX=0.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants