File 0001-Compile-opencv-modules-in-C-mode.patch of Package vlc
From 64042b92fb6db79fb7ce8c2c64fa0bdd780eaaed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 19 Nov 2021 01:25:33 +0100
Subject: [PATCH] Compile opencv modules in C++ mode
OpenCV has not supported compiling in C mode for quite some
time, and also the remaining C API calls should be compiled in
C++ mode. With OpenCV 4, compiling in C mode is no longer
possible.
The opencv_example plugin is already compiled in C++ mode,
do the same for opencv_wrapper.
---
modules/video_filter/Makefile.am | 2 +-
.../{opencv_wrapper.c => opencv_wrapper.cpp} | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
rename modules/video_filter/{opencv_wrapper.c => opencv_wrapper.cpp} (98%)
diff --git a/modules/video_filter/Makefile.am b/modules/video_filter/Makefile.am
index af190d1..d1703a7 100644
--- a/modules/video_filter/Makefile.am
+++ b/modules/video_filter/Makefile.am
@@ -147,7 +147,7 @@ endif
libdeinterlace_plugin_la_LIBADD = libdeinterlace_common.la
video_filter_LTLIBRARIES += libdeinterlace_plugin.la
-libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.c
+libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.cpp
libopencv_wrapper_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENCV_CFLAGS)
libopencv_wrapper_plugin_la_LIBADD = $(OPENCV_LIBS)
libopencv_wrapper_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(video_filterdir)'
diff --git a/modules/video_filter/opencv_wrapper.c b/modules/video_filter/opencv_wrapper.cpp
similarity index 98%
rename from modules/video_filter/opencv_wrapper.c
rename to modules/video_filter/opencv_wrapper.cpp
index 525e55d..b202e9a 100644
--- a/modules/video_filter/opencv_wrapper.c
+++ b/modules/video_filter/opencv_wrapper.cpp
@@ -154,7 +154,7 @@ static int Create( vlc_object_t *p_this )
char *psz_chroma, *psz_output;
/* Allocate structure */
- p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
+ p_filter->p_sys = new filter_sys_t;
if( p_filter->p_sys == NULL )
return VLC_ENOMEM;
@@ -167,9 +167,9 @@ static int Create( vlc_object_t *p_this )
* We don't need to set up video formats for this filter as it not
* actually using a picture_t.
*/
- p_filter->p_sys->p_opencv = vlc_object_create( p_filter, sizeof(filter_t) );
+ p_filter->p_sys->p_opencv = static_cast<filter_t*>( vlc_object_create( p_filter, sizeof(filter_t) ) );
if( !p_filter->p_sys->p_opencv ) {
- free( p_filter->p_sys );
+ delete p_filter->p_sys;
return VLC_ENOMEM;
}
@@ -187,7 +187,7 @@ static int Create( vlc_object_t *p_this )
free( p_filter->p_sys->psz_inner_name );
p_filter->p_sys->psz_inner_name = NULL;
vlc_object_release( p_filter->p_sys->p_opencv );
- free( p_filter->p_sys );
+ delete p_filter->p_sys;
return VLC_ENOMOD;
}
@@ -273,7 +273,7 @@ static void Destroy( vlc_object_t *p_this )
vlc_object_release( p_filter->p_sys->p_opencv );
p_filter->p_sys->p_opencv = NULL;
- free( p_filter->p_sys );
+ delete p_filter->p_sys;
}
/*****************************************************************************
@@ -315,7 +315,7 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in )
{
int planes = p_in->i_planes; //num input video planes
// input video size
- CvSize sz = cvSize(abs(p_in->format.i_width), abs(p_in->format.i_height));
+ CvSize sz = cvSize(p_in->format.i_width, p_in->format.i_height);
video_format_t fmt_out;
filter_sys_t* p_sys = p_filter->p_sys;
--
2.33.1