video_stream_decoder.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef API_VIDEO_VIDEO_STREAM_DECODER_H_
  11. #define API_VIDEO_VIDEO_STREAM_DECODER_H_
  12. #include <map>
  13. #include <memory>
  14. #include <utility>
  15. #include "api/units/time_delta.h"
  16. #include "api/video/encoded_frame.h"
  17. #include "api/video/video_frame.h"
  18. #include "api/video_codecs/sdp_video_format.h"
  19. #include "api/video_codecs/video_decoder_factory.h"
  20. namespace webrtc {
  21. // NOTE: This class is still under development and may change without notice.
  22. class VideoStreamDecoderInterface {
  23. public:
  24. class Callbacks {
  25. public:
  26. virtual ~Callbacks() = default;
  27. // Called when the VideoStreamDecoder enters a non-decodable state.
  28. virtual void OnNonDecodableState() = 0;
  29. // Called with the last continuous frame.
  30. virtual void OnContinuousUntil(
  31. const video_coding::VideoLayerFrameId& key) = 0;
  32. // Called with the decoded frame.
  33. virtual void OnDecodedFrame(VideoFrame decodedImage,
  34. absl::optional<int> decode_time_ms,
  35. absl::optional<int> qp) = 0;
  36. };
  37. virtual ~VideoStreamDecoderInterface() = default;
  38. virtual void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) = 0;
  39. virtual void SetMinPlayoutDelay(TimeDelta min_delay) = 0;
  40. virtual void SetMaxPlayoutDelay(TimeDelta max_delay) = 0;
  41. };
  42. } // namespace webrtc
  43. #endif // API_VIDEO_VIDEO_STREAM_DECODER_H_