OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #ifndef CHROMECAST_BASE_CAST_RESOURCE_H_ | |
5 #define CHROMECAST_BASE_CAST_RESOURCE_H_ | |
6 | |
7 namespace chromecast { | |
8 | |
9 // Interface for resources needed to run application. | |
10 class CastResource { | |
11 public: | |
12 // Resources necessary to run cast apps. | |
13 enum Resource { | |
14 kResourceNone = 0, | |
15 // All resources necessary to render sounds, for example, audio pipeline, | |
16 // speaker, etc. | |
17 kResourceAudio = 1 << 0, | |
18 // All resources necessary to render videos or images, for example, video | |
19 // pipeline, primary graphics plane, display, etc. | |
20 kResourceScreenPrimary = 1 << 1, | |
21 // All resources necessary to render overlaid images, for example, secondary | |
22 // graphics plane, LCD, etc. | |
23 kResourceScreenSecondary = 1 << 2, | |
24 // Collection of resources used for display only combined with bitwise or. | |
25 kResourceDisplayOnly = (kResourceScreenPrimary | kResourceScreenSecondary), | |
26 // Collection of all resources combined with bitwise or. | |
27 kResourceAll = (kResourceAudio | kResourceScreenPrimary | |
28 | kResourceScreenSecondary), | |
29 }; | |
30 | |
31 class Client { | |
32 public: | |
33 virtual void OnResourceAcquired(CastResource* cast_resource) = 0; | |
34 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.
| |
35 }; | |
36 | |
37 virtual ~CastResource() {} | |
38 | |
39 // Called to release resources. Implementation should call | |
40 // Client::OnResourceReleased when resource is released on its side. | |
41 virtual void ReleaseResource(Resource resource) = 0; | |
42 virtual void SetCastResourceClient(Client* client) = 0; | |
43 }; | |
44 | |
45 } // namespace chromecast | |
46 | |
47 #endif | |
OLD | NEW |