Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: media/base/video_frame.h

Issue 10451051: Provide a Chrome-owned buffer to FFmpeg for video decoding, instead of (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/base/video_frame.cc » ('j') | media/base/video_frame.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/md5.h" 9 #include "base/md5.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 20 matching lines...) Expand all
31 INVALID = 0, // Invalid format value. Used for error reporting. 31 INVALID = 0, // Invalid format value. Used for error reporting.
32 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 32 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8
33 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples 33 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples
34 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples 34 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples
35 EMPTY = 9, // An empty frame. 35 EMPTY = 9, // An empty frame.
36 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. 36 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples.
37 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. 37 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic.
38 }; 38 };
39 39
40 // Creates a new frame in system memory with given parameters. Buffers for 40 // Creates a new frame in system memory with given parameters. Buffers for
41 // the frame are allocated but not initialized. 41 // the frame are allocated but not initialized. If given, alignment is a
42 // power of 2 number (in bytes) by which the horizontal and vertical buffer
43 // dimensions should be aligned during allocation.
44 static scoped_refptr<VideoFrame> CreateFrame(
45 Format format,
46 size_t width,
47 size_t height,
48 size_t alignment,
49 base::TimeDelta timestamp,
50 base::TimeDelta duration);
42 static scoped_refptr<VideoFrame> CreateFrame( 51 static scoped_refptr<VideoFrame> CreateFrame(
43 Format format, 52 Format format,
44 size_t width, 53 size_t width,
45 size_t height, 54 size_t height,
46 base::TimeDelta timestamp, 55 base::TimeDelta timestamp,
47 base::TimeDelta duration); 56 base::TimeDelta duration) {
57 return CreateFrame(format, width, height, 1,
58 timestamp, duration);
59 }
48 60
49 // Call prior to CreateFrame to ensure validity of frame configuration. Called 61 // Call prior to CreateFrame to ensure validity of frame configuration. Called
50 // automatically by VideoDecoderConfig::IsValidConfig(). 62 // automatically by VideoDecoderConfig::IsValidConfig().
51 static bool IsValidConfig( 63 static bool IsValidConfig(
scherkus (not reviewing) 2012/06/14 02:21:33 I actually don't see any public users of this func
rbultje1 2012/06/14 18:32:20 See video_decoder_config.cc
52 Format format, 64 Format format,
53 size_t width, 65 size_t width,
54 size_t height); 66 size_t height,
67 size_t alignment);
68 static bool IsValidConfig(
69 Format format,
70 size_t width,
71 size_t height) {
72 return IsValidConfig(format, width, height, 1);
73 }
55 74
56 // Wraps a native texture of the given parameters with a VideoFrame. When the 75 // Wraps a native texture of the given parameters with a VideoFrame. When the
57 // frame is destroyed |no_longer_needed.Run()| will be called. 76 // frame is destroyed |no_longer_needed.Run()| will be called.
58 static scoped_refptr<VideoFrame> WrapNativeTexture( 77 static scoped_refptr<VideoFrame> WrapNativeTexture(
59 uint32 texture_id, 78 uint32 texture_id,
60 uint32 texture_target, 79 uint32 texture_target,
61 size_t width, 80 size_t width,
62 size_t height, 81 size_t height,
63 base::TimeDelta timestamp, 82 base::TimeDelta timestamp,
64 base::TimeDelta duration, 83 base::TimeDelta duration,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 friend class base::RefCountedThreadSafe<VideoFrame>; 142 friend class base::RefCountedThreadSafe<VideoFrame>;
124 // Clients must use the static CreateFrame() method to create a new frame. 143 // Clients must use the static CreateFrame() method to create a new frame.
125 VideoFrame(Format format, 144 VideoFrame(Format format,
126 size_t video_width, 145 size_t video_width,
127 size_t video_height, 146 size_t video_height,
128 base::TimeDelta timestamp, 147 base::TimeDelta timestamp,
129 base::TimeDelta duration); 148 base::TimeDelta duration);
130 virtual ~VideoFrame(); 149 virtual ~VideoFrame();
131 150
132 // Used internally by CreateFrame(). 151 // Used internally by CreateFrame().
133 void AllocateRGB(size_t bytes_per_pixel); 152 void AllocateRGB(size_t bytes_per_pixel, size_t alignment);
134 void AllocateYUV(); 153 void AllocateYUV(size_t alignment);
135 154
136 // Used to DCHECK() plane parameters. 155 // Used to DCHECK() plane parameters.
137 bool IsValidPlane(size_t plane) const; 156 bool IsValidPlane(size_t plane) const;
138 157
139 // Frame format. 158 // Frame format.
140 Format format_; 159 Format format_;
141 160
142 // Width and height of surface. 161 // Width and height of surface.
143 size_t width_; 162 size_t width_;
144 size_t height_; 163 size_t height_;
(...skipping 13 matching lines...) Expand all
158 177
159 base::TimeDelta timestamp_; 178 base::TimeDelta timestamp_;
160 base::TimeDelta duration_; 179 base::TimeDelta duration_;
161 180
162 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); 181 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
163 }; 182 };
164 183
165 } // namespace media 184 } // namespace media
166 185
167 #endif // MEDIA_BASE_VIDEO_FRAME_H_ 186 #endif // MEDIA_BASE_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/video_frame.cc » ('j') | media/base/video_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698