pbos@webrtc.org | 776e6f2 | 2014-10-29 15:28:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 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 WEBRTC_VIDEO_DECODER_H_ |
| 12 | #define WEBRTC_VIDEO_DECODER_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "webrtc/common_types.h" |
| 17 | #include "webrtc/typedefs.h" |
| 18 | #include "webrtc/video_frame.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | class RTPFragmentationHeader; |
| 23 | // TODO(pbos): Expose these through a public (root) header or change these APIs. |
| 24 | struct CodecSpecificInfo; |
| 25 | struct VideoCodec; |
| 26 | |
| 27 | class DecodedImageCallback { |
| 28 | public: |
| 29 | virtual ~DecodedImageCallback() {} |
| 30 | |
magjed@webrtc.org | 2056ee3 | 2015-03-16 13:46:52 +0000 | [diff] [blame] | 31 | virtual int32_t Decoded(I420VideoFrame& decodedImage) = 0; |
pbos@webrtc.org | 776e6f2 | 2014-10-29 15:28:39 +0000 | [diff] [blame] | 32 | virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) { |
| 33 | return -1; |
| 34 | } |
| 35 | |
| 36 | virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; } |
| 37 | }; |
| 38 | |
| 39 | class VideoDecoder { |
| 40 | public: |
| 41 | enum DecoderType { |
| 42 | kVp8, |
stefan@webrtc.org | 7c29e8c | 2014-11-04 19:41:15 +0000 | [diff] [blame] | 43 | kVp9 |
pbos@webrtc.org | 776e6f2 | 2014-10-29 15:28:39 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | static VideoDecoder* Create(DecoderType codec_type); |
| 47 | |
| 48 | virtual ~VideoDecoder() {} |
| 49 | |
| 50 | virtual int32_t InitDecode(const VideoCodec* codecSettings, |
| 51 | int32_t numberOfCores) = 0; |
| 52 | |
| 53 | virtual int32_t Decode(const EncodedImage& inputImage, |
| 54 | bool missingFrames, |
| 55 | const RTPFragmentationHeader* fragmentation, |
| 56 | const CodecSpecificInfo* codecSpecificInfo = NULL, |
| 57 | int64_t renderTimeMs = -1) = 0; |
| 58 | |
| 59 | virtual int32_t RegisterDecodeCompleteCallback( |
| 60 | DecodedImageCallback* callback) = 0; |
| 61 | |
| 62 | virtual int32_t Release() = 0; |
| 63 | virtual int32_t Reset() = 0; |
| 64 | |
| 65 | virtual int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/, |
| 66 | int32_t /*size*/) { |
| 67 | return -1; |
| 68 | } |
| 69 | |
| 70 | virtual VideoDecoder* Copy() { return NULL; } |
| 71 | }; |
| 72 | |
| 73 | } // namespace webrtc |
| 74 | |
| 75 | #endif // WEBRTC_VIDEO_DECODER_H_ |