/**************************************************************************/1/* camera_win.cpp */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#include "camera_win.h"3132///@TODO sorry guys, I got about 80% through implementing this using DirectShow only33// to find out Microsoft deprecated half the API and its replacement is as confusing34// as they could make it. Joey suggested looking into libuvc which offers a more direct35// route to webcams over USB and this is very promising but it wouldn't compile on36// windows for me...I've gutted the classes I implemented DirectShow in just to have37// a skeleton for someone to work on, mail me for more details or if you want a copy....3839//////////////////////////////////////////////////////////////////////////40// CameraFeedWindows - Subclass for our camera feed on windows4142/// @TODO need to implement this4344class CameraFeedWindows : public CameraFeed {45private:46protected:47public:48CameraFeedWindows();49virtual ~CameraFeedWindows();5051bool activate_feed();52void deactivate_feed();53};5455CameraFeedWindows::CameraFeedWindows() {56///@TODO implement this, should store information about our available camera57}5859CameraFeedWindows::~CameraFeedWindows() {60// make sure we stop recording if we are!61if (is_active()) {62deactivate_feed();63};6465///@TODO free up anything used by this66}6768bool CameraFeedWindows::activate_feed() {69///@TODO this should activate our camera and start the process of capturing frames7071return true;72}7374///@TODO we should probably have a callback method here that is being called by the75// camera API which provides frames and call back into the CameraServer to update our texture7677void CameraFeedWindows::deactivate_feed() {78///@TODO this should deactivate our camera and stop the process of capturing frames79}8081//////////////////////////////////////////////////////////////////////////82// CameraWindows - Subclass for our camera server on windows8384void CameraWindows::add_active_cameras() {85///@TODO scan through any active cameras and create CameraFeedWindows objects for them86}8788CameraWindows::CameraWindows() {89// Find cameras active right now90add_active_cameras();9192// need to add something that will react to devices being connected/removed...93}949596