Commit Graph

980 Commits

Author SHA1 Message Date
Alexander Alekhin
cc1fbe0956 Merge pull request #21108 from ShuangLiu1992:patch-1 2021-11-24 20:10:37 +00:00
cudawarped
97c6ec6d49
Merge pull request #20978 from cudawarped:videocapture_read_raw_enchancement
Add capacity to Videocapture to return the extraData from FFmpeg when required

* Update rawMode to append any extra data recieved during the initial negotiation of an RTSP stream or during the parsing of an MPEG4 file header.
For h264[5] RTSP streams this ensures the parameter sets if available are always returned on the first call to grab()/read() and has two purposes:
1) To ensure the parameter sets are available even if they are not transmitted in band.  This is common for axis ip camera's.
2) To allow callers of VideoCapture::grab()[read()] to write to split the raw stream over multiple files by appending the parameter sets to the begining of any new files.
For (1) there is no alternative, for (2) if the parameter sets were provided in band it would be possible to parse the raw bit stream and search for the parameter sets however that would be a lot of work when that information is already provided by FFMPEG.
For MPEG4 files this information is only suplied in the header and is required for decoding.

Two properties are also required to enable the raw encoded bitstream to be written to multiple files, these are;
1) an indicator as to whether the last frame was a key frame or not - each new file needs to start at a key frame to avoid storing unusable frame diffs,
2) the length in bytes of the paramater sets contained in the last frame - required to split the paramater sets from the frame without having to parse the stream.  Any call to VideoCapture::get(CAP_PROP_LF_PARAM_SET_LEN) returning a number greater than zero indicates the presense of a parameter set at the begining of the raw bitstream.

* Adjust test data to account for extraData

* Address warning.

* Change added property names and remove paramater set start code check.

* Output extra data on calls to retrieve instead of appending to the first packet.

* Reverted old test case and added new one to evaluate new functionality.

* Add missing definition.

* Remove flag from legacy api.
Add property to determine if returning extra data is supported.
Always allow extra data to be returned on calls to cap.retrieve()
Update test case.

* Update condition which indicates CAP_PROP_CODEC_EXTRADATA_INDEX is not supported in test case.

* Include compatibility for windows dll if not updated.
Enforce existing return status convention.

* Fix return error and missing test constraints.
2021-11-23 21:18:55 +00:00
ShuangLiu1992
fa222b0ea2
Update cap_android_camera.cpp
since u and v Pixel ptr have been swapped the compare condition should be updated too
2021-11-23 15:03:18 +00:00
Alexander Alekhin
ac4b592b4e Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-11-20 05:13:50 +00:00
Alexander Alekhin
473f10877c doc(videoio): fix apiPreference note, replace DSHOW(deprecated)->MSMF 2021-11-16 17:08:11 +00:00
Fabrice Fontaine
4c92a2869b modules/videoio/src/cap_ffmpeg_impl.hpp: fix build with gcc 4.8
Fix the following build failure with gcc 4.8:

In file included from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/src/cap_ffmpeg_impl.hpp💯0,
                 from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/src/cap_ffmpeg.cpp:50:
/home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/src/cap_ffmpeg_hw.hpp: In constructor 'HWAccelIterator::HWAccelIterator(cv::VideoAccelerationType, bool, AVDictionary*)':
/home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/src/cap_ffmpeg_hw.hpp:939:23: error: use of deleted function 'std::basic_istringstream<char>& std::basic_istringstream<char>::operator=(const std::basic_istringstream<char>&)'
             s_stream_ = std::istringstream(accel_list);
                       ^
In file included from /home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/arm-none-linux-gnueabi/include/c++/4.8.3/complex:45:0,
                 from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/core/include/opencv2/core/cvstd.inl.hpp:47,
                 from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/core/include/opencv2/core.hpp:3306,
                 from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/include/opencv2/videoio.hpp:46,
                 from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/src/precomp.hpp:57,
                 from /home/buildroot/autobuild/instance-3/output-1/build/opencv4-4.5.4/modules/videoio/src/cap_ffmpeg.cpp:42:
/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/arm-none-linux-gnueabi/include/c++/4.8.3/sstream:272:11: note: 'std::basic_istringstream<char>& std::basic_istringstream<char>::operator=(const std::basic_istringstream<char>&)' is implicitly deleted because the default definition would be ill-formed:
     class basic_istringstream : public basic_istream<_CharT, _Traits>
           ^
/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/arm-none-linux-gnueabi/include/c++/4.8.3/sstream:272:11: error: use of deleted function 'std::basic_istream<char>& std::basic_istream<char>::operator=(const std::basic_istream<char>&)'

Fixes:
 - http://autobuild.buildroot.org/results/60f8846b435dafda0ced412d59ffe15bdff0810d

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-11-12 09:50:17 +01:00
jcong
d2c1f1131b videoio: drop unnecessary offset for accessing video output buffer
Fix: #21021

NDK API AMediaCodec_getOutputBuffer() returns MediaCodecBuffer::data()
which is actually ABuffer::data(). The returned buffer address is already
adjusted by offset.

