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"
22 // A helper class to dump video frames to disk.
23 class 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
37 void HighlightRectInFrame(webrtc::DesktopFrame
* frame
,
38 const webrtc::DesktopRect
& rect
);
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
,
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
);
64 } // namespace remoting
66 #endif // REMOTING_TEST_VIDEO_FRAME_WRITER_H_