vendor: OpenCV 5.0.0 snapshot at 40738fb16ceddb5fb3fea747585f7ce6abb0605b
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,150 @@
|
||||
/* For iOS video I/O
|
||||
* by Eduard Feicho on 29/07/12
|
||||
* Copyright 2012. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Accelerate/Accelerate.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#include "opencv2/core.hpp"
|
||||
|
||||
//! @addtogroup videoio_ios
|
||||
//! @{
|
||||
|
||||
/////////////////////////////////////// CvAbstractCamera /////////////////////////////////////
|
||||
|
||||
@class CvAbstractCamera;
|
||||
|
||||
CV_EXPORTS @interface CvAbstractCamera : NSObject
|
||||
{
|
||||
UIDeviceOrientation currentDeviceOrientation;
|
||||
|
||||
BOOL cameraAvailable;
|
||||
}
|
||||
|
||||
@property (nonatomic, strong) AVCaptureSession* captureSession;
|
||||
@property (nonatomic, strong) AVCaptureConnection* videoCaptureConnection;
|
||||
|
||||
@property (nonatomic, readonly) BOOL running;
|
||||
@property (nonatomic, readonly) BOOL captureSessionLoaded;
|
||||
|
||||
@property (nonatomic, assign) int defaultFPS;
|
||||
@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
|
||||
@property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition;
|
||||
@property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
|
||||
@property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer;
|
||||
@property (nonatomic, strong) NSString *const defaultAVCaptureSessionPreset;
|
||||
|
||||
@property (nonatomic, assign) int imageWidth;
|
||||
@property (nonatomic, assign) int imageHeight;
|
||||
|
||||
@property (nonatomic, strong) UIView* parentView;
|
||||
|
||||
- CV_UNUSED(start);
|
||||
- CV_UNUSED(stop);
|
||||
- CV_UNUSED(switchCameras);
|
||||
|
||||
- (id)initWithParentView:(UIView*)parent;
|
||||
|
||||
- CV_UNUSED(createCaptureOutput);
|
||||
- CV_UNUSED(createVideoPreviewLayer);
|
||||
- CV_UNUSED(updateOrientation);
|
||||
|
||||
- CV_UNUSED(lockFocus);
|
||||
- CV_UNUSED(unlockFocus);
|
||||
- CV_UNUSED(lockExposure);
|
||||
- CV_UNUSED(unlockExposure);
|
||||
- CV_UNUSED(lockBalance);
|
||||
- CV_UNUSED(unlockBalance);
|
||||
|
||||
@end
|
||||
|
||||
///////////////////////////////// CvVideoCamera ///////////////////////////////////////////
|
||||
|
||||
@class CvVideoCamera;
|
||||
|
||||
CV_EXPORTS @protocol CvVideoCameraDelegate <NSObject>
|
||||
|
||||
#ifdef __cplusplus
|
||||
// delegate method for processing image frames
|
||||
- (void)processImage:(cv::Mat&)image;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
CV_EXPORTS @interface CvVideoCamera : CvAbstractCamera<AVCaptureVideoDataOutputSampleBufferDelegate>
|
||||
{
|
||||
AVCaptureVideoDataOutput *videoDataOutput;
|
||||
|
||||
dispatch_queue_t videoDataOutputQueue;
|
||||
CALayer *customPreviewLayer;
|
||||
|
||||
CMTime lastSampleTime;
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, weak) id<CvVideoCameraDelegate> delegate;
|
||||
@property (nonatomic, assign) BOOL grayscaleMode;
|
||||
|
||||
@property (nonatomic, assign) BOOL recordVideo;
|
||||
@property (nonatomic, assign) BOOL rotateVideo;
|
||||
@property (nonatomic, strong) AVAssetWriterInput* recordAssetWriterInput;
|
||||
@property (nonatomic, strong) AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor;
|
||||
@property (nonatomic, strong) AVAssetWriter* recordAssetWriter;
|
||||
|
||||
- (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
|
||||
- CV_UNUSED(layoutPreviewLayer);
|
||||
- CV_UNUSED(saveVideo);
|
||||
- (NSURL *)videoFileURL;
|
||||
- (NSString *)videoFileString;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
///////////////////////////////// CvPhotoCamera ///////////////////////////////////////////
|
||||
|
||||
@class CvPhotoCamera;
|
||||
|
||||
CV_EXPORTS @protocol CvPhotoCameraDelegate <NSObject>
|
||||
|
||||
- (void)photoCamera:(CvPhotoCamera*)photoCamera capturedImage:(UIImage *)image;
|
||||
- (void)photoCameraCancel:(CvPhotoCamera*)photoCamera;
|
||||
|
||||
@end
|
||||
|
||||
CV_EXPORTS @interface CvPhotoCamera : CvAbstractCamera
|
||||
{
|
||||
AVCaptureStillImageOutput *stillImageOutput;
|
||||
}
|
||||
|
||||
@property (nonatomic, weak) id<CvPhotoCameraDelegate> delegate;
|
||||
|
||||
- CV_UNUSED(takePicture);
|
||||
|
||||
@end
|
||||
|
||||
//! @} videoio_ios
|
||||
@@ -0,0 +1,132 @@
|
||||
// Video support for Windows Runtime
|
||||
|
||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// (3 - clause BSD License)
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that
|
||||
// the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
// following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
|
||||
// following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or
|
||||
// promote products derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
// PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <ppl.h>
|
||||
#include <functional>
|
||||
#include <concrt.h>
|
||||
#include <agile.h>
|
||||
#include "opencv2/core/cvdef.h"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
//! @addtogroup videoio_winrt
|
||||
//! @{
|
||||
|
||||
enum {
|
||||
OPEN_CAMERA = 300,
|
||||
CLOSE_CAMERA,
|
||||
UPDATE_IMAGE_ELEMENT,
|
||||
SHOW_TRACKBAR
|
||||
};
|
||||
|
||||
/********************************** WinRT API ************************************************/
|
||||
|
||||
template <typename ...Args>
|
||||
CV_EXPORTS void winrt_startMessageLoop(std::function<void(Args...)>&& callback, Args... args);
|
||||
|
||||
template <typename ...Args>
|
||||
CV_EXPORTS void winrt_startMessageLoop(void callback(Args...), Args... args);
|
||||
|
||||
/** @brief
|
||||
@note
|
||||
Starts (1) frame-grabbing loop and (2) message loop
|
||||
1. Function passed as an argument must implement common OCV reading frames
|
||||
pattern (see cv::VideoCapture documentation) AND call cv::winrt_imgshow().
|
||||
2. Message processing loop required to overcome WinRT container and type
|
||||
conversion restrictions. OCV provides default implementation
|
||||
Here is how the class can be used:
|
||||
@code
|
||||
void cvMain()
|
||||
{
|
||||
Mat frame;
|
||||
VideoCapture cam;
|
||||
cam.open(0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
cam >> frame;
|
||||
|
||||
// don't reprocess the same frame again
|
||||
if (!cam.grab()) continue;
|
||||
|
||||
// your processing logic goes here
|
||||
|
||||
// obligatory step to get XAML image component updated
|
||||
winrt_imshow();
|
||||
}
|
||||
}
|
||||
|
||||
MainPage::MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
cv::winrt_setFrameContainer(cvImage);
|
||||
cv::winrt_startMessageLoop(cvMain);
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
template
|
||||
CV_EXPORTS void winrt_startMessageLoop(void callback(void));
|
||||
|
||||
/** @brief
|
||||
@note
|
||||
Must be called from WinRT specific callback to handle image grabber state.
|
||||
Here is how the class can be used:
|
||||
@code
|
||||
MainPage::MainPage()
|
||||
{
|
||||
// ...
|
||||
Window::Current->VisibilityChanged += ref new Windows::UI::Xaml::WindowVisibilityChangedEventHandler(this, &Application::MainPage::OnVisibilityChanged);
|
||||
// ...
|
||||
}
|
||||
|
||||
void Application::MainPage::OnVisibilityChanged(Platform::Object ^sender,
|
||||
Windows::UI::Core::VisibilityChangedEventArgs ^e)
|
||||
{
|
||||
cv::winrt_onVisibilityChanged(e->Visible);
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
CV_EXPORTS void winrt_onVisibilityChanged(bool visible);
|
||||
|
||||
/** @brief
|
||||
@note
|
||||
Must be called to assign WinRT control holding image you're working with.
|
||||
Code sample is available for winrt_startMessageLoop().
|
||||
*/
|
||||
CV_EXPORTS void winrt_setFrameContainer(::Windows::UI::Xaml::Controls::Image^ image);
|
||||
|
||||
/** @brief
|
||||
@note
|
||||
Must be called to update attached image source.
|
||||
Code sample is available for winrt_startMessageLoop().
|
||||
*/
|
||||
CV_EXPORTS void winrt_imshow();
|
||||
|
||||
//! @} videoio_winrt
|
||||
|
||||
} // cv
|
||||
@@ -0,0 +1,194 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef CONTAINER_AVI_HPP
|
||||
#define CONTAINER_AVI_HPP
|
||||
|
||||
#ifndef __OPENCV_BUILD
|
||||
# error this is a private header which should not be used from outside of the OpenCV library
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/types.hpp"
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
/*
|
||||
AVI struct:
|
||||
|
||||
RIFF ('AVI '
|
||||
LIST ('hdrl'
|
||||
'avih'(<Main AVI Header>)
|
||||
LIST ('strl'
|
||||
'strh'(<Stream header>)
|
||||
'strf'(<Stream format>)
|
||||
[ 'strd'(<Additional header data>) ]
|
||||
[ 'strn'(<Stream name>) ]
|
||||
[ 'indx'(<Odml index data>) ]
|
||||
...
|
||||
)
|
||||
[LIST ('strl' ...)]
|
||||
[LIST ('strl' ...)]
|
||||
...
|
||||
[LIST ('odml'
|
||||
'dmlh'(<ODML header data>)
|
||||
...
|
||||
)
|
||||
]
|
||||
...
|
||||
)
|
||||
[LIST ('INFO' ...)]
|
||||
[JUNK]
|
||||
LIST ('movi'
|
||||
{{xxdb|xxdc|xxpc|xxwb}(<Data>) | LIST ('rec '
|
||||
{xxdb|xxdc|xxpc|xxwb}(<Data>)
|
||||
{xxdb|xxdc|xxpc|xxwb}(<Data>)
|
||||
...
|
||||
)
|
||||
...
|
||||
}
|
||||
...
|
||||
)
|
||||
['idx1' (<AVI Index>) ]
|
||||
)
|
||||
|
||||
{xxdb|xxdc|xxpc|xxwb}
|
||||
xx - stream number: 00, 01, 02, ...
|
||||
db - uncompressed video frame
|
||||
dc - compressed video frame
|
||||
pc - palette change
|
||||
wb - audio frame
|
||||
|
||||
JUNK section may pad any data section and must be ignored
|
||||
*/
|
||||
|
||||
typedef std::deque< std::pair<uint64_t, uint32_t> > frame_list;
|
||||
typedef frame_list::iterator frame_iterator;
|
||||
struct RiffChunk;
|
||||
struct RiffList;
|
||||
class VideoInputStream;
|
||||
enum Codecs { MJPEG };
|
||||
|
||||
//Represents single MJPEG video stream within single AVI/AVIX entry
|
||||
//Multiple video streams within single AVI/AVIX entry are not supported
|
||||
//ODML index is not supported
|
||||
class CV_EXPORTS AVIReadContainer
|
||||
{
|
||||
public:
|
||||
AVIReadContainer();
|
||||
|
||||
void initStream(const std::string& filename);
|
||||
void initStream(std::shared_ptr<VideoInputStream> m_file_stream_);
|
||||
|
||||
void close();
|
||||
//stores founded frames in m_frame_list which can be accessed via getFrames
|
||||
bool parseAvi(Codecs codec_) { return parseAviWithFrameList(m_frame_list, codec_); }
|
||||
//stores founded frames in in_frame_list. getFrames() would return empty list
|
||||
bool parseAvi(frame_list& in_frame_list, Codecs codec_) { return parseAviWithFrameList(in_frame_list, codec_); }
|
||||
size_t getFramesCount() { return m_frame_list.size(); }
|
||||
frame_list& getFrames() { return m_frame_list; }
|
||||
unsigned int getWidth() { return m_width; }
|
||||
unsigned int getHeight() { return m_height; }
|
||||
double getFps() { return m_fps; }
|
||||
std::vector<char> readFrame(frame_iterator it);
|
||||
bool parseRiff(frame_list &m_mjpeg_frames);
|
||||
|
||||
protected:
|
||||
|
||||
bool parseAviWithFrameList(frame_list& in_frame_list, Codecs codec_);
|
||||
void skipJunk(RiffChunk& chunk);
|
||||
void skipJunk(RiffList& list);
|
||||
bool parseHdrlList(Codecs codec_);
|
||||
bool parseIndex(unsigned int index_size, frame_list& in_frame_list);
|
||||
bool parseMovi(frame_list& in_frame_list)
|
||||
{
|
||||
//not implemented
|
||||
CV_UNUSED(in_frame_list);
|
||||
// FIXIT: in_frame_list.empty();
|
||||
return true;
|
||||
}
|
||||
bool parseStrl(char stream_id, Codecs codec_);
|
||||
bool parseInfo()
|
||||
{
|
||||
//not implemented
|
||||
return true;
|
||||
}
|
||||
|
||||
void printError(RiffList& list, unsigned int expected_fourcc);
|
||||
|
||||
void printError(RiffChunk& chunk, unsigned int expected_fourcc);
|
||||
|
||||
std::shared_ptr<VideoInputStream> m_file_stream;
|
||||
unsigned int m_stream_id;
|
||||
unsigned long long int m_movi_start;
|
||||
unsigned long long int m_movi_end;
|
||||
frame_list m_frame_list;
|
||||
unsigned int m_width;
|
||||
unsigned int m_height;
|
||||
double m_fps;
|
||||
bool m_is_indx_present;
|
||||
};
|
||||
|
||||
enum { COLORSPACE_GRAY=0, COLORSPACE_RGBA=1, COLORSPACE_BGR=2, COLORSPACE_YUV444P=3 };
|
||||
enum StreamType { db, dc, pc, wb };
|
||||
class BitStream;
|
||||
|
||||
// {xxdb|xxdc|xxpc|xxwb}
|
||||
// xx - stream number: 00, 01, 02, ...
|
||||
// db - uncompressed video frame
|
||||
// dc - compressed video frame
|
||||
// pc - palette change
|
||||
// wb - audio frame
|
||||
|
||||
|
||||
class CV_EXPORTS AVIWriteContainer
|
||||
{
|
||||
public:
|
||||
AVIWriteContainer();
|
||||
~AVIWriteContainer();
|
||||
|
||||
bool initContainer(const std::string& filename, double fps, cv::Size size, bool iscolor);
|
||||
void startWriteAVI(int stream_count);
|
||||
void writeStreamHeader(Codecs codec_);
|
||||
void startWriteChunk(uint32_t fourcc);
|
||||
void endWriteChunk();
|
||||
|
||||
int getAVIIndex(int stream_number, StreamType strm_type);
|
||||
void writeIndex(int stream_number, StreamType strm_type);
|
||||
void finishWriteAVI();
|
||||
|
||||
bool isOpenedStream() const;
|
||||
bool isEmptyFrameOffset() const { return frameOffset.empty(); }
|
||||
int getWidth() const { return width; }
|
||||
int getHeight() const { return height; }
|
||||
int getChannels() const { return channels; }
|
||||
size_t getMoviPointer() const { return moviPointer; }
|
||||
size_t getStreamPos() const;
|
||||
|
||||
void pushFrameOffset(size_t elem) { frameOffset.push_back(elem); }
|
||||
void pushFrameSize(size_t elem) { frameSize.push_back(elem); }
|
||||
bool isEmptyFrameSize() const { return frameSize.empty(); }
|
||||
size_t atFrameSize(size_t i) const { return frameSize[i]; }
|
||||
size_t countFrameSize() const { return frameSize.size(); }
|
||||
void jputStreamShort(int val);
|
||||
void putStreamBytes(const uchar* buf, int count);
|
||||
void putStreamByte(int val);
|
||||
void jputStream(unsigned currval);
|
||||
void jflushStream(unsigned currval, int bitIdx);
|
||||
|
||||
private:
|
||||
std::shared_ptr<BitStream> strm;
|
||||
int outfps;
|
||||
int width, height, channels;
|
||||
size_t moviPointer;
|
||||
std::vector<size_t> frameOffset, frameSize, AVIChunkSizeIndex, frameNumIndexes;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //CONTAINER_AVI_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
//
|
||||
// This file should not be used with compiler (documentation only)
|
||||
//
|
||||
|
||||
namespace cv {
|
||||
/** @addtogroup videoio_hwaccel
|
||||
This section contains information about API to control Hardware-accelerated video decoding and encoding.
|
||||
|
||||
@note Check [Wiki page](https://github.com/opencv/opencv/wiki/Video-IO-hardware-acceleration)
|
||||
for description of supported hardware / software configurations and available benchmarks
|
||||
|
||||
cv::VideoCapture properties:
|
||||
- #CAP_PROP_HW_ACCELERATION (as #VideoAccelerationType)
|
||||
- #CAP_PROP_HW_DEVICE
|
||||
|
||||
cv::VideoWriter properties:
|
||||
- #VIDEOWRITER_PROP_HW_ACCELERATION (as #VideoAccelerationType)
|
||||
- #VIDEOWRITER_PROP_HW_DEVICE
|
||||
|
||||
Properties are supported by these backends:
|
||||
|
||||
- #CAP_FFMPEG
|
||||
- #CAP_GSTREAMER
|
||||
- #CAP_MSMF (Windows)
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
} // namespace
|
||||
@@ -0,0 +1,82 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_VIDEOIO_REGISTRY_HPP
|
||||
#define OPENCV_VIDEOIO_REGISTRY_HPP
|
||||
|
||||
#include <opencv2/videoio.hpp>
|
||||
|
||||
namespace cv { namespace videoio_registry {
|
||||
/** @addtogroup videoio_registry
|
||||
This section contains API description how to query/configure available Video I/O backends.
|
||||
|
||||
Runtime configuration options:
|
||||
- enable debug mode: `OPENCV_VIDEOIO_DEBUG=1`
|
||||
- change backend priority: `OPENCV_VIDEOIO_PRIORITY_<backend>=9999`
|
||||
- disable backend: `OPENCV_VIDEOIO_PRIORITY_<backend>=0`
|
||||
- specify list of backends with high priority (>100000): `OPENCV_VIDEOIO_PRIORITY_LIST=FFMPEG,GSTREAMER`
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
/** @brief Returns backend API name or "UnknownVideoAPI(xxx)"
|
||||
@param api backend ID (#VideoCaptureAPIs)
|
||||
*/
|
||||
CV_EXPORTS_W cv::String getBackendName(VideoCaptureAPIs api);
|
||||
|
||||
/** @brief Returns list of all available backends */
|
||||
CV_EXPORTS_W std::vector<VideoCaptureAPIs> getBackends();
|
||||
|
||||
/** @brief Returns list of available backends which works via `cv::VideoCapture(int index)` */
|
||||
CV_EXPORTS_W std::vector<VideoCaptureAPIs> getCameraBackends();
|
||||
|
||||
/** @brief Returns list of available backends which works via `cv::VideoCapture(filename)` */
|
||||
CV_EXPORTS_W std::vector<VideoCaptureAPIs> getStreamBackends();
|
||||
|
||||
/** @brief Returns list of available backends which works via `cv::VideoCapture(buffer)` */
|
||||
CV_EXPORTS_W std::vector<VideoCaptureAPIs> getStreamBufferedBackends();
|
||||
|
||||
/** @brief Returns list of available backends which works via `cv::VideoWriter()` */
|
||||
CV_EXPORTS_W std::vector<VideoCaptureAPIs> getWriterBackends();
|
||||
|
||||
/** @brief Returns true if backend is available */
|
||||
CV_EXPORTS_W bool hasBackend(VideoCaptureAPIs api);
|
||||
|
||||
/** @brief Returns true if backend is built in (false if backend is used as plugin) */
|
||||
CV_EXPORTS_W bool isBackendBuiltIn(VideoCaptureAPIs api);
|
||||
|
||||
/** @brief Returns description and ABI/API version of videoio plugin's camera interface */
|
||||
CV_EXPORTS_W std::string getCameraBackendPluginVersion(
|
||||
VideoCaptureAPIs api,
|
||||
CV_OUT int& version_ABI,
|
||||
CV_OUT int& version_API
|
||||
);
|
||||
|
||||
/** @brief Returns description and ABI/API version of videoio plugin's stream capture interface */
|
||||
CV_EXPORTS_W std::string getStreamBackendPluginVersion(
|
||||
VideoCaptureAPIs api,
|
||||
CV_OUT int& version_ABI,
|
||||
CV_OUT int& version_API
|
||||
);
|
||||
|
||||
/** @brief Returns description and ABI/API version of videoio plugin's buffer capture interface */
|
||||
CV_EXPORTS_W std::string getStreamBufferedBackendPluginVersion(
|
||||
VideoCaptureAPIs api,
|
||||
CV_OUT int& version_ABI,
|
||||
CV_OUT int& version_API
|
||||
);
|
||||
|
||||
/** @brief Returns description and ABI/API version of videoio plugin's writer interface */
|
||||
CV_EXPORTS_W std::string getWriterBackendPluginVersion(
|
||||
VideoCaptureAPIs api,
|
||||
CV_OUT int& version_ABI,
|
||||
CV_OUT int& version_API
|
||||
);
|
||||
|
||||
|
||||
//! @}
|
||||
}} // namespace
|
||||
|
||||
#endif // OPENCV_VIDEOIO_REGISTRY_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_VIDEOIO_UTILS_PRIVATE_HPP
|
||||
#define OPENCV_VIDEOIO_UTILS_PRIVATE_HPP
|
||||
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#include <string>
|
||||
|
||||
namespace cv {
|
||||
CV_EXPORTS std::string icvExtractPattern(const std::string& filename, unsigned *offset);
|
||||
|
||||
class PluginStreamReader : public IStreamReader
|
||||
{
|
||||
public:
|
||||
PluginStreamReader(void* _opaque,
|
||||
long long (*_read)(void* opaque, char* buffer, long long size),
|
||||
long long (*_seek)(void* opaque, long long offset, int way))
|
||||
{
|
||||
opaque = _opaque;
|
||||
readCallback = _read;
|
||||
seekCallback = _seek;
|
||||
}
|
||||
|
||||
virtual ~PluginStreamReader() {}
|
||||
|
||||
long long read(char* buffer, long long size) override
|
||||
{
|
||||
return readCallback(opaque, buffer, size);
|
||||
}
|
||||
|
||||
long long seek(long long offset, int way) override
|
||||
{
|
||||
return seekCallback(opaque, offset, way);
|
||||
}
|
||||
|
||||
private:
|
||||
void* opaque;
|
||||
long long (*readCallback)(void* opaque, char* buffer, long long size);
|
||||
long long (*seekCallback)(void* opaque, long long offset, int way);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OPENCV_VIDEOIO_UTILS_PRIVATE_HPP
|
||||
@@ -0,0 +1,48 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifdef __OPENCV_BUILD
|
||||
#error this is a compatibility header which should not be used inside the OpenCV library
|
||||
#endif
|
||||
|
||||
#include "opencv2/videoio.hpp"
|
||||
Reference in New Issue
Block a user