LCOV - code coverage report
Current view: top level - dom/media/gmp/gmp-api - gmp-video-frame-i420.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* Copyright (c) 2011, The WebRTC project authors. All rights reserved.
       3             :  * Copyright (c) 2014, Mozilla
       4             :  *
       5             :  * Redistribution and use in source and binary forms, with or without
       6             :  * modification, are permitted provided that the following conditions are
       7             :  * met:
       8             :  *
       9             :  ** Redistributions of source code must retain the above copyright
      10             :  *  notice, this list of conditions and the following disclaimer.
      11             :  *
      12             :  ** Redistributions in binary form must reproduce the above copyright
      13             :  *  notice, this list of conditions and the following disclaimer in
      14             :  *  the documentation and/or other materials provided with the
      15             :  *  distribution.
      16             :  *
      17             :  ** Neither the name of Google nor the names of its contributors may
      18             :  *  be used to endorse or promote products derived from this software
      19             :  *  without specific prior written permission.
      20             :  *
      21             :  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      22             :  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      23             :  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
      24             :  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
      25             :  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
      26             :  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
      27             :  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      28             :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      29             :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      30             :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
      31             :  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      32             :  */
      33             : 
      34             : #ifndef GMP_VIDEO_FRAME_I420_h_
      35             : #define GMP_VIDEO_FRAME_I420_h_
      36             : 
      37             : #include "gmp-errors.h"
      38             : #include "gmp-video-frame.h"
      39             : #include "gmp-video-plane.h"
      40             : 
      41             : #include <stdint.h>
      42             : 
      43             : enum GMPPlaneType {
      44             :   kGMPYPlane = 0,
      45             :   kGMPUPlane = 1,
      46             :   kGMPVPlane = 2,
      47             :   kGMPNumOfPlanes = 3
      48             : };
      49             : 
      50             : // The implementation backing this interface uses shared memory for the
      51             : // buffer(s). This means it can only be used by the "owning" process.
      52             : // At first the process which created the object owns it. When the object
      53             : // is passed to an interface the creator loses ownership and must Destroy()
      54             : // the object. Further attempts to use it may fail due to not being able to
      55             : // access the underlying buffer(s).
      56             : //
      57             : // Methods that create or destroy shared memory must be called on the main
      58             : // thread. They are marked below.
      59           0 : class GMPVideoi420Frame : public GMPVideoFrame {
      60             : public:
      61             :   // MAIN THREAD ONLY
      62             :   // CreateEmptyFrame: Sets frame dimensions and allocates buffers based
      63             :   // on set dimensions - height and plane stride.
      64             :   // If required size is bigger than the allocated one, new buffers of adequate
      65             :   // size will be allocated.
      66             :   virtual GMPErr CreateEmptyFrame(int32_t aWidth, int32_t aHeight,
      67             :                                   int32_t aStride_y, int32_t aStride_u, int32_t aStride_v) = 0;
      68             : 
      69             :   // MAIN THREAD ONLY
      70             :   // CreateFrame: Sets the frame's members and buffers. If required size is
      71             :   // bigger than allocated one, new buffers of adequate size will be allocated.
      72             :   virtual GMPErr CreateFrame(int32_t aSize_y, const uint8_t* aBuffer_y,
      73             :                              int32_t aSize_u, const uint8_t* aBuffer_u,
      74             :                              int32_t aSize_v, const uint8_t* aBuffer_v,
      75             :                              int32_t aWidth, int32_t aHeight,
      76             :                              int32_t aStride_y, int32_t aStride_u, int32_t aStride_v) = 0;
      77             : 
      78             :   // MAIN THREAD ONLY
      79             :   // Copy frame: If required size is bigger than allocated one, new buffers of
      80             :   // adequate size will be allocated.
      81             :   virtual GMPErr CopyFrame(const GMPVideoi420Frame& aVideoFrame) = 0;
      82             : 
      83             :   // Swap Frame.
      84             :   virtual void SwapFrame(GMPVideoi420Frame* aVideoFrame) = 0;
      85             : 
      86             :   // Get pointer to buffer per plane.
      87             :   virtual uint8_t* Buffer(GMPPlaneType aType) = 0;
      88             : 
      89             :   // Overloading with const.
      90             :   virtual const uint8_t* Buffer(GMPPlaneType aType) const = 0;
      91             : 
      92             :   // Get allocated size per plane.
      93             :   virtual int32_t AllocatedSize(GMPPlaneType aType) const = 0;
      94             : 
      95             :   // Get allocated stride per plane.
      96             :   virtual int32_t Stride(GMPPlaneType aType) const = 0;
      97             : 
      98             :   // Set frame width.
      99             :   virtual GMPErr SetWidth(int32_t aWidth) = 0;
     100             : 
     101             :   // Set frame height.
     102             :   virtual GMPErr SetHeight(int32_t aHeight) = 0;
     103             : 
     104             :   // Get frame width.
     105             :   virtual int32_t Width() const = 0;
     106             : 
     107             :   // Get frame height.
     108             :   virtual int32_t Height() const = 0;
     109             : 
     110             :   // Set frame timestamp (microseconds)
     111             :   virtual void SetTimestamp(uint64_t aTimestamp) = 0;
     112             : 
     113             :   // Get frame timestamp (microseconds)
     114             :   virtual uint64_t Timestamp() const = 0;
     115             : 
     116             :   // Set frame duration (microseconds)
     117             :   // NOTE: next-frame's Timestamp() != this-frame's TimeStamp()+Duration()
     118             :   // depending on rounding to avoid having to track roundoff errors
     119             :   // and dropped/missing frames(!) (which may leave a large gap)
     120             :   virtual void SetDuration(uint64_t aDuration) = 0;
     121             : 
     122             :   // Get frame duration (microseconds)
     123             :   virtual uint64_t Duration() const = 0;
     124             : 
     125             :   // Return true if underlying plane buffers are of zero size, false if not.
     126             :   virtual bool IsZeroSize() const = 0;
     127             : 
     128             :   // Reset underlying plane buffers sizes to 0. This function doesn't clear memory.
     129             :   virtual void ResetSize() = 0;
     130             : };
     131             : 
     132             : #endif // GMP_VIDEO_FRAME_I420_h_

Generated by: LCOV version 1.13