More info:
    ABuffer::base() returns base address without offset
    ABuffer::data() returns base + offset

Change-Id: I2936339ce4fa9acf657a5a7d92adc1275d7b28a1
2021-11-09 17:23:34 +08:00
Alexander Alekhin
7842181b47 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-11-05 09:27:46 +00:00
Alexander Alekhin
b3e16c6423 videoio(dshow): eliminate build warnings from MSVC-Clang 2021-11-02 19:22:47 +00:00
MaximMilashchenko
0a71063530
Merge pull request #20942 from MaximMilashchenko:AudioPatch
Audio patch

* fixed microphone, audio position

* fixed docs

* changed AudioOpenCheck
2021-10-26 14:33:53 +00:00
Alexander Alekhin
6a2077cbd8 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-10-23 15:33:31 +00:00
Maksim Shabunin
7febec49b2
Merge pull request #20614 from mshabunin:use-onevpl-load
videoio: use oneVPL load mechanism, encoder bitrate estimation

* videoio: updated oneVPL support - use mfxLoad

* videoio: advanced bitrate estimation for MFX encoder

* videoio: improved MediaSDK/oneVPL/libva detection

* videoio(ffmpeg): don't try oneVPL

* videoio(test): tune checks of videoio_mfx.read_write_raw tests

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-10-21 13:56:11 +00:00
MaximMilashchenko
f36c268b9e
Merge pull request #19721 from MaximMilashchenko:Audio
add audio support in cap_msmf

* audio msmf

* fixed warnings

* minor fix

* fixed SampleTime MSMF

* minor fix, fixed audio test, retrieveAudioFrame

* fixed warnings

* impelemented sync audio and video stream with start offset

* fixed error

* fixed docs

* fixed audio sample

* CAP_PROP_AUDIO_POS, minor fixed

* fixed warnings

* videoio(MSMF): update audio test checks, add debug logging

* fixed

* fixed desynchronization of time positions, warnings

* fixed warnings

* videoio(audio): tune tests checks

* videoio(audio): update properties description

* build warnings

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-10-20 16:18:24 +03:00
Michel Promonet
9a9e457dd6 Allow to set av_log_set_level to reduce ffmpeg level below AV_LOG_ERROR 2021-10-19 10:46:41 +02:00
Alexander Alekhin
39ee5c5a46 plugins: reverse candidates order to fetch higher versions first 2021-10-08 20:34:07 +00:00
Alexander Alekhin
cca4c47781 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-10-08 11:05:45 +00:00
Jonas Vautherin
9537a909f7
Merge pull request #20801 from JonasVautherin:fix-gst-error-handling
* Fix gst error handling

* Use the return value instead of the error, which gives no guarantee of being NULL in case of error
* Test err pointer before accessing it
* Remove unreachable code

* videoio(gstreamer): restore check in writer code

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-10-08 02:07:04 +00:00
Alexander Alekhin
c49cfefe88 videoio: fix plugins handling if no filesystem available 2021-10-06 17:29:00 +00:00
Alexander Alekhin
37c3f0d8a0 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-10-02 17:57:18 +00:00
Jonas Vautherin
de5b6386e0 Fix gst_initializer
Use the return value of gst_init_check instead of testing the error pointer
2021-10-02 15:42:13 +00:00
fortemSteve
c7e0888982
Merge pull request #20591 from fortemSteve:ffmpeg_get_stream_open_time
Add CAP_PROP_STREAM_OPEN_TIME

* Added CAP_PROP_STREAM_OPEN_TIME to videoio module - can be used to query the time at which the stream was opened, in seconds since Jan 1 1970 (midnight, UTC). Useful for RTSP and other live video where absolute timestamps are needed. Only applicable to ffmpeg backends

* use nanoseconds instead of seconds to mark the stream open time, and change the cap prop name to CAP_PROP_STREAM_OPEN_TIME_NSEC

* use microseconds for CAP_PROP_STREAM_OPEN_TIME (nanoseconds rolls over too soon, and milliseconds/seconds requires a division)

* fix whitespace issue
2021-09-09 21:23:49 +00:00
Nicolai Behmann
fdaa6ff9e3
Merge pull request #20475 from nibeh:patch-1
* Added exposure and gain props, maximized pixel clk

* removed pixel clock maximization

pixel clock maximization is not suitable for all use cases, so I removed it from PR.
2021-08-24 12:31:54 +03:00
zyp
8dcec034ed
Merge pull request #18694 from zyp:gstreamer_gray16
* videoio/gstreamer: Add support for GRAY16_LE.

* videoio/gstreamer: added BGRA/BGRx support

Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
2021-08-16 16:20:10 +00:00
Iyad Ahmed
917cd13ce2
Merge pull request #20549 from iyadahmed:video_capture_timeout_set_get
* VideoCapture add open/read timeout params to FFMPEG backend

* Fix wrong enum name

* Fix wrong enum name
2021-08-13 23:12:05 +03:00
Iyad Ahmed
4300bb2e1f
Merge pull request #20541 from iyadahmed:video_capture_timeout_prop
* VideoCapture timeout set/get

