OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // VideoRendererBase creates its own thread for the sole purpose of timing frame | 5 // VideoRendererBase creates its own thread for the sole purpose of timing frame |
6 // presentation. It handles reading from the decoder and stores the results in | 6 // presentation. It handles reading from the decoder and stores the results in |
7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify | 7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify |
8 // when a frame is ready to display. | 8 // when a frame is ready to display. |
9 // | 9 // |
10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() | 10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() |
11 // should be serialized, which they commonly are the pipeline thread. | 11 // should be serialized, which they commonly are the pipeline thread. |
12 // As long as VideoRendererBase is initialized, GetCurrentFrame() is safe to | 12 // As long as VideoRendererBase is initialized, GetCurrentFrame() is safe to |
13 // call from any thread, at any time, including inside of OnFrameAvailable(). | 13 // call from any thread, at any time, including inside of OnFrameAvailable(). |
14 | 14 |
15 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 15 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
16 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 16 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
17 | 17 |
18 #include <deque> | 18 #include <deque> |
19 | 19 |
20 #include "base/condition_variable.h" | 20 #include "base/condition_variable.h" |
21 #include "base/lock.h" | 21 #include "base/lock.h" |
22 #include "base/scoped_ptr.h" | |
23 #include "media/base/filters.h" | 22 #include "media/base/filters.h" |
24 #include "media/base/video_frame.h" | 23 #include "media/base/video_frame.h" |
25 | 24 |
26 namespace media { | 25 namespace media { |
27 | 26 |
28 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface | 27 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface |
29 // and pass in a reference to the constructor. | 28 // and pass in a reference to the constructor. |
30 class VideoRendererBase : public VideoRenderer, | 29 class VideoRendererBase : public VideoRenderer, |
31 public PlatformThread::Delegate { | 30 public PlatformThread::Delegate { |
32 public: | 31 public: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Filter callbacks. | 168 // Filter callbacks. |
170 scoped_ptr<FilterCallback> pause_callback_; | 169 scoped_ptr<FilterCallback> pause_callback_; |
171 scoped_ptr<FilterCallback> seek_callback_; | 170 scoped_ptr<FilterCallback> seek_callback_; |
172 | 171 |
173 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 172 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
174 }; | 173 }; |
175 | 174 |
176 } // namespace media | 175 } // namespace media |
177 | 176 |
178 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 177 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
OLD | NEW |