Update SplitString calls to new form
[chromium-blink-merge.git] / remoting / test / video_frame_writer.h
blob479cb0112698ae55e80b6e3da0fbca2abcecfaa8
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef REMOTING_TEST_VIDEO_FRAME_WRITER_H_
6 #define REMOTING_TEST_VIDEO_FRAME_WRITER_H_
8 #include "base/time/time.h"
10 namespace base {
11 class FilePath;
14 namespace webrtc {
15 class DesktopFrame;
16 class DesktopRect;
19 namespace remoting {
20 namespace test {
22 // A helper class to dump video frames to disk.
23 class VideoFrameWriter {
24 public:
25 VideoFrameWriter();
26 ~VideoFrameWriter();
28 // Save video frame to a local path.
29 void WriteFrameToPath(const webrtc::DesktopFrame& frame,
30 const base::FilePath& image_path);
32 // Save video frame to path named with the |instance_creation_time|.
33 void WriteFrameToDefaultPath(const webrtc::DesktopFrame& frame);
35 // Highlight |rect| on the frame by shifting the RGB value of pixels on the
36 // border of |rect|.
37 void HighlightRectInFrame(webrtc::DesktopFrame* frame,
38 const webrtc::DesktopRect& rect);
40 private:
41 // Returns a FilePath by appending the creation time of this object.
42 base::FilePath AppendCreationDateAndTime(const base::FilePath& file_path);
44 // Returns true if directory already exists or it was created successfully.
45 bool CreateDirectoryIfNotExists(const base::FilePath& file_path);
47 // Helper function to shift the RGB value of the pixel at location (x, y) by
48 // |shift_amount| on each channel.
49 static void ShiftPixelColor(webrtc::DesktopFrame* frame,
50 int x,
51 int y,
52 int shift_amount);
54 // Used to create a unique folder to dump video frames.
55 const base::Time instance_creation_time_;
57 // Used to append before file extension to create unique file name.
58 int frame_name_unique_number_;
60 DISALLOW_COPY_AND_ASSIGN(VideoFrameWriter);
63 } // namespace test
64 } // namespace remoting
66 #endif // REMOTING_TEST_VIDEO_FRAME_WRITER_H_