Accepting request 79172 from KDE:Distro:Factory

- Fix support for new ffmpeg versions (forwarded request 79166 from RedDwarf)

OBS-URL: https://build.opensuse.org/request/show/79172
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/opencv?expand=0&rev=19
This commit is contained in:
Sascha Peilicke 2011-08-18 07:52:40 +00:00 committed by Git OBS Bridge
parent 28d69f5c73
commit 466f78fd71
14 changed files with 479 additions and 301 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:259982293db9e1e73dca2ca909fc332ac923bec64578a657d8bb8ab6ccdeb88e
size 19800873

3
OpenCV-2.3.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcbfff0ff767f0cf2523707a307a5fd0db4853c19c3498f322c8c5839429940b
size 42849210

View File

@ -1,12 +0,0 @@
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -403,6 +403,7 @@ if(UNIX)
endif()
if(WITH_V4L)
CHECK_MODULE(libv4l1 HAVE_LIBV4L)
+ CHECK_MODULE(libv4l2 HAVE_LIBV4L2)
CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L)
CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
else()

View File

@ -1,11 +0,0 @@
diff -urN OpenCV-2.2.0-orig/modules/core/include/opencv2/core/core.hpp OpenCV-2.2.0/modules/core/include/opencv2/core/core.hpp
--- OpenCV-2.2.0-orig/modules/core/include/opencv2/core/core.hpp 2010-12-05 05:35:24.000000000 +0200
+++ OpenCV-2.2.0/modules/core/include/opencv2/core/core.hpp 2010-12-23 19:47:11.414816501 +0200
@@ -56,6 +56,7 @@
#include <algorithm>
#include <cmath>
#include <complex>
+#include <cstddef>
#include <map>
#include <new>
#include <string>

View File

