video_stream_decoder.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_content_type.h"
  18. #include "api/video/video_frame.h"
  19. #include "api/video_codecs/sdp_video_format.h"
  20. #include "api/video_codecs/video_decoder_factory.h"
  21. namespace webrtc {
  22. // NOTE: This class is still under development and may change without notice.
  23. class VideoStreamDecoderInterface {
  24. public:
  25. class Callbacks {
  26. public:
  27. virtual ~Callbacks() = default;
  28. struct FrameInfo {
  29. absl::optional<int> decode_time_ms;
  30. absl::optional<int> qp;
  31. VideoContentType content_type;
  32. };
  33. // Called when the VideoStreamDecoder enters a non-decodable state.
  34. virtual void OnNonDecodableState() = 0;
  35. // Called with the last continuous frame.
  36. virtual void OnContinuousUntil(
  37. const video_coding::VideoLayerFrameId& key) = 0;
  38. virtual void OnDecodedFrame(VideoFrame frame,
  39. const FrameInfo& frame_info) = 0;
  40. };
  41. virtual ~VideoStreamDecoderInterface() = default;
  42. virtual void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) = 0;
  43. virtual void SetMinPlayoutDelay(TimeDelta min_delay) = 0;
  44. virtual void SetMaxPlayoutDelay(TimeDelta max_delay) = 0;
  45. };
  46. } // namespace webrtc
  47. #endif // API_VIDEO_VIDEO_STREAM_DECODER_H_