* Common formatting for enum values

* Fix enum values wrongly in videoio.hpp

* Define timeout enum values in public api and align with master
2021-08-12 19:51:02 +03:00
Saikat Nanda
21d0f40751 Fix YUV indexes + YUV Planner detection condition 2021-08-09 21:41:00 -04:00
Alexander Alekhin
4ff76cad2a cmake: fix cross-compilation problems
- unexpected pkg-config module (we should not use host binary)
- bump cmake_minimum_required to 3.5 in toolchain files
2021-08-05 11:42:58 +00:00
Alexander Alekhin
4015a5486c cmake: process modules in the same CMake scope 2021-07-22 15:22:42 +00:00
Alexander Alekhin
9e42e04b4a Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-07-10 13:01:03 +00:00
kikaxa
926535469d
fix videoio/src/container_avi.cpp VideoInputStream alignment 2021-07-07 18:31:53 +03:00
Rafael H Tibães
bf489feef1
Merge pull request #20327 from tibaes:MSMF-Slow-Webcam-Startup
* fixes MSMF slow webcam startup

* add variable to change MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS at runtime
2021-06-30 22:08:24 +00:00
Alexander Alekhin
ba98cd97e5 videoio(test): skip AV1 HW tests
- FFMPEG: "[av1 @ 0000027ac07d1340] Your platform doesn't suppport hardware accelerated AV1 decoding."
2021-06-08 17:25:09 +00:00
Alexander Alekhin
1b5fe91624 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-06-08 05:04:57 +00:00
Alexander Alekhin
61e30c15a9 Merge pull request #20211 from kstuedem:fix_dshow_memory_leak 2021-06-05 16:02:12 +00:00
Kai Stüdemann
636db09d73 videoio(dshow) fix incompatible media type left set on video device 2021-06-04 10:45:39 +02:00
Kai Stüdemann
64c018507b videoio(dshow) fix memory leak 2021-06-04 10:02:48 +02:00
Alexander Alekhin
d42a2b2d16 videoio(test): bailout from VP9 tests if first frame can't be read 2021-05-28 02:05:45 +00:00
Mikhail Nikolskii
a604d44d06
Merge pull request #19755 from mikhail-nikolskiy:ffmpeg-umat
cv::UMat output/input in VideoCapture/VideoWriter (data stays in GPU memory)

* FFMPEG with UMat input/output

* OpenCL_D3D* context

* fix Linux build

* cosmetic changes

* fix build if USE_AV_HW_CODECS=0

* simplify how child context pointer stored in parent context

* QSV interop with OpenCL on Windows

* detect_msdk.cmake via pkg-config

* fix av_buffer_ref() usage

* revert windows-decode-mfx whitelisting; remove debug msg

* address review comments

* rename property to HW_ACCELERATION_USE_OPENCL

* fix issue with "cl_khr_d3d11_sharing" extension not reported by OpenCL GPU+CPU platform

* core(ocl): add OpenCL stubs for configurations without OpenCL

* videoio(ffmpeg): update #if guards

* Put OpenCL related code under HAVE_OPENCL; simplify reuse of media context from OpenCL context

* videoio(test): skip unsupported tests

- plugins don't support OpenCL/UMat yet
- change handling of *_USE_OPENCL flag

* videoio(ffmpeg): OpenCL dependency

* videoio(ffmpeg): MediaSDK/oneVPL dependency

* cleanup, logging

* cmake: fix handling of 3rdparty interface targets

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-05-14 16:48:50 +00:00
Francesco Petrogalli
7a31a6edee [build][option] Build option to disable filesystem support. 2021-05-11 12:54:54 +00:00
Maksim Shabunin
c4ca9a7bae Initial oneVPL support 2021-04-26 17:42:20 +03:00
Alexander Alekhin
e68657cdb2 Merge pull request #19934 from alalek:videoio_plugin_query_api 2021-04-24 18:13:05 +00:00
Alexander Alekhin
896bffb543 videoio(plugin): add query API for plugins 2021-04-19 14:25:45 +00:00
Alexander Alekhin
0df6159149 cmake: fix handling of VIDEOIO_ENABLE_PLUGINS=OFF 2021-04-19 02:12:25 +00:00
Giles Payne
770445ae2a Log warning that Exposure/ISO have no effect unless AutoExposure is off 2021-04-04 22:14:40 +09:00
Giles Payne
b9b65e9392 Fix Android NDK camera's color format conversions 2021-04-04 12:39:29 +09:00
Alexander Alekhin
12d80b9e64 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-04-01 21:48:52 +00:00
Alexander Alekhin
0ff57e3292 Merge pull request #19830 from alalek:issue_19368 2021-04-01 15:30:18 +00:00
Alexander Alekhin
d7cb2ea210 videoio(dshow): add NULL ptr check 2021-04-01 11:28:41 +00:00
Alexander Alekhin
4ae2c11520 videoio(build): eliminate inconsistent 'override' warnings 2021-04-01 09:56:21 +00:00
Alexander Alekhin
3e1673e8b2 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-04-01 09:54:57 +00:00