@ -1,112 +0,0 @@
diff -urN OpenCV-2.2.0-orig/CMakeLists.txt OpenCV-2.2.0/CMakeLists.txt
--- OpenCV-2.2.0-orig/CMakeLists.txt 2010-12-05 05:35:23.000000000 +0200
+++ OpenCV-2.2.0/CMakeLists.txt 2010-12-23 16:53:04.711067058 +0200
@@ -513,8 +513,8 @@
string(REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
if(UNIX)
- set(PYTHON_PLUGIN_INSTALL_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
- set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages)
+ set(PYTHON_PLUGIN_INSTALL_PATH lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
+ set(PYTHON_PACKAGES_PATH lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages)
endif()
if(WIN32)
get_filename_component(PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE)
@@ -1066,7 +1066,7 @@
# PROCESS SUBDIRECTORIES:
# ----------------------------------------------------------------------------
# Save libs and executables in the same place
-set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
+set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX} CACHE PATH "Output directory for libraries" )
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
if(WIN32)
@@ -1159,19 +1159,19 @@
# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
# prefix=/usr
# exec_prefix=${prefix}
-# libdir=${exec_prefix}/lib
+# libdir=${exec_prefix}/lib${LIB_SUFFIX}
# includedir=${prefix}/include/opencv
# -------------------------------------------------------------------------------------------
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
-set(libdir "\${exec_prefix}/lib")
+set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
set(includedir "\${prefix}/include")
set(VERSION ${OPENCV_VERSION})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/opencv.pc" @ONLY IMMEDIATE)
if(UNIX)
- install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib/pkgconfig)
+ install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
endif()
diff -urN OpenCV-2.2.0-orig/modules/ffmpeg/CMakeLists.txt OpenCV-2.2.0/modules/ffmpeg/CMakeLists.txt
--- OpenCV-2.2.0-orig/modules/ffmpeg/CMakeLists.txt 2010-12-05 05:35:24.000000000 +0200
+++ OpenCV-2.2.0/modules/ffmpeg/CMakeLists.txt 2010-12-23 16:45:06.579817385 +0200
@@ -49,6 +49,6 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
)
diff -urN OpenCV-2.2.0-orig/modules/gpu/CMakeLists.txt OpenCV-2.2.0/modules/gpu/CMakeLists.txt
--- OpenCV-2.2.0-orig/modules/gpu/CMakeLists.txt 2010-12-05 05:35:24.000000000 +0200
+++ OpenCV-2.2.0/modules/gpu/CMakeLists.txt 2010-12-23 16:44:43.283817489 +0200
@@ -124,8 +124,8 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
install(FILES ${lib_hdrs}
DESTINATION include/opencv2/${name}
diff -urN OpenCV-2.2.0-orig/modules/highgui/CMakeLists.txt OpenCV-2.2.0/modules/highgui/CMakeLists.txt
--- OpenCV-2.2.0-orig/modules/highgui/CMakeLists.txt 2010-12-05 05:35:24.000000000 +0200
+++ OpenCV-2.2.0/modules/highgui/CMakeLists.txt 2010-12-23 16:44:15.164942364 +0200
@@ -302,8 +302,8 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
install(FILES ${highgui_ext_hdrs}
DESTINATION include/opencv2/highgui
diff -urN OpenCV-2.2.0-orig/OpenCVModule.cmake OpenCV-2.2.0/OpenCVModule.cmake
--- OpenCV-2.2.0-orig/OpenCVModule.cmake 2010-12-05 05:35:25.000000000 +0200
+++ OpenCV-2.2.0/OpenCVModule.cmake 2010-12-23 16:42:56.638817731 +0200
@@ -75,8 +75,8 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
install(FILES ${lib_hdrs}
DESTINATION include/opencv2/${name}
diff -urN OpenCV-2.2.0-orig/tests/cxts/CMakeLists.txt OpenCV-2.2.0/tests/cxts/CMakeLists.txt
--- OpenCV-2.2.0-orig/tests/cxts/CMakeLists.txt 2010-12-05 05:35:25.000000000 +0200
+++ OpenCV-2.2.0/tests/cxts/CMakeLists.txt 2010-12-23 16:45:22.049817386 +0200
@@ -64,6 +64,6 @@
if(WIN32)
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
endif()

View File

@ -1,46 +0,0 @@
diff -urN OpenCV-2.2.0-orig/CMakeLists.txt OpenCV-2.2.0/CMakeLists.txt
--- OpenCV-2.2.0-orig/CMakeLists.txt 2010-12-05 05:35:23.000000000 +0200
+++ OpenCV-2.2.0/CMakeLists.txt 2010-12-23 18:39:50.649066635 +0200
@@ -1261,7 +1261,7 @@
add_subdirectory(doc)
add_subdirectory(data)
-if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
+if(BUILD_EXAMPLES OR INSTALL_C_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
add_subdirectory(samples)
endif()
diff -urN OpenCV-2.2.0-orig/samples/CMakeLists.txt OpenCV-2.2.0/samples/CMakeLists.txt
--- OpenCV-2.2.0-orig/samples/CMakeLists.txt 2010-12-05 05:35:25.000000000 +0200
+++ OpenCV-2.2.0/samples/CMakeLists.txt 2010-12-23 18:40:44.308817679 +0200
@@ -3,9 +3,14 @@
#
# ----------------------------------------------------------------------------
+if(BUILD_EXAMPLES OR INSTALL_C_EXAMPLES)
add_subdirectory(c)
add_subdirectory(cpp)
add_subdirectory(gpu)
+endif()
+if(INSTALL_PYTHON_EXAMPLES AND BUILD_NEW_PYTHON_SUPPORT)
+add_subdirectory(python)
+endif()
if(0)
add_subdirectory(swig_python)
diff -urN OpenCV-2.2.0-orig/samples/python/CMakeLists.txt OpenCV-2.2.0/samples/python/CMakeLists.txt
--- OpenCV-2.2.0-orig/samples/python/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
+++ OpenCV-2.2.0/samples/python/CMakeLists.txt 2010-12-23 18:41:18.875942736 +0200
@@ -0,0 +1,12 @@
+# -------------------------------------------------------------------------
+# CMake file for Python samples. See root CMakeLists.txt
+# -------------------------------------------------------------------------
+
+file(GLOB PYTHON_SAMPLES *.py)
+if(NOT WIN32)
+install(FILES ${PYTHON_SAMPLES}
+ DESTINATION share/opencv/samples/python
+ PERMISSIONS OWNER_READ OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE)
+endif()

View File

@ -1,66 +0,0 @@
diff -urN OpenCV-2.2.0-orig/3rdparty/CMakeLists.txt OpenCV-2.2.0/3rdparty/CMakeLists.txt
--- OpenCV-2.2.0-orig/3rdparty/CMakeLists.txt 2010-12-05 05:35:23.000000000 +0200
+++ OpenCV-2.2.0/3rdparty/CMakeLists.txt 2010-12-27 23:34:49.000000000 +0200
@@ -3,7 +3,6 @@
endif()
add_subdirectory(lapack)
-add_subdirectory(zlib)
if(WITH_JASPER AND NOT JASPER_FOUND)
add_subdirectory(libjasper)
endif()
diff -urN OpenCV-2.2.0-orig/modules/core/CMakeLists.txt OpenCV-2.2.0/modules/core/CMakeLists.txt
--- OpenCV-2.2.0-orig/modules/core/CMakeLists.txt 2010-12-05 05:35:24.000000000 +0200
+++ OpenCV-2.2.0/modules/core/CMakeLists.txt 2010-12-27 23:34:49.000000000 +0200
@@ -1,3 +1,3 @@
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")
-set(deps opencv_lapack zlib)
+set(deps opencv_lapack z)
define_opencv_module(core ${deps})
diff -urN OpenCV-2.2.0-orig/modules/highgui/CMakeLists.txt OpenCV-2.2.0/modules/highgui/CMakeLists.txt
--- OpenCV-2.2.0-orig/modules/highgui/CMakeLists.txt 2010-12-05 05:35:24.000000000 +0200
+++ OpenCV-2.2.0/modules/highgui/CMakeLists.txt 2010-12-27 23:34:49.000000000 +0200
@@ -276,8 +276,8 @@
endif()
if(WITH_PNG AND NOT PNG_FOUND)
- add_dependencies(${the_target} libpng zlib)
- #target_link_libraries(${the_target} libpng zlib)
+ add_dependencies(${the_target} libpng z)
+ #target_link_libraries(${the_target} libpng z)
endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
@@ -285,7 +285,7 @@
#target_link_libraries(${the_target} libtiff)
endif()
-target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc zlib ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES} ${OPENEXR_LIBRARIES})
+target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc z ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES} ${OPENEXR_LIBRARIES})
if(APPLE)
target_link_libraries(${the_target} "-lbz2 -framework Cocoa -framework QuartzCore")
diff -urN OpenCV-2.2.0-orig/OpenCVConfig.cmake.in OpenCV-2.2.0/OpenCVConfig.cmake.in
--- OpenCV-2.2.0-orig/OpenCVConfig.cmake.in 2010-12-05 05:35:25.000000000 +0200
+++ OpenCV-2.2.0/OpenCVConfig.cmake.in 2010-12-27 23:35:08.000000000 +0200
@@ -91,7 +91,7 @@
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS})
- set(OPENCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ zlib opencv_lapack)
+ set(OPENCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ z opencv_lapack)
if (CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 4)
foreach(__EXTRA_LIB ${OPENCV_EXTRA_COMPONENTS})
diff -urN OpenCV-2.2.0-orig/OpenCVFindOpenEXR.cmake OpenCV-2.2.0/OpenCVFindOpenEXR.cmake
--- OpenCV-2.2.0-orig/OpenCVFindOpenEXR.cmake 2010-12-05 05:35:25.000000000 +0200
+++ OpenCV-2.2.0/OpenCVFindOpenEXR.cmake 2010-12-27 23:34:49.000000000 +0200
@@ -44,7 +44,7 @@
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
SET(OPENEXR_FOUND TRUE)
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
- SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} zlib CACHE STRING "The libraries needed to use OpenEXR")
+ SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} z CACHE STRING "The libraries needed to use OpenEXR")
ENDIF ()
IF(OPENEXR_FOUND)

