1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #22706 from kallaballa:libavdevice_for_ffmpeg_v4l2

Introduce libavdevice to make v4l2 available to the ffmpeg backend

* introduce libavdevice to make v4l2 available to the ffmpeg backend

* downgrade the min required libavdevice version to 53.2.0

* make libavdevice optional

* create OCV_OPTION OPENCV_FFMPEG_ENABLE_LIBAVDEVICE and add definition through ocv_add_external_target

* move OCV_OPTION 'OPENCV_FFMPEG_ENABLE_LIBAVDEVICE' to detect_ffmpeg.cmake
This commit is contained in:
Amir Hassan
2022-11-11 23:28:02 +01:00
committed by GitHub
parent 1ba0984203
commit da4ac6b7ef
4 changed files with 31 additions and 1 deletions
+7
View File
@@ -95,6 +95,9 @@ extern "C" {
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#ifdef HAVE_FFMPEG_LIBAVDEVICE
#include <libavdevice/avdevice.h>
#endif
// https://github.com/FFmpeg/FFmpeg/blob/b6af56c034759b81985f8ea094e41cbd5f7fecfb/doc/APIchanges#L602-L605
#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(58, 9, 100)
@@ -625,6 +628,10 @@ struct CvCapture_FFMPEG
void CvCapture_FFMPEG::init()
{
#ifdef HAVE_FFMPEG_LIBAVDEVICE
//libavdevice is available, so let's register all input and output devices (e.g v4l2)
avdevice_register_all();
#endif
ic = 0;
video_stream = -1;
video_st = 0;