2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-03-01 16:30:40 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-06-29 13:20:14 +00:00
|
|
|
#ifndef WEBRTC_VIDEO_ENGINE_VIE_INPUT_MANAGER_H_
|
|
|
|
|
#define WEBRTC_VIDEO_ENGINE_VIE_INPUT_MANAGER_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2013-08-12 19:51:57 +00:00
|
|
|
#include <map>
|
|
|
|
|
|
2012-10-30 21:58:00 +00:00
|
|
|
#include "webrtc/modules/video_capture/include/video_capture.h"
|
2013-05-17 13:44:48 +00:00
|
|
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
|
|
|
|
#include "webrtc/typedefs.h"
|
|
|
|
|
#include "webrtc/video_engine/include/vie_capture.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_defines.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_frame_provider_base.h"
|
|
|
|
|
#include "webrtc/video_engine/vie_manager_base.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2011-12-15 10:19:29 +00:00
|
|
|
|
2013-05-13 10:50:50 +00:00
|
|
|
class Config;
|
2011-07-07 08:21:25 +00:00
|
|
|
class CriticalSectionWrapper;
|
|
|
|
|
class ProcessThread;
|
|
|
|
|
class RWLockWrapper;
|
|
|
|
|
class ViECapturer;
|
2011-12-15 10:19:29 +00:00
|
|
|
class ViEExternalCapture;
|
2011-07-07 08:21:25 +00:00
|
|
|
class VoiceEngine;
|
|
|
|
|
|
2011-12-15 10:19:29 +00:00
|
|
|
class ViEInputManager : private ViEManagerBase {
|
|
|
|
|
friend class ViEInputManagerScoped;
|
|
|
|
|
public:
|
2013-05-13 10:50:50 +00:00
|
|
|
ViEInputManager(int engine_id, const Config& config);
|
2011-12-15 10:19:29 +00:00
|
|
|
~ViEInputManager();
|
|
|
|
|
|
2012-06-21 12:11:50 +00:00
|
|
|
void SetModuleProcessThread(ProcessThread* module_process_thread);
|
2011-12-15 10:19:29 +00:00
|
|
|
|
|
|
|
|
// Returns number of capture devices.
|
|
|
|
|
int NumberOfCaptureDevices();
|
|
|
|
|
|
|
|
|
|
// Gets name and id for a capture device.
|
2013-04-09 13:41:51 +00:00
|
|
|
int GetDeviceName(uint32_t device_number,
|
2012-03-01 16:30:40 +00:00
|
|
|
char* device_nameUTF8,
|
2013-04-09 13:41:51 +00:00
|
|
|
uint32_t device_name_length,
|
2012-03-01 16:30:40 +00:00
|
|
|
char* device_unique_idUTF8,
|
2013-04-09 13:41:51 +00:00
|
|
|
uint32_t device_unique_idUTF8Length);
|
2011-12-15 10:19:29 +00:00
|
|
|
|
|
|
|
|
// Returns the number of capture capabilities for a specified device.
|
2012-03-01 16:30:40 +00:00
|
|
|
int NumberOfCaptureCapabilities(const char* device_unique_idUTF8);
|
2011-12-15 10:19:29 +00:00
|
|
|
|
|
|
|
|
// Gets a specific capability for a capture device.
|
2012-03-01 16:30:40 +00:00
|
|
|
int GetCaptureCapability(const char* device_unique_idUTF8,
|
2013-04-09 13:41:51 +00:00
|
|
|
const uint32_t device_capability_number,
|
2011-12-15 10:19:29 +00:00
|
|
|
CaptureCapability& capability);
|
|
|
|
|
|
|
|
|
|
// Show OS specific Capture settings.
|
2012-03-01 16:30:40 +00:00
|
|
|
int DisplayCaptureSettingsDialogBox(const char* device_unique_idUTF8,
|
|
|
|
|
const char* dialog_titleUTF8,
|
2011-12-15 10:19:29 +00:00
|
|
|
void* parent_window,
|
2013-04-09 13:41:51 +00:00
|
|
|
uint32_t positionX,
|
|
|
|
|
uint32_t positionY);
|
2012-03-01 16:30:40 +00:00
|
|
|
int GetOrientation(const char* device_unique_idUTF8,
|
2011-12-15 10:19:29 +00:00
|
|
|
RotateCapturedFrame& orientation);
|
|
|
|
|
|
|
|
|
|
// Creates a capture module for the specified capture device and assigns
|
|
|
|
|
// a capture device id for the device.
|
|
|
|
|
// Return zero on success, ViEError on failure.
|
2012-03-01 16:30:40 +00:00
|
|
|
int CreateCaptureDevice(const char* device_unique_idUTF8,
|
2013-04-09 13:41:51 +00:00
|
|
|
const uint32_t device_unique_idUTF8Length,
|
2011-12-15 10:19:29 +00:00
|
|
|
int& capture_id);
|
2012-06-21 12:11:50 +00:00
|
|
|
int CreateCaptureDevice(VideoCaptureModule* capture_module,
|
2011-12-15 10:19:29 +00:00
|
|
|
int& capture_id);
|
|
|
|
|
int CreateExternalCaptureDevice(ViEExternalCapture*& external_capture,
|
|
|
|
|
int& capture_id);
|
|
|
|
|
int DestroyCaptureDevice(int capture_id);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// Gets and allocates a free capture device id. Assumed protected by caller.
|
2012-06-21 12:11:50 +00:00
|
|
|
bool GetFreeCaptureId(int* freecapture_id);
|
2011-12-15 10:19:29 +00:00
|
|
|
|
|
|
|
|
// Frees a capture id assigned in GetFreeCaptureId.
|
|
|
|
|
void ReturnCaptureId(int capture_id);
|
|
|
|
|
|
|
|
|
|
// Gets the ViEFrameProvider for this capture observer.
|
|
|
|
|
ViEFrameProviderBase* ViEFrameProvider(
|
|
|
|
|
const ViEFrameCallback* capture_observer) const;
|
|
|
|
|
|
|
|
|
|
// Gets the ViEFrameProvider for this capture observer.
|
|
|
|
|
ViEFrameProviderBase* ViEFrameProvider(int provider_id) const;
|
|
|
|
|
|
|
|
|
|
// Gets the ViECapturer for the capture device id.
|
|
|
|
|
ViECapturer* ViECapturePtr(int capture_id) const;
|
|
|
|
|
|
2013-05-13 10:50:50 +00:00
|
|
|
const Config& config_;
|
2011-12-15 10:19:29 +00:00
|
|
|
int engine_id_;
|
2011-12-22 14:17:53 +00:00
|
|
|
scoped_ptr<CriticalSectionWrapper> map_cs_;
|
2013-03-08 13:12:29 +00:00
|
|
|
scoped_ptr<CriticalSectionWrapper> device_info_cs_;
|
2013-08-12 19:51:57 +00:00
|
|
|
|
|
|
|
|
typedef std::map<int, ViEFrameProviderBase*> FrameProviderMap;
|
|
|
|
|
FrameProviderMap vie_frame_provider_map_;
|
2011-12-15 10:19:29 +00:00
|
|
|
|
|
|
|
|
// Capture devices.
|
|
|
|
|
VideoCaptureModule::DeviceInfo* capture_device_info_;
|
|
|
|
|
int free_capture_device_id_[kViEMaxCaptureDevices];
|
|
|
|
|
|
2012-06-21 12:11:50 +00:00
|
|
|
ProcessThread* module_process_thread_; // Weak.
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2011-12-15 10:19:29 +00:00
|
|
|
// Provides protected access to ViEInputManater.
|
|
|
|
|
class ViEInputManagerScoped: private ViEManagerScopedBase {
|
|
|
|
|
public:
|
|
|
|
|
explicit ViEInputManagerScoped(const ViEInputManager& vie_input_manager);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-12-15 10:19:29 +00:00
|
|
|
ViECapturer* Capture(int capture_id) const;
|
|
|
|
|
ViEFrameProviderBase* FrameProvider(int provider_id) const;
|
|
|
|
|
ViEFrameProviderBase* FrameProvider(const ViEFrameCallback*
|
|
|
|
|
capture_observer) const;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2011-12-15 10:19:29 +00:00
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2012-06-29 13:20:14 +00:00
|
|
|
#endif // WEBRTC_VIDEO_ENGINE_VIE_INPUT_MANAGER_H_
|