23
opencv-2.3-cmake.patch Normal file
View File

@ -0,0 +1,23 @@
diff -urN OpenCV-2.3.0-orig/CMakeLists.txt OpenCV-2.3.0/CMakeLists.txt
--- OpenCV-2.3.0-orig/CMakeLists.txt 2011-07-04 07:21:50.000000000 +0300
+++ OpenCV-2.3.0/CMakeLists.txt 2011-08-14 03:02:57.072585001 +0300
@@ -845,8 +845,8 @@
message(STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}")
else()
- unset(CUDA_ARCH_BIN CACHE)
- unset(CUDA_ARCH_PTX CACHE)
+ set(CUDA_ARCH_BIN)
+ set(CUDA_ARCH_PTX)
endif()
endif()
@@ -1422,7 +1422,7 @@
# Solution folders:
#-----------------------------------
-if(${CMAKE_VERSION} VERSION_GREATER "2.8.0")
+if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.8)
set(ENABLE_SOLUTION_FOLDERS OFF CACHE BOOL "Solution folder in Visual Studio or in other IDEs")
endif()

249
opencv-2.3-ffmpeg.patch Normal file
View File

@ -0,0 +1,249 @@
Index: modules/highgui/include/opencv2/highgui/highgui_c.h
===================================================================
--- modules/highgui/include/opencv2/highgui/highgui_c.h.orig
+++ modules/highgui/include/opencv2/highgui/highgui_c.h
@@ -367,8 +367,10 @@ enum
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION_ON,
// Properties of cameras available through GStreamer interface
- CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1
- CV_CAP_PROP_PVAPI_MULTICASTIP = 300 // ip for anable multicast master mode. 0 for disable multicast
+ CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1
+ CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast
+
+ CV_CAP_PROP_THREADS = 400
};
enum
Index: modules/highgui/src/cap_ffmpeg_api.hpp
===================================================================
--- modules/highgui/src/cap_ffmpeg_api.hpp.orig
+++ modules/highgui/src/cap_ffmpeg_api.hpp
@@ -21,7 +21,8 @@ enum
CV_FFMPEG_CAP_PROP_FRAME_HEIGHT=4,
CV_FFMPEG_CAP_PROP_FPS=5,
CV_FFMPEG_CAP_PROP_FOURCC=6,
- CV_FFMPEG_CAP_PROP_FRAME_COUNT=7
+ CV_FFMPEG_CAP_PROP_FRAME_COUNT=7,
+ CV_FFMPEG_CAP_PROP_THREADS=8
};
Index: modules/highgui/src/cap_ffmpeg_impl.hpp
===================================================================
--- modules/highgui/src/cap_ffmpeg_impl.hpp.orig
+++ modules/highgui/src/cap_ffmpeg_impl.hpp
@@ -135,7 +135,7 @@ extern "C" {
#define PIX_FMT_RGBA32 PIX_FMT_RGB32
#endif
-
+#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
char * FOURCC2str( int fourcc )
{
@@ -365,6 +365,7 @@ struct CvCapture_FFMPEG
and so the filename is needed to reopen the file on backward seeking.
*/
char * filename;
+ int count_threads;
};
@@ -379,6 +380,7 @@ void CvCapture_FFMPEG::init()
memset( &frame, 0, sizeof(frame) );
filename = 0;
packet.data = NULL;
+ count_threads = 1;
#if defined(HAVE_FFMPEG_SWSCALE)
img_convert_ctx = 0;
#endif
@@ -444,6 +446,9 @@ bool CvCapture_FFMPEG::reopen()
#else
AVCodecContext *enc = &ic->streams[video_stream]->codec;
#endif
+
+ avcodec_thread_init(enc, count_threads);
+
AVCodec *codec = avcodec_find_decoder(enc->codec_id);
avcodec_open(enc, codec);
video_st = ic->streams[video_stream];
@@ -489,7 +494,13 @@ bool CvCapture_FFMPEG::open( const char*
AVCodecContext *enc = &ic->streams[i]->codec;
#endif
- if( CODEC_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
+ avcodec_thread_init(enc, count_threads);
+
+ #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 4, 0)
+ #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+ #endif
+
+ if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
AVCodec *codec = avcodec_find_decoder(enc->codec_id);
if (!codec ||
avcodec_open(enc, codec) < 0)
@@ -576,14 +587,18 @@ bool CvCapture_FFMPEG::grabFrame()
continue;
}
-#if LIBAVFORMAT_BUILD > 4628
- avcodec_decode_video(video_st->codec,
- picture, &got_picture,
- packet.data, packet.size);
-#else
- avcodec_decode_video(&video_st->codec,
- picture, &got_picture,
- packet.data, packet.size);
+#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 4, 0)
+ avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet);
+#else
+ #if LIBAVFORMAT_BUILD > 4628
+ avcodec_decode_video(video_st->codec,
+ picture, &got_picture,
+ packet.data, packet.size);
+ #else
+ avcodec_decode_video(&video_st->codec,
+ picture, &got_picture,
+ packet.data, packet.size);
+ #endif
#endif
if (got_picture) {
@@ -702,12 +717,14 @@ double CvCapture_FFMPEG::getProperty( in
return (double)video_st->codec.codec_tag;
#endif
break;
+ case CV_CAP_PROP_THREADS:
+ return count_threads;
+ break;
}
+
return 0;
}
-
-
// this is a VERY slow fallback function, ONLY used if ffmpeg's av_seek_frame delivers no correct result!
bool CvCapture_FFMPEG::slowSeek( int framenumber )
{
@@ -787,6 +804,12 @@ bool CvCapture_FFMPEG::setProperty( int
picture_pts=(int64_t)value;
}
break;
+
+ case CV_CAP_PROP_THREADS:
+ {
+ count_threads = (int)value;
+ }
+ break;
default:
return false;
@@ -824,6 +847,38 @@ struct CvVideoWriter_FFMPEG
static const char * icvFFMPEGErrStr(int err)
{
+#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 4, 0)
+ switch(err) {
+ case AVERROR_BSF_NOT_FOUND:
+ return "Bitstream filter not found";
+ case AVERROR_DECODER_NOT_FOUND:
+ return "Decoder not found";
+ case AVERROR_DEMUXER_NOT_FOUND:
+ return "Demuxer not found";
+ case AVERROR_ENCODER_NOT_FOUND:
+ return "Encoder not found";
+ case AVERROR_EOF:
+ return "End of file";
+ case AVERROR_EXIT:
+ return "Immediate exit was requested; the called function should not be restarted";
+ case AVERROR_FILTER_NOT_FOUND:
+ return "Filter not found";
+ case AVERROR_INVALIDDATA:
+ return "Invalid data found when processing input";
+ case AVERROR_MUXER_NOT_FOUND:
+ return "Muxer not found";
+ case AVERROR_OPTION_NOT_FOUND:
+ return "Option not found";
+ case AVERROR_PATCHWELCOME:
+ return "Not yet implemented in FFmpeg, patches welcome";
+ case AVERROR_PROTOCOL_NOT_FOUND:
+ return "Protocol not found";
+ case AVERROR_STREAM_NOT_FOUND:
+ return "Stream not found";
+ default:
+ break;
+ }
+#else
switch(err) {
case AVERROR_NUMEXPECTED:
return "Incorrect filename syntax";
@@ -838,7 +893,9 @@ static const char * icvFFMPEGErrStr(int
default:
break;
}
- return "Unspecified error";
+#endif
+
+ return "Unspecified error";
}
/* function internal to FFMPEG (libavformat/riff.c) to lookup codec id by fourcc tag*/
@@ -918,7 +975,7 @@ static AVStream *icv_add_video_stream_FF
#endif
#if LIBAVFORMAT_BUILD > 4621
- c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
+ c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
#else
c->codec_id = oc->oformat->video_codec;
#endif
@@ -930,7 +987,7 @@ static AVStream *icv_add_video_stream_FF
//if(codec_tag) c->codec_tag=codec_tag;
codec = avcodec_find_encoder(c->codec_id);
- c->codec_type = CODEC_TYPE_VIDEO;
+ c->codec_type = AVMEDIA_TYPE_VIDEO;
/* put sample parameters */
c->bit_rate = bitrate;
@@ -1015,7 +1072,11 @@ int icv_av_write_frame_FFMPEG( AVFormatC
AVPacket pkt;
av_init_packet(&pkt);
- pkt.flags |= PKT_FLAG_KEY;
+ #ifndef PKT_FLAG_KEY
+ #define PKT_FLAG_KEY AV_PKT_FLAG_KEY
+ #endif
+
+ pkt.flags |= PKT_FLAG_KEY;
pkt.stream_index= video_st->index;
pkt.data= (uint8_t *)picture;
pkt.size= sizeof(AVPicture);
@@ -1237,7 +1298,13 @@ bool CvVideoWriter_FFMPEG::open( const c
av_register_all ();
/* auto detect the output format from the name and fourcc code. */
+
+#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 4, 0)
+ fmt = av_guess_format(NULL, filename, NULL);
+#else
fmt = guess_format(NULL, filename, NULL);
+#endif
+
if (!fmt)
return false;
@@ -1260,7 +1327,11 @@ bool CvVideoWriter_FFMPEG::open( const c
#endif
// alloc memory for context
+#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 4, 0)
+ oc = avformat_alloc_context();
+#else
oc = av_alloc_format_context();
+#endif
assert (oc);
/* set file name */

93
opencv-2.3-libdir.patch Normal file
View File

@ -0,0 +1,93 @@
diff -urN OpenCV-2.3.0-orig/CMakeLists.txt OpenCV-2.3.0/CMakeLists.txt
--- OpenCV-2.3.0-orig/CMakeLists.txt 2011-07-04 07:21:50.000000000 +0300
+++ OpenCV-2.3.0/CMakeLists.txt 2011-08-12 17:50:13.803976563 +0300
@@ -619,11 +619,11 @@
string(REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
if(UNIX)
- set(PYTHON_PLUGIN_INSTALL_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
+ set(PYTHON_PLUGIN_INSTALL_PATH lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages/opencv)
if(APPLE)
- set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages CACHE PATH "Where to install the python packages.")
- else() #debian based assumed, install to the dist-packages.
- set(PYTHON_PACKAGES_PATH lib/python${PYTHON_VERSION_MAJOR_MINOR}/dist-packages CACHE PATH "Where to install the python packages.")
+ set(PYTHON_PACKAGES_PATH lib%{LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages CACHE PATH "Where to install the python packages.")
+ else()
+ set(PYTHON_PACKAGES_PATH lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages CACHE PATH "Where to install the python packages.")
endif()
endif()
if(WIN32)
@@ -1191,7 +1191,7 @@
# PROCESS SUBDIRECTORIES:
# ----------------------------------------------------------------------------
# Save libs and executables in the same place
-set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
+set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX} CACHE PATH "Output directory for libraries" )
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
if(WIN32)
@@ -1322,19 +1322,19 @@
# Part 2/2: ${BIN_DIR}/unix-install/opencv.pc -> For use *with* "make install"
# prefix=/usr
# exec_prefix=${prefix}
-# libdir=${exec_prefix}/lib
+# libdir=${exec_prefix}/lib${LIB_SUFFIX}
# includedir=${prefix}/include/opencv
# -------------------------------------------------------------------------------------------
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
-set(libdir "\${exec_prefix}/lib")
+set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
set(includedir "\${prefix}/include")
set(VERSION ${OPENCV_VERSION})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/opencv.pc" @ONLY IMMEDIATE)
if(UNIX)
- install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib/pkgconfig)
+ install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
endif()
diff -urN OpenCV-2.3.0-orig/modules/gpu/CMakeLists.txt OpenCV-2.3.0/modules/gpu/CMakeLists.txt
--- OpenCV-2.3.0-orig/modules/gpu/CMakeLists.txt 2011-07-04 07:21:58.000000000 +0300
+++ OpenCV-2.3.0/modules/gpu/CMakeLists.txt 2011-08-12 17:49:54.058784260 +0300
@@ -149,8 +149,8 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
install(FILES ${lib_hdrs}
DESTINATION include/opencv2/${name}
diff -urN OpenCV-2.3.0-orig/modules/highgui/CMakeLists.txt OpenCV-2.3.0/modules/highgui/CMakeLists.txt
--- OpenCV-2.3.0-orig/modules/highgui/CMakeLists.txt 2011-07-04 07:21:58.000000000 +0300
+++ OpenCV-2.3.0/modules/highgui/CMakeLists.txt 2011-08-12 17:49:54.058784260 +0300
@@ -362,8 +362,8 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
install(FILES ${highgui_ext_hdrs}
DESTINATION include/opencv2/highgui
diff -urN OpenCV-2.3.0-orig/OpenCVModule.cmake OpenCV-2.3.0/OpenCVModule.cmake
--- OpenCV-2.3.0-orig/OpenCVModule.cmake 2011-07-04 07:21:59.000000000 +0300
+++ OpenCV-2.3.0/OpenCVModule.cmake 2011-08-12 17:49:54.058784260 +0300
@@ -97,8 +97,8 @@
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
- LIBRARY DESTINATION lib COMPONENT main
- ARCHIVE DESTINATION lib COMPONENT main)
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT main
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT main)
install(FILES ${lib_hdrs}
DESTINATION include/opencv2/${name}

63
opencv-2.3-samples.patch Normal file
View File

@ -0,0 +1,63 @@
diff -urN OpenCV-2.3.0-orig/CMakeLists.txt OpenCV-2.3.0/CMakeLists.txt
--- OpenCV-2.3.0-orig/CMakeLists.txt 2011-07-04 07:21:50.000000000 +0300
+++ OpenCV-2.3.0/CMakeLists.txt 2011-08-12 18:02:28.672630556 +0300
@@ -1439,7 +1439,7 @@
add_subdirectory(doc)
add_subdirectory(data)
-if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
+if(BUILD_EXAMPLES OR INSTALL_C_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
add_subdirectory(samples)
endif()
diff -urN OpenCV-2.3.0-orig/samples/CMakeLists.txt OpenCV-2.3.0/samples/CMakeLists.txt
--- OpenCV-2.3.0-orig/samples/CMakeLists.txt 2011-07-04 07:22:00.000000000 +0300
+++ OpenCV-2.3.0/samples/CMakeLists.txt 2011-08-12 18:03:13.638254532 +0300
@@ -3,9 +3,15 @@
#
# ----------------------------------------------------------------------------
+if(BUILD_EXAMPLES OR INSTALL_C_EXAMPLES)
add_subdirectory(c)
add_subdirectory(cpp)
add_subdirectory(gpu)
+endif()
+if(INSTALL_PYTHON_EXAMPLES AND BUILD_NEW_PYTHON_SUPPORT)
+add_subdirectory(python)
+add_subdirectory(python2)
+endif()
if(0)
add_subdirectory(swig_python)
diff -urN OpenCV-2.3.0-orig/samples/python/CMakeLists.txt OpenCV-2.3.0/samples/python/CMakeLists.txt
--- OpenCV-2.3.0-orig/samples/python/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
+++ OpenCV-2.3.0/samples/python/CMakeLists.txt 2011-08-12 18:02:28.672630556 +0300
@@ -0,0 +1,12 @@
+# -------------------------------------------------------------------------
+# CMake file for Python samples. See root CMakeLists.txt
+# -------------------------------------------------------------------------
+
+file(GLOB PYTHON_SAMPLES *.py)
+if(NOT WIN32)
+install(FILES ${PYTHON_SAMPLES}
+ DESTINATION share/opencv/samples/python
+ PERMISSIONS OWNER_READ OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE)
+endif()
diff -urN OpenCV-2.3.0-orig/samples/python2/CMakeLists.txt OpenCV-2.3.0/samples/python2/CMakeLists.txt
--- OpenCV-2.3.0-orig/samples/python2/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
+++ OpenCV-2.3.0/samples/python2/CMakeLists.txt 2011-08-12 18:03:54.701431832 +0300
@@ -0,0 +1,12 @@
+# -------------------------------------------------------------------------
+# CMake file for Python samples. See root CMakeLists.txt
+# -------------------------------------------------------------------------
+
+file(GLOB PYTHON_SAMPLES *.py)
+if(NOT WIN32)
+install(FILES ${PYTHON_SAMPLES}
+ DESTINATION share/opencv/samples/python2
+ PERMISSIONS OWNER_READ OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE)
+endif()

View File

@ -1,33 +0,0 @@
diff -up OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp.nov4l1 OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp
--- OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp.nov4l1 2010-12-05 11:35:25.000000000 +0800
+++ OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp 2011-04-18 10:40:01.984950054 +0800
@@ -214,7 +214,7 @@
#include <sys/types.h>
#include <sys/mman.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include <string.h>
#include <stdlib.h>
diff -up OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp.nov4l1 OpenCV-2.2.0/modules/highgui/src/cap_libv4l.cpp.cpp
--- OpenCV-2.2.0/modules/highgui/src/cap_libv4l.cpp.nov4l1 2010-12-05 11:35:25.000000000 +0800
+++ OpenCV-2.2.0/modules/highgui/src/cap_libv4l.cpp 2011-04-18 10:39:07.568578185 +0800
@@ -224,7 +224,7 @@
#include "highgui.h"
#include "precomp.hpp"
-#if !defined WIN32 && defined HAVE_CAMV4L && defined HAVE_CAMV4L2
+#if !defined WIN32 && defined HAVE_CAMV4L2
#define CLEAR(x) memset (&(x), 0, sizeof (x))
@@ -241,7 +241,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include <linux/videodev2.h>
#include <libv4l1.h>

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Wed Aug 17 20:19:05 UTC 2011 - reddwarf@opensuse.org
- Fix support for new ffmpeg versions
-------------------------------------------------------------------
Sun Aug 14 01:44:47 EEST 2011 - koprok@nand.bg
- Removed unnecessary patches
- Enable Python NumPy support on openSUSE 11.2
- Build Qt instead of Gtk GUI
- Fix cmake files for openSUSE 11.1
- No GStreamer support on openSUSE 11.1
-------------------------------------------------------------------
Fri Aug 12 17:37:30 EEST 2011 - koprok@nand.bg
- Update to OpenCV 2.3.0.
More info at:
http://opencv.willowgarage.com/wiki/OpenCV%20Change%20Logs
-------------------------------------------------------------------
Wed Aug 3 00:36:36 EEST 2011 - koprok@nand.bg
- Fix build on openSUSE 11.2
-------------------------------------------------------------------
Wed Jul 6 08:23:04 UTC 2011 - idonmez@novell.com

View File

@ -20,23 +20,22 @@
Name: opencv
%define libname lib%{name}
%define soname 2_2
Version: 2.2.0
%define soname 2_3
Version: 2.3.0
Release: 12
License: BSD3c
Summary: Collection of algorithms for computer vision
Url: http://%{name}.willowgarage.com/wiki/
Group: Development/Libraries
Source0: http://downloads.sourceforge.net/project/%{name}library/%{name}-unix/2.2/OpenCV-%{version}.tar.bz2
Patch0: %{name}-2.2-libdir.patch
Patch1: %{name}-2.2-samples.patch
Patch3: %{name}-2.1-underlinking.patch
Patch4: %{name}-2.2-gcc46.patch
Patch5: %{name}-2.2-zlib.patch
# PATCH-FIX-UPSTREAM opencv-v4l-2.6.38.patch idoenmez@suse.de -- Fix libv4l2 support
Patch6: opencv-v4l-2.6.38.patch
Source0: http://downloads.sourceforge.net/project/%{name}library/%{name}-unix/2.3/OpenCV-%{version}.tar.bz2
Patch0: %{name}-2.3-libdir.patch
Patch1: %{name}-2.3-samples.patch
Patch7: %{name}-2.3-cmake.patch
Patch8: %{name}-2.3-ffmpeg.patch
%if 0%{?suse_version} >= 1120
BuildRequires: gstreamer-0_10-plugins-base-devel
BuildRequires: pkgconfig(gstreamer-0.10)
BuildRequires: gstreamer-0_10-devel
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1110
BuildRequires: libdc1394-devel
@ -53,13 +52,16 @@ BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: python-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: libqt4-devel
%if %{with ffmpeg}
BuildRequires: libffmpeg-devel
%endif
%if 0%{?suse_version} >= 1130
BuildRequires: python-numpy-devel
%endif
%if 0%{?suse_version} >= 1120
BuildRequires: python-numpy
%endif
%if 0%{?suse_version} < 1210
BuildRequires: libv4l-devel
%else
@ -120,12 +122,9 @@ This package contains the documentation and examples for the OpenCV library.
%setup -qn OpenCV-%{version}
%patch0 -p1
%patch1 -p1
%patch3
%patch4 -p1
%patch5 -p1
%if 0%{?suse_version} >= 1210
%patch6 -p1
%patch7 -p1
%if %{with ffmpeg}
%patch8
%endif
# Windows specific and with wrong end of line
@ -147,6 +146,10 @@ cmake -DCMAKE_SKIP_RPATH=ON \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_OMIT_FRAME_POINTER=OFF \
-DWITH_XINE=ON \
-DWITH_QT=ON \
%if 0%{?suse_version} >= 1130
-DWITH_QT_OPENGL=ON \
%endif
-DBUILD_TESTS=OFF \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
@ -191,6 +194,7 @@ rm -rf %{buildroot}
%{py_sitedir}/cv.so
%else
%{python_sitearch}/cv.so
%{python_sitearch}/cv2.so
%endif
%files -n %{name}-doc