| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Simple class that implements the VideoFrame interface with memory allocated | 5 // Simple class that implements the VideoFrame interface with memory allocated |
| 6 // on the system heap. This class supports every format defined in the | 6 // on the system heap. This class supports every format defined in the |
| 7 // VideoSurface::Format enum. The implementation attempts to properly align | 7 // VideoSurface::Format enum. The implementation attempts to properly align |
| 8 // allocations for maximum system bus efficency. | 8 // allocations for maximum system bus efficency. |
| 9 #ifndef MEDIA_BASE_VIDEO_FRAME_IMPL_H_ | 9 #ifndef MEDIA_BASE_VIDEO_FRAME_IMPL_H_ |
| 10 #define MEDIA_BASE_VIDEO_FRAME_IMPL_H_ | 10 #define MEDIA_BASE_VIDEO_FRAME_IMPL_H_ |
| 11 | 11 |
| 12 #include "media/base/buffers.h" | 12 #include "media/base/buffers.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 class VideoFrameImpl : public VideoFrame { | 16 class VideoFrameImpl : public VideoFrame { |
| 17 public: | 17 public: |
| 18 static void CreateFrame(VideoSurface::Format format, | 18 static void CreateFrame(VideoSurface::Format format, |
| 19 size_t width, | 19 size_t width, |
| 20 size_t height, | 20 size_t height, |
| 21 base::TimeDelta timestamp, | 21 base::TimeDelta timestamp, |
| 22 base::TimeDelta duration, | 22 base::TimeDelta duration, |
| 23 scoped_refptr<VideoFrame>* frame_out); | 23 scoped_refptr<VideoFrame>* frame_out); |
| 24 | 24 |
| 25 // Creates a frame with format equals to VideoSurface::EMPTY, width, height |
| 26 // timestamp and duration are all 0. |
| 27 static void CreateEmptyFrame(scoped_refptr<VideoFrame>* frame_out); |
| 28 |
| 25 // Implementation of VideoFrame. | 29 // Implementation of VideoFrame. |
| 26 virtual bool Lock(VideoSurface* surface); | 30 virtual bool Lock(VideoSurface* surface); |
| 27 virtual void Unlock(); | 31 virtual void Unlock(); |
| 32 virtual bool IsEndOfStream() const; |
| 28 | 33 |
| 29 private: | 34 private: |
| 30 // Clients must use the static CreateFrame() method to create a new frame. | 35 // Clients must use the static CreateFrame() method to create a new frame. |
| 31 VideoFrameImpl(VideoSurface::Format format, | 36 VideoFrameImpl(VideoSurface::Format format, |
| 32 size_t video_width, | 37 size_t video_width, |
| 33 size_t video_height); | 38 size_t video_height); |
| 34 | 39 |
| 35 virtual ~VideoFrameImpl(); | 40 virtual ~VideoFrameImpl(); |
| 36 | 41 |
| 37 bool AllocateRGB(size_t bytes_per_pixel); | 42 bool AllocateRGB(size_t bytes_per_pixel); |
| 38 bool AllocateYUV(); | 43 bool AllocateYUV(); |
| 39 | 44 |
| 40 bool locked_; | 45 bool locked_; |
| 41 VideoSurface surface_; | 46 VideoSurface surface_; |
| 42 | 47 |
| 43 DISALLOW_COPY_AND_ASSIGN(VideoFrameImpl); | 48 DISALLOW_COPY_AND_ASSIGN(VideoFrameImpl); |
| 44 }; | 49 }; |
| 45 | 50 |
| 46 } // namespace media | 51 } // namespace media |
| 47 | 52 |
| 48 #endif // MEDIA_BASE_VIDEO_FRAME_IMPL_H_ | 53 #endif // MEDIA_BASE_VIDEO_FRAME_IMPL_H_ |
| OLD | NEW |