tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gmp-video-frame-encoded.h (4125B)


      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_ENCODED_h_
     35 #define GMP_VIDEO_FRAME_ENCODED_h_
     36 
     37 #include <stdint.h>
     38 
     39 #include "gmp-video-codec.h"
     40 #include "gmp-video-frame.h"
     41 
     42 enum GMPVideoFrameType {
     43  kGMPKeyFrame = 0,
     44  kGMPDeltaFrame = 1,
     45  kGMPGoldenFrame = 2,
     46  kGMPAltRefFrame = 3,
     47  kGMPSkipFrame = 4,
     48  kGMPVideoFrameInvalid = 5  // Must always be last.
     49 };
     50 
     51 // The implementation backing this interface uses shared memory for the
     52 // buffer(s). This means it can only be used by the "owning" process.
     53 // At first the process which created the object owns it. When the object
     54 // is passed to an interface the creator loses ownership and must Destroy()
     55 // the object. Further attempts to use it may fail due to not being able to
     56 // access the underlying buffer(s).
     57 //
     58 // Methods that create or destroy shared memory must be called on the main
     59 // thread. They are marked below.
     60 class GMPVideoEncodedFrame : public GMPVideoFrame {
     61 public:
     62  // MAIN THREAD ONLY
     63  virtual GMPErr CreateEmptyFrame(uint32_t aSize) = 0;
     64  // MAIN THREAD ONLY
     65  virtual GMPErr CopyFrame(const GMPVideoEncodedFrame& aVideoFrame) = 0;
     66  virtual void SetEncodedWidth(uint32_t aEncodedWidth) = 0;
     67  virtual uint32_t EncodedWidth() = 0;
     68  virtual void SetEncodedHeight(uint32_t aEncodedHeight) = 0;
     69  virtual uint32_t EncodedHeight() = 0;
     70  // Microseconds
     71  virtual void SetTimeStamp(uint64_t aTimeStamp) = 0;
     72  virtual uint64_t TimeStamp() = 0;
     73  // Set frame duration (microseconds)
     74  // NOTE: next-frame's Timestamp() != this-frame's TimeStamp()+Duration()
     75  // depending on rounding to avoid having to track roundoff errors
     76  // and dropped/missing frames(!) (which may leave a large gap)
     77  virtual void SetDuration(uint64_t aDuration) = 0;
     78  virtual uint64_t Duration() const = 0;
     79  virtual void SetFrameType(GMPVideoFrameType aFrameType) = 0;
     80  virtual GMPVideoFrameType FrameType() = 0;
     81  virtual void SetAllocatedSize(uint32_t aNewSize) = 0;
     82  virtual uint32_t AllocatedSize() = 0;
     83  virtual void SetSize(uint32_t aSize) = 0;
     84  virtual uint32_t Size() = 0;
     85  virtual void SetCompleteFrame(bool aCompleteFrame) = 0;
     86  virtual bool CompleteFrame() = 0;
     87  virtual const uint8_t* Buffer() const = 0;
     88  virtual uint8_t* Buffer() = 0;
     89  virtual GMPBufferType BufferType() const = 0;
     90  virtual void SetBufferType(GMPBufferType aBufferType) = 0;
     91  virtual void SetTemporalLayerId(int32_t aLayerId) = 0;
     92  virtual int32_t GetTemporalLayerId() = 0;
     93 };
     94 
     95 #endif  // GMP_VIDEO_FRAME_ENCODED_h_