Frame.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2016-2023, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of NVIDIA CORPORATION nor the names of its
  13. * contributors may be used to endorse or promote products derived
  14. * from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  24. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef _EGLSTREAM_FRAME_H
  29. #define _EGLSTREAM_FRAME_H
  30. namespace EGLStream
  31. {
  32. class Image;
  33. /**
  34. * Frame objects are acquired and returned by a FrameConsumer, and correspond
  35. * to frames that have been written to the stream. Frames contain metadata
  36. * corresponsing to the stream frame as well as the Image data of the frame.
  37. * Destroying a Frame will return its image buffers back to the stream for reuse.
  38. */
  39. class Frame : public Argus::InterfaceProvider, public Argus::Destructable
  40. {
  41. protected:
  42. ~Frame() {}
  43. };
  44. /**
  45. * @class IFrame
  46. *
  47. * Interface that provides core access to a Frame.
  48. */
  49. DEFINE_UUID(Argus::InterfaceID, IID_FRAME, 546F4520,87EF,11E5,A837,08,00,20,0C,9A,66);
  50. class IFrame : public Argus::Interface
  51. {
  52. public:
  53. static const Argus::InterfaceID& id() { return IID_FRAME; }
  54. /**
  55. * Returns the frame number.
  56. */
  57. virtual uint64_t getNumber() const = 0;
  58. /**
  59. * Returns the timestamp of the frame, in nanoseconds.
  60. */
  61. virtual uint64_t getTime() const = 0;
  62. /**
  63. * Returns the Image contained in the Frame. The returned Image object is
  64. * owned by the Frame and is valid as long as the Frame is valid. (that is, while
  65. * the Frame is acquired).
  66. */
  67. virtual Image* getImage() = 0;
  68. /**
  69. * Release the frame and Image contained in the frame.
  70. */
  71. virtual void releaseFrame() = 0;
  72. protected:
  73. ~IFrame() {}
  74. };
  75. } // namespace EGLStream
  76. #endif // _EGLSTREAM_FRAME_H