Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromecast/media/cma/backend/video_plane.h" | 5 #include "chromecast/media/cma/backend/video_plane.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | |
| 8 | |
| 7 namespace chromecast { | 9 namespace chromecast { |
| 8 namespace media { | 10 namespace media { |
| 9 | 11 |
| 10 VideoPlane::VideoPlane() { | 12 VideoPlane::VideoPlane() { |
| 11 } | 13 } |
| 12 | 14 |
| 13 VideoPlane::~VideoPlane() { | 15 VideoPlane::~VideoPlane() { |
| 14 } | 16 } |
| 15 | 17 |
| 18 class VideoPlaneRegistry { | |
| 19 public: | |
| 20 static VideoPlaneRegistry* GetInstance() { | |
| 21 return Singleton<VideoPlaneRegistry>::get(); | |
| 22 } | |
| 23 | |
| 24 VideoPlane* GetVideoPlane(int plane_id); | |
| 25 | |
| 26 private: | |
| 27 friend struct DefaultSingletonTraits<VideoPlaneRegistry>; | |
| 28 friend class Singleton<VideoPlaneRegistry>; | |
| 29 | |
| 30 VideoPlaneRegistry(); | |
| 31 virtual ~VideoPlaneRegistry(); | |
| 32 | |
| 33 scoped_ptr<VideoPlane> video_plane_; | |
| 34 | |
| 35 DISALLOW_COPY_AND_ASSIGN(VideoPlaneRegistry); | |
| 36 }; | |
| 37 | |
| 38 VideoPlaneRegistry::VideoPlaneRegistry() : | |
| 39 video_plane_(VideoPlaneFactory::CreatePlatformVideoPlane()) { | |
| 40 } | |
| 41 | |
| 42 VideoPlaneRegistry::~VideoPlaneRegistry() { | |
| 43 } | |
| 44 | |
| 45 VideoPlane* VideoPlaneRegistry::GetVideoPlane(int plane_id) { | |
| 46 // Only one video plane is supported at the moment | |
| 47 DCHECK_EQ(plane_id, 0); | |
| 48 return video_plane_.get(); | |
| 49 } | |
| 50 | |
| 51 VideoPlane* GetVideoPlane() { | |
| 52 // Only one video plane is supported at the moment | |
|
gunsch
2014/12/17 22:45:51
if you're defining this entire class inline, why n
servolk
2014/12/18 00:17:37
Done.
| |
| 53 return VideoPlaneRegistry::GetInstance()->GetVideoPlane(0); | |
| 54 } | |
| 55 | |
| 16 } // namespace media | 56 } // namespace media |
| 17 } // namespace chromecast | 57 } // namespace chromecast |
| OLD | NEW |