philipel | 2fee4d6 | 2018-03-21 16:52:13 +0100 | [diff] [blame] | 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/video/encoded_frame.h" |
| 19 | #include "api/video/video_frame.h" |
| 20 | #include "api/video_codecs/sdp_video_format.h" |
| 21 | #include "api/video_codecs/video_decoder_factory.h" |
| 22 | |
| 23 | namespace webrtc { |
philipel | 2fee4d6 | 2018-03-21 16:52:13 +0100 | [diff] [blame] | 24 | // NOTE: This class is still under development and may change without notice. |
| 25 | class VideoStreamDecoder { |
| 26 | public: |
| 27 | class Callbacks { |
| 28 | public: |
| 29 | virtual ~Callbacks() = default; |
| 30 | |
| 31 | // Called when the VideoStreamDecoder enters a non-decodable state. |
| 32 | virtual void OnNonDecodableState() = 0; |
| 33 | |
| 34 | // Called with the last continuous frame. |
philipel | 9718711 | 2018-03-23 10:43:21 +0100 | [diff] [blame] | 35 | virtual void OnContinuousUntil( |
| 36 | const video_coding::VideoLayerFrameId& key) = 0; |
philipel | 2fee4d6 | 2018-03-21 16:52:13 +0100 | [diff] [blame] | 37 | |
| 38 | // Called with the decoded frame. |
| 39 | virtual void OnDecodedFrame(VideoFrame decodedImage, |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 40 | absl::optional<int> decode_time_ms, |
| 41 | absl::optional<int> qp) = 0; |
philipel | 2fee4d6 | 2018-03-21 16:52:13 +0100 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | virtual ~VideoStreamDecoder() = default; |
| 45 | |
| 46 | virtual void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) = 0; |
| 47 | }; |
| 48 | |
| 49 | } // namespace webrtc |
| 50 | |
| 51 | #endif // API_VIDEO_VIDEO_STREAM_DECODER_H_ |