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 11 #ifndef API_VIDEO_VIDEO_STREAM_DECODER_H_ 12 #define API_VIDEO_VIDEO_STREAM_DECODER_H_ 13 14 #include <map> 15 #include <memory> 16 #include <utility> 17 18 #include "api/units/time_delta.h" 19 #include "api/video/encoded_frame.h" 20 #include "api/video/video_content_type.h" 21 #include "api/video/video_frame.h" 22 #include "api/video_codecs/sdp_video_format.h" 23 #include "api/video_codecs/video_decoder_factory.h" 24 25 namespace webrtc { 26 // NOTE: This class is still under development and may change without notice. 27 class VideoStreamDecoderInterface { 28 public: 29 class Callbacks { 30 public: 31 virtual ~Callbacks() = default; 32 33 struct FrameInfo { 34 absl::optional<int> qp; 35 VideoContentType content_type; 36 }; 37 38 // Called when the VideoStreamDecoder enters a non-decodable state. 39 virtual void OnNonDecodableState() = 0; 40 OnContinuousUntil(int64_t frame_id)41 virtual void OnContinuousUntil(int64_t frame_id) {} 42 43 virtual void OnDecodedFrame(VideoFrame frame, 44 const FrameInfo& frame_info) = 0; 45 }; 46 47 virtual ~VideoStreamDecoderInterface() = default; 48 49 virtual void OnFrame(std::unique_ptr<EncodedFrame> frame) = 0; 50 51 virtual void SetMinPlayoutDelay(TimeDelta min_delay) = 0; 52 virtual void SetMaxPlayoutDelay(TimeDelta max_delay) = 0; 53 }; 54 55 } // namespace webrtc 56 57 #endif // API_VIDEO_VIDEO_STREAM_DECODER_H_ 58