Sample.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteBuffer.h>
  8. #include <AK/Time.h>
  9. #include <LibVideo/Color/CodingIndependentCodePoints.h>
  10. namespace Video {
  11. class Sample {
  12. public:
  13. virtual ~Sample() = default;
  14. virtual bool is_video_sample() const { return false; }
  15. };
  16. class VideoSample : public Sample {
  17. public:
  18. VideoSample(ReadonlyBytes data, CodingIndependentCodePoints container_cicp, Duration timestamp)
  19. : m_data(data)
  20. , m_container_cicp(container_cicp)
  21. , m_timestamp(timestamp)
  22. {
  23. }
  24. bool is_video_sample() const override { return true; }
  25. ReadonlyBytes const& data() const { return m_data; }
  26. CodingIndependentCodePoints container_cicp() const { return m_container_cicp; }
  27. Duration timestamp() const { return m_timestamp; }
  28. private:
  29. ReadonlyBytes m_data;
  30. CodingIndependentCodePoints m_container_cicp;
  31. Duration m_timestamp;
  32. };
  33. // FIXME: Add samples for audio, subtitles, etc.
  34. }