1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et ft=cpp : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_VideoFrameUtil_h
8 #define mozilla_VideoFrameUtil_h
10 #include "mozilla/camera/PCameras.h"
19 // Util methods for working with webrtc::VideoFrame(s) and
20 // the IPC classes that are used to deliver their contents to the
23 class VideoFrameUtils
{
25 // Returns the total number of bytes necessary to copy a VideoFrame's buffer
27 static uint32_t TotalRequiredBufferSize(const webrtc::VideoFrame
& frame
);
29 // Initializes a camera::VideoFrameProperties from a VideoFrameBuffer
30 static void InitFrameBufferProperties(
31 const webrtc::VideoFrame
& aVideoFrame
,
32 camera::VideoFrameProperties
& aDestProperties
);
34 // Copies the buffers out of a VideoFrameBuffer into a buffer.
35 // Attempts to make as few memcopies as possible.
36 static void CopyVideoFrameBuffers(uint8_t* aDestBuffer
,
37 const size_t aDestBufferSize
,
38 const webrtc::VideoFrame
& aVideoFrame
);
40 // Copies the buffers in a VideoFrameBuffer into a Shmem
41 // returns the eno from the underlying memcpy.
42 static void CopyVideoFrameBuffers(ShmemBuffer
& aDestShmem
,
43 const webrtc::VideoFrame
& aVideoFrame
);
46 } /* namespace mozilla */