Path: blob/master/modules/videoio/src/cap_winrt_capture.hpp
16354 views
// Capture support for WinRT12// Copyright (c) Microsoft Open Technologies, Inc.3// All rights reserved.4//5// (3 - clause BSD License)6//7// Redistribution and use in source and binary forms, with or without modification, are permitted provided that8// the following conditions are met:9//10// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the11// following disclaimer.12// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the13// following disclaimer in the documentation and/or other materials provided with the distribution.14// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or15// promote products derived from this software without specific prior written permission.16//17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED18// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A19// PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY20// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,21// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING23// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE24// POSSIBILITY OF SUCH DAMAGE.2526#pragma once2728#include "precomp.hpp"2930#include <mutex>31#include <memory>32#include <condition_variable>33#include <atomic>3435#include <agile.h>363738// nb. implemented the newer IVideoCapture C++ interface so that we can work39// directly with Mat, not the older C cv interface40// (which may have added overhead for IPL file conversion)4142namespace cv {4344class VideoCapture_WinRT : public IVideoCapture45{46public:47VideoCapture_WinRT() : started(false) {}48VideoCapture_WinRT(int device);49virtual ~VideoCapture_WinRT() {}5051// from base class IVideoCapture52virtual double getProperty(int) { return 0; }53virtual bool setProperty(int, double);54virtual bool grabFrame();55virtual bool retrieveFrame(int channel, cv::OutputArray outArray);5657virtual int getCaptureDomain() CV_OVERRIDE { return CAP_WINRT; }5859virtual bool isOpened() const;6061protected:6263bool started;64CvSize size;65int bytesPerPixel;66unsigned long frameCurrent;67std::atomic<bool> isFrameNew;68};69}7071