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 #include "base/logging.h" |
| 6 #include "base/stringprintf.h" |
| 7 #include "base/time.h" |
5 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
6 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
7 #include "remoting/base/util.h" | 10 #include "remoting/base/util.h" |
8 | 11 |
9 #include "base/logging.h" | |
10 | |
11 using media::VideoFrame; | 12 using media::VideoFrame; |
12 | 13 |
13 namespace remoting { | 14 namespace remoting { |
14 | 15 |
| 16 std::string GetTimestampString() { |
| 17 base::Time t = base::Time::NowFromSystemTime(); |
| 18 base::Time::Exploded tex; |
| 19 t.LocalExplode(&tex); |
| 20 return StringPrintf("%02d%02d/%02d%02d%02d:", |
| 21 tex.month, tex.day_of_month, |
| 22 tex.hour, tex.minute, tex.second); |
| 23 } |
| 24 |
15 int GetBytesPerPixel(VideoFrame::Format format) { | 25 int GetBytesPerPixel(VideoFrame::Format format) { |
16 // Note: The order is important here for performance. This is sorted from the | 26 // Note: The order is important here for performance. This is sorted from the |
17 // most common to the less common (PIXEL_FORMAT_ASCII is mostly used | 27 // most common to the less common (PIXEL_FORMAT_ASCII is mostly used |
18 // just for testing). | 28 // just for testing). |
19 switch (format) { | 29 switch (format) { |
20 case VideoFrame::RGB24: return 3; | 30 case VideoFrame::RGB24: return 3; |
21 case VideoFrame::RGB565: return 2; | 31 case VideoFrame::RGB565: return 2; |
22 case VideoFrame::RGB32: return 4; | 32 case VideoFrame::RGB32: return 4; |
23 case VideoFrame::ASCII: return 1; | 33 case VideoFrame::ASCII: return 1; |
24 default: | 34 default: |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const int bytes_per_line = bytes_per_pixel * rect.width(); | 173 const int bytes_per_line = bytes_per_pixel * rect.width(); |
164 const int height = rect.height(); | 174 const int height = rect.height(); |
165 for (int i = 0 ; i < height; ++i) { | 175 for (int i = 0 ; i < height; ++i) { |
166 memcpy(dest_plane, src_plane, bytes_per_line); | 176 memcpy(dest_plane, src_plane, bytes_per_line); |
167 src_plane += src_plane_stride; | 177 src_plane += src_plane_stride; |
168 dest_plane += dest_plane_stride; | 178 dest_plane += dest_plane_stride; |
169 } | 179 } |
170 } | 180 } |
171 | 181 |
172 } // namespace remoting | 182 } // namespace remoting |
OLD | NEW |