Index: chromecast/base/cast_resource.h |
diff --git a/chromecast/base/cast_resource.h b/chromecast/base/cast_resource.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0d8624d4a178fb94d96daad2f8f7b7849dfe98a6 |
--- /dev/null |
+++ b/chromecast/base/cast_resource.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+#ifndef CHROMECAST_BASE_CAST_RESOURCE_H_ |
+#define CHROMECAST_BASE_CAST_RESOURCE_H_ |
+ |
+namespace chromecast { |
+ |
+// Interface for resources needed to run application. |
+class CastResource { |
+ public: |
+ // Resources necessary to run cast apps. |
+ enum Resource { |
+ kResourceNone = 0, |
+ // All resources necessary to render sounds, for example, audio pipeline, |
+ // speaker, etc. |
+ kResourceAudio = 1 << 0, |
+ // All resources necessary to render videos or images, for example, video |
+ // pipeline, primary graphics plane, display, etc. |
+ kResourceScreenPrimary = 1 << 1, |
+ // All resources necessary to render overlaid images, for example, secondary |
+ // graphics plane, LCD, etc. |
+ kResourceScreenSecondary = 1 << 2, |
+ // Collection of resources used for display only combined with bitwise or. |
+ kResourceDisplayOnly = (kResourceScreenPrimary | kResourceScreenSecondary), |
+ // Collection of all resources combined with bitwise or. |
+ kResourceAll = (kResourceAudio | kResourceScreenPrimary |
+ | kResourceScreenSecondary), |
+ }; |
+ |
+ class Client { |
+ public: |
+ virtual void OnResourceAcquired(CastResource* cast_resource) = 0; |
+ virtual void OnResourceReleased(CastResource* cast_resource) = 0; |
halliwell
2015/09/01 15:24:05
add virtual dtor, hide dtor as well?
yucliu1
2015/09/01 18:41:33
Done.
|
+ }; |
+ |
+ virtual ~CastResource() {} |
+ |
+ // Called to release resources. Implementation should call |
+ // Client::OnResourceReleased when resource is released on its side. |
+ virtual void ReleaseResource(Resource resource) = 0; |
+ virtual void SetCastResourceClient(Client* client) = 0; |
+}; |
+ |
+} // namespace chromecast |
+ |
+#endif |