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

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

Issue 1637793004: [WIP] Mojo Video Capture thingy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: heave!! Created 4 years, 10 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
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 #include "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 // CommonAlignment() check should be made in IsValidConfig()? 913 // CommonAlignment() check should be made in IsValidConfig()?
914 // http://crbug.com/555909 914 // http://crbug.com/555909
915 frame->strides_[kUPlane] = coded_size.width() / 2; 915 frame->strides_[kUPlane] = coded_size.width() / 2;
916 frame->strides_[kVPlane] = coded_size.width() / 2; 916 frame->strides_[kVPlane] = coded_size.width() / 2;
917 frame->data_[kYPlane] = data; 917 frame->data_[kYPlane] = data;
918 frame->data_[kUPlane] = data + coded_size.GetArea(); 918 frame->data_[kUPlane] = data + coded_size.GetArea();
919 frame->data_[kVPlane] = data + (coded_size.GetArea() * 5 / 4); 919 frame->data_[kVPlane] = data + (coded_size.GetArea() * 5 / 4);
920 return frame; 920 return frame;
921 } 921 }
922 922
923 void VideoFrame::set_data(size_t plane, uint8_t* ptr) {
924 DCHECK(IsValidPlane(plane, format_));
925 DCHECK(ptr);
926 data_[plane] = ptr;
927 }
928
929 void VideoFrame::set_stride(size_t plane, int stride) {
930 DCHECK(IsValidPlane(plane, format_));
931 DCHECK_GE(stride, 0);
932 strides_[plane] = stride;
933 }
934
923 VideoFrame::VideoFrame(VideoPixelFormat format, 935 VideoFrame::VideoFrame(VideoPixelFormat format,
924 StorageType storage_type, 936 StorageType storage_type,
925 const gfx::Size& coded_size, 937 const gfx::Size& coded_size,
926 const gfx::Rect& visible_rect, 938 const gfx::Rect& visible_rect,
927 const gfx::Size& natural_size, 939 const gfx::Size& natural_size,
928 base::TimeDelta timestamp) 940 base::TimeDelta timestamp)
929 : format_(format), 941 : format_(format),
930 storage_type_(storage_type), 942 storage_type_(storage_type),
931 coded_size_(coded_size), 943 coded_size_(coded_size),
932 visible_rect_(visible_rect), 944 visible_rect_(visible_rect),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 if (zero_initialize_memory) 1074 if (zero_initialize_memory)
1063 memset(data, 0, data_size); 1075 memset(data, 0, data_size);
1064 1076
1065 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1077 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1066 data_[plane] = data + offset[plane]; 1078 data_[plane] = data + offset[plane];
1067 1079
1068 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1080 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1069 } 1081 }
1070 1082
1071 } // namespace media 1083 } // namespace media
OLDNEW
« components/video_capture/stream_impl_unittest.cc ('K') | « media/base/video_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698