OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 // A base class that provides the plumbing for a video renderer. Derived | 5 // A base class that provides the plumbing for a video renderer. Derived |
6 // classes must implement the following methods: | 6 // classes must implement the following methods: |
7 // OnInitialized | 7 // OnInitialized |
8 // OnStop (optional) | 8 // OnStop (optional) |
9 // OnPaintNeeded | 9 // OnPaintNeeded |
10 // | 10 // |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // otherwise wake up a paint thread, but it is acceptable to call the | 78 // otherwise wake up a paint thread, but it is acceptable to call the |
79 // GetCurrentFrame() method from within OnPaintNeeded(). | 79 // GetCurrentFrame() method from within OnPaintNeeded(). |
80 virtual void OnPaintNeeded() = 0; | 80 virtual void OnPaintNeeded() = 0; |
81 | 81 |
82 // Gets the frame based on the current pipeline's time. If the queue is | 82 // Gets the frame based on the current pipeline's time. If the queue is |
83 // empty, |*frame_out| will be NULL, otherwise it will contain the frame | 83 // empty, |*frame_out| will be NULL, otherwise it will contain the frame |
84 // that should be displayed. | 84 // that should be displayed. |
85 void GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out); | 85 void GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out); |
86 | 86 |
87 // Answers question from the factory to see if we accept |format|. | 87 // Answers question from the factory to see if we accept |format|. |
88 static bool IsMediaFormatSupported(const MediaFormat* format); | 88 static bool IsMediaFormatSupported(const MediaFormat& format); |
89 | 89 |
90 // Used by the IsMediaFormatSupported and Initialize methods. Examines the | 90 // Used by the IsMediaFormatSupported and Initialize methods. Examines the |
91 // |media_format| and returns true if the format is supported. Both output | 91 // |media_format| and returns true if the format is supported. Both output |
92 // parameters, |width_out| and |height_out| are required and must not be NULL. | 92 // parameters, |width_out| and |height_out| are required and must not be NULL. |
93 static bool ParseMediaFormat(const MediaFormat* media_format, | 93 static bool ParseMediaFormat(const MediaFormat& media_format, |
94 int* width_out, | 94 int* width_out, |
95 int* height_out); | 95 int* height_out); |
96 | 96 |
97 private: | 97 private: |
98 // Used internally to post a task that will call the SubmitReads() method. | 98 // Used internally to post a task that will call the SubmitReads() method. |
99 // The |lock_| must be acquired before calling this method. If the value of | 99 // The |lock_| must be acquired before calling this method. If the value of |
100 // |number_of_reads_needed_| is 0 or if there is already a pending task then | 100 // |number_of_reads_needed_| is 0 or if there is already a pending task then |
101 // this method simply returns and does not post a new task. | 101 // this method simply returns and does not post a new task. |
102 void PostSubmitReadsTask(); | 102 void PostSubmitReadsTask(); |
103 | 103 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // be displayed. | 182 // be displayed. |
183 typedef std::deque<VideoFrame*> VideoFrameQueue; | 183 typedef std::deque<VideoFrame*> VideoFrameQueue; |
184 VideoFrameQueue queue_; | 184 VideoFrameQueue queue_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 186 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace media | 189 } // namespace media |
190 | 190 |
191 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 191 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
OLD | NEW |