OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 | |
5 #ifndef MEDIA_AUDIO_OPENSLES_UTIL_H_ | |
qinmin
2012/04/02 13:28:54
missing ANDROID
no longer working on chromium
2012/04/02 15:17:38
Sorry, I missed this in the previous set.
Done no
| |
6 #define MEDIA_AUDIO_OPENSLES_UTIL_H_ | |
qinmin
2012/04/02 13:28:54
this too
no longer working on chromium
2012/04/02 15:17:38
Done.
| |
7 | |
8 #include "base/logging.h" | |
9 #include <SLES/OpenSLES.h> | |
10 | |
11 namespace media { | |
12 | |
13 template <typename SLType, typename SLDerefType> | |
14 class ScopedSLObject { | |
15 public: | |
16 ScopedSLObject() : obj_(NULL) {} | |
17 | |
18 ~ScopedSLObject() { Reset(); } | |
19 | |
20 SLType* Receive() { | |
21 DCHECK(!obj_); | |
22 return &obj_; | |
23 } | |
24 | |
25 SLDerefType operator->() { return *obj_; } | |
26 | |
27 SLType Get() const { return obj_; } | |
28 | |
29 void Reset() { | |
30 if (obj_) { | |
31 (*obj_)->Destroy(obj_); | |
32 obj_ = NULL; | |
33 } | |
34 } | |
35 | |
36 private: | |
37 SLType obj_; | |
38 }; | |
39 | |
40 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf; | |
41 | |
42 } // namespace media | |
43 | |
44 #endif // MEDIA_AUDIO_OPENSLES_UTIL_H_ | |
qinmin
2012/04/02 13:28:54
same here
no longer working on chromium
2012/04/02 15:17:38
Done.
| |
OLD | NEW |