| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ | 5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ |
| 6 #define MEDIA_BASE_VIDEO_FRAME_H_ | 6 #define MEDIA_BASE_VIDEO_FRAME_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "media/base/buffers.h" | 9 #include "media/base/buffers.h" |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 Format format, | 48 Format format, |
| 49 size_t width, | 49 size_t width, |
| 50 size_t height, | 50 size_t height, |
| 51 base::TimeDelta timestamp, | 51 base::TimeDelta timestamp, |
| 52 base::TimeDelta duration); | 52 base::TimeDelta duration); |
| 53 | 53 |
| 54 // Wraps a native texture of the given parameters with a VideoFrame. When the | 54 // Wraps a native texture of the given parameters with a VideoFrame. When the |
| 55 // frame is destroyed |no_longer_needed.Run()| will be called. | 55 // frame is destroyed |no_longer_needed.Run()| will be called. |
| 56 static scoped_refptr<VideoFrame> WrapNativeTexture( | 56 static scoped_refptr<VideoFrame> WrapNativeTexture( |
| 57 uint32 texture_id, | 57 uint32 texture_id, |
| 58 uint32 texture_target, |
| 58 size_t width, | 59 size_t width, |
| 59 size_t height, | 60 size_t height, |
| 60 base::TimeDelta timestamp, | 61 base::TimeDelta timestamp, |
| 61 base::TimeDelta duration, | 62 base::TimeDelta duration, |
| 62 const base::Closure& no_longer_needed); | 63 const base::Closure& no_longer_needed); |
| 63 | 64 |
| 64 // Creates a frame with format equals to VideoFrame::EMPTY, width, height | 65 // Creates a frame with format equals to VideoFrame::EMPTY, width, height |
| 65 // timestamp and duration are all 0. | 66 // timestamp and duration are all 0. |
| 66 static scoped_refptr<VideoFrame> CreateEmptyFrame(); | 67 static scoped_refptr<VideoFrame> CreateEmptyFrame(); |
| 67 | 68 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 85 int rows(size_t plane) const; | 86 int rows(size_t plane) const; |
| 86 | 87 |
| 87 // Returns pointer to the buffer for a given plane. The memory is owned by | 88 // Returns pointer to the buffer for a given plane. The memory is owned by |
| 88 // VideoFrame object and must not be freed by the caller. | 89 // VideoFrame object and must not be freed by the caller. |
| 89 uint8* data(size_t plane) const; | 90 uint8* data(size_t plane) const; |
| 90 | 91 |
| 91 // Returns the ID of the native texture wrapped by this frame. Only valid to | 92 // Returns the ID of the native texture wrapped by this frame. Only valid to |
| 92 // call if this is a NATIVE_TEXTURE frame. | 93 // call if this is a NATIVE_TEXTURE frame. |
| 93 uint32 texture_id() const; | 94 uint32 texture_id() const; |
| 94 | 95 |
| 96 // Returns the texture target. Only valid for NATIVE_TEXTURE frames. |
| 97 uint32 texture_target() const; |
| 98 |
| 95 // StreamSample interface. | 99 // StreamSample interface. |
| 96 virtual bool IsEndOfStream() const OVERRIDE; | 100 virtual bool IsEndOfStream() const OVERRIDE; |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 // Clients must use the static CreateFrame() method to create a new frame. | 103 // Clients must use the static CreateFrame() method to create a new frame. |
| 100 VideoFrame(Format format, | 104 VideoFrame(Format format, |
| 101 size_t video_width, | 105 size_t video_width, |
| 102 size_t video_height, | 106 size_t video_height, |
| 103 base::TimeDelta timestamp, | 107 base::TimeDelta timestamp, |
| 104 base::TimeDelta duration); | 108 base::TimeDelta duration); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 122 // Array of strides for each plane, typically greater or equal to the width | 126 // Array of strides for each plane, typically greater or equal to the width |
| 123 // of the surface divided by the horizontal sampling period. Note that | 127 // of the surface divided by the horizontal sampling period. Note that |
| 124 // strides can be negative. | 128 // strides can be negative. |
| 125 int32 strides_[kMaxPlanes]; | 129 int32 strides_[kMaxPlanes]; |
| 126 | 130 |
| 127 // Array of data pointers to each plane. | 131 // Array of data pointers to each plane. |
| 128 uint8* data_[kMaxPlanes]; | 132 uint8* data_[kMaxPlanes]; |
| 129 | 133 |
| 130 // Native texture ID, if this is a NATIVE_TEXTURE frame. | 134 // Native texture ID, if this is a NATIVE_TEXTURE frame. |
| 131 uint32 texture_id_; | 135 uint32 texture_id_; |
| 136 uint32 texture_target_; |
| 132 base::Closure texture_no_longer_needed_; | 137 base::Closure texture_no_longer_needed_; |
| 133 | 138 |
| 134 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 139 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 135 }; | 140 }; |
| 136 | 141 |
| 137 } // namespace media | 142 } // namespace media |
| 138 | 143 |
| 139 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 144 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |