| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // automatically by VideoDecoderConfig::IsValidConfig(). | 55 // automatically by VideoDecoderConfig::IsValidConfig(). |
| 56 static bool IsValidConfig( | 56 static bool IsValidConfig( |
| 57 Format format, | 57 Format format, |
| 58 size_t width, | 58 size_t width, |
| 59 size_t height); | 59 size_t height); |
| 60 | 60 |
| 61 // Wraps a native texture of the given parameters with a VideoFrame. When the | 61 // Wraps a native texture of the given parameters with a VideoFrame. When the |
| 62 // frame is destroyed |no_longer_needed.Run()| will be called. | 62 // frame is destroyed |no_longer_needed.Run()| will be called. |
| 63 static scoped_refptr<VideoFrame> WrapNativeTexture( | 63 static scoped_refptr<VideoFrame> WrapNativeTexture( |
| 64 uint32 texture_id, | 64 uint32 texture_id, |
| 65 uint32 texture_target, |
| 65 size_t width, | 66 size_t width, |
| 66 size_t height, | 67 size_t height, |
| 67 base::TimeDelta timestamp, | 68 base::TimeDelta timestamp, |
| 68 base::TimeDelta duration, | 69 base::TimeDelta duration, |
| 69 const base::Closure& no_longer_needed); | 70 const base::Closure& no_longer_needed); |
| 70 | 71 |
| 71 // Creates a frame with format equals to VideoFrame::EMPTY, width, height | 72 // Creates a frame with format equals to VideoFrame::EMPTY, width, height |
| 72 // timestamp and duration are all 0. | 73 // timestamp and duration are all 0. |
| 73 static scoped_refptr<VideoFrame> CreateEmptyFrame(); | 74 static scoped_refptr<VideoFrame> CreateEmptyFrame(); |
| 74 | 75 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 92 int rows(size_t plane) const; | 93 int rows(size_t plane) const; |
| 93 | 94 |
| 94 // Returns pointer to the buffer for a given plane. The memory is owned by | 95 // Returns pointer to the buffer for a given plane. The memory is owned by |
| 95 // VideoFrame object and must not be freed by the caller. | 96 // VideoFrame object and must not be freed by the caller. |
| 96 uint8* data(size_t plane) const; | 97 uint8* data(size_t plane) const; |
| 97 | 98 |
| 98 // Returns the ID of the native texture wrapped by this frame. Only valid to | 99 // Returns the ID of the native texture wrapped by this frame. Only valid to |
| 99 // call if this is a NATIVE_TEXTURE frame. | 100 // call if this is a NATIVE_TEXTURE frame. |
| 100 uint32 texture_id() const; | 101 uint32 texture_id() const; |
| 101 | 102 |
| 103 // Returns the texture target. Only valid for NATIVE_TEXTURE frames. |
| 104 uint32 texture_target() const; |
| 105 |
| 102 // StreamSample interface. | 106 // StreamSample interface. |
| 103 virtual bool IsEndOfStream() const OVERRIDE; | 107 virtual bool IsEndOfStream() const OVERRIDE; |
| 104 | 108 |
| 105 private: | 109 private: |
| 106 // Clients must use the static CreateFrame() method to create a new frame. | 110 // Clients must use the static CreateFrame() method to create a new frame. |
| 107 VideoFrame(Format format, | 111 VideoFrame(Format format, |
| 108 size_t video_width, | 112 size_t video_width, |
| 109 size_t video_height, | 113 size_t video_height, |
| 110 base::TimeDelta timestamp, | 114 base::TimeDelta timestamp, |
| 111 base::TimeDelta duration); | 115 base::TimeDelta duration); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 129 // Array of strides for each plane, typically greater or equal to the width | 133 // Array of strides for each plane, typically greater or equal to the width |
| 130 // of the surface divided by the horizontal sampling period. Note that | 134 // of the surface divided by the horizontal sampling period. Note that |
| 131 // strides can be negative. | 135 // strides can be negative. |
| 132 int32 strides_[kMaxPlanes]; | 136 int32 strides_[kMaxPlanes]; |
| 133 | 137 |
| 134 // Array of data pointers to each plane. | 138 // Array of data pointers to each plane. |
| 135 uint8* data_[kMaxPlanes]; | 139 uint8* data_[kMaxPlanes]; |
| 136 | 140 |
| 137 // Native texture ID, if this is a NATIVE_TEXTURE frame. | 141 // Native texture ID, if this is a NATIVE_TEXTURE frame. |
| 138 uint32 texture_id_; | 142 uint32 texture_id_; |
| 143 uint32 texture_target_; |
| 139 base::Closure texture_no_longer_needed_; | 144 base::Closure texture_no_longer_needed_; |
| 140 | 145 |
| 141 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 146 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 142 }; | 147 }; |
| 143 | 148 |
| 144 } // namespace media | 149 } // namespace media |
| 145 | 150 |
| 146 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 151 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |