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

Side by Side Diff: webrtc/common_video/plane.h

Issue 1486103002: Nuke webrtc/common_video/plane.*. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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 | webrtc/common_video/plane.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef COMMON_VIDEO_PLANE_H
12 #define COMMON_VIDEO_PLANE_H
13
14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/system_wrappers/include/aligned_malloc.h"
16 #include "webrtc/typedefs.h"
17
18 namespace webrtc {
19
20 // Helper class for VideoFrame: Store plane data and perform basic plane
21 // operations.
22 class Plane {
23 public:
24 Plane();
25 ~Plane();
26 // CreateEmptyPlane - set allocated size, actual plane size and stride:
27 // If current size is smaller than current size, then a buffer of sufficient
28 // size will be allocated.
29 // Return value: 0 on success ,-1 on error.
30 int CreateEmptyPlane(int allocated_size, int stride, int plane_size);
31
32 // Copy the entire plane data.
33 // Return value: 0 on success ,-1 on error.
34 int Copy(const Plane& plane);
35
36 // Copy buffer: If current size is smaller
37 // than current size, then a buffer of sufficient size will be allocated.
38 // Return value: 0 on success ,-1 on error.
39 int Copy(int size, int stride, const uint8_t* buffer);
40
41 // Swap plane data.
42 void Swap(Plane& plane);
43
44 // Get allocated size.
45 int allocated_size() const {return allocated_size_;}
46
47 // Set actual size.
48 void ResetSize() {plane_size_ = 0;}
49
50 // Return true is plane size is zero, false if not.
51 bool IsZeroSize() const {return plane_size_ == 0;}
52
53 // Get stride value.
54 int stride() const {return stride_;}
55
56 // Return data pointer.
57 const uint8_t* buffer() const {return buffer_.get();}
58 // Overloading with non-const.
59 uint8_t* buffer() {return buffer_.get();}
60
61 private:
62 // Resize when needed: If current allocated size is less than new_size, buffer
63 // will be updated. Old data will be copied to new buffer.
64 // Return value: 0 on success ,-1 on error.
65 int MaybeResize(int new_size);
66
67 rtc::scoped_ptr<uint8_t, AlignedFreeDeleter> buffer_;
68 int allocated_size_;
69 int plane_size_;
70 int stride_;
71 }; // Plane
72
73 } // namespace webrtc
74
75 #endif // COMMON_VIDEO_PLANE_H
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_video/plane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698