Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: webrtc/modules/desktop_capture/desktop_capturer.h

Issue 2452263003: Add DesktopCapturer GetSourceList SelectSource FocusOnSelectedSource functions (Closed)
Patch Set: Fix build break on Chromium Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/desktop_capturer.h
diff --git a/webrtc/modules/desktop_capture/desktop_capturer.h b/webrtc/modules/desktop_capture/desktop_capturer.h
index d758946b843d1451189f053b8bf642e2adc5867f..6b9c820ce9df5ea3b739917db8e82671af0a0e86 100644
--- a/webrtc/modules/desktop_capture/desktop_capturer.h
+++ b/webrtc/modules/desktop_capture/desktop_capturer.h
@@ -12,8 +12,11 @@
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
#include <stddef.h>
+#include <stdint.h>
#include <memory>
+#include <string>
+#include <vector>
#include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/desktop_capture_types.h"
@@ -21,6 +24,7 @@
namespace webrtc {
+class DesktopCaptureOptions;
class DesktopFrame;
// Abstract interface for screen and window capturers.
@@ -53,7 +57,20 @@ class DesktopCapturer {
virtual ~Callback() {}
};
- virtual ~DesktopCapturer() {}
+ typedef intptr_t SourceId;
+
+ struct Source {
+ // The unique id to represent a Source of current DesktopCapturer.
+ SourceId id;
+
+ // Title of the window or screen in UTF-8 encoding, maybe empty. This field
+ // should not be used to identify a source.
+ std::string title;
+ };
+
+ typedef std::vector<Source> SourceList;
+
+ virtual ~DesktopCapturer();
// Called at the beginning of a capturing session. |callback| must remain
// valid until capturer is destroyed.
@@ -65,7 +82,7 @@ class DesktopCapturer {
// Shared memory is currently supported only by some DesktopCapturer
// implementations.
virtual void SetSharedMemoryFactory(
- std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
+ std::unique_ptr<SharedMemoryFactory> shared_memory_factory);
// Captures next frame, and involve callback provided by Start() function.
// Pending capture requests are canceled when DesktopCapturer is deleted.
@@ -74,7 +91,25 @@ class DesktopCapturer {
// Sets the window to be excluded from the captured image in the future
// Capture calls. Used to exclude the screenshare notification window for
// screen capturing.
- virtual void SetExcludedWindow(WindowId window) {}
+ virtual void SetExcludedWindow(WindowId window);
+
+ // TODO(zijiehe): Following functions should be pure virtual. The default
+ // implementations are for backward compatibility only. Remove default
+ // implementations once all DesktopCapturer implementations in Chromium have
+ // implemented these functions.
+
+ // Gets a list of sources current capturer supports. Returns false in case of
+ // a failure.
+ virtual bool GetSourceList(SourceList* sources);
+
+ // Selects a source to be captured. Returns false in case of a failure (e.g.
+ // if there is no source with the specified type and id.)
+ virtual bool SelectSource(SourceId id);
+
+ // Brings the selected source to the front and sets the input focus on it.
+ // Returns false in case of a failure or no source has been selected or the
+ // implementation does not support this functionality.
+ virtual bool FocusOnSelectedSource();
};
} // namespace webrtc
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_capture.gypi ('k') | webrtc/modules/desktop_capture/desktop_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698