niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | 52fd98d | 2012-02-13 09:03:53 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_ |
| 12 | #define WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_ |
| 13 | |
| 14 | #ifdef WEBRTC_MODULE_UTILITY_VIDEO |
| 15 | |
| 16 | #include "engine_configurations.h" |
| 17 | #include "video_coding.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | class VideoCoder : public VCMPacketizationCallback, public VCMReceiveCallback |
| 21 | { |
| 22 | public: |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 23 | VideoCoder(uint32_t instanceID); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | ~VideoCoder(); |
| 25 | |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 26 | int32_t ResetDecoder(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 28 | int32_t SetEncodeCodec(VideoCodec& videoCodecInst, |
| 29 | uint32_t numberOfCores, |
| 30 | uint32_t maxPayloadSize); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
| 32 | |
| 33 | // Select the codec that should be used for decoding. videoCodecInst.plType |
| 34 | // will be set to the codec's default payload type. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 35 | int32_t SetDecodeCodec(VideoCodec& videoCodecInst, int32_t numberOfCores); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 37 | int32_t Decode(I420VideoFrame& decodedVideo, |
| 38 | const EncodedVideoData& encodedData); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 40 | int32_t Encode(const I420VideoFrame& videoFrame, |
| 41 | EncodedVideoData& videoEncodedData); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 43 | int8_t DefaultPayloadType(const char* plName); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
| 45 | private: |
| 46 | // VCMReceiveCallback function. |
| 47 | // Note: called by VideoCodingModule when decoding finished. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 48 | int32_t FrameToRender(I420VideoFrame& videoFrame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | |
| 50 | // VCMPacketizationCallback function. |
| 51 | // Note: called by VideoCodingModule when encoding finished. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 52 | int32_t SendData( |
andrew@webrtc.org | cdfa63f | 2012-08-10 22:56:17 +0000 | [diff] [blame] | 53 | FrameType /*frameType*/, |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 54 | uint8_t /*payloadType*/, |
| 55 | uint32_t /*timeStamp*/, |
stefan@webrtc.org | ddfdfed | 2012-07-03 13:21:22 +0000 | [diff] [blame] | 56 | int64_t capture_time_ms, |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 57 | const uint8_t* payloadData, |
| 58 | uint32_t payloadSize, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | const RTPFragmentationHeader& /* fragmentationHeader*/, |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 60 | const RTPVideoHeader* rtpTypeHdr); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 61 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 62 | VideoCodingModule* _vcm; |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame] | 63 | I420VideoFrame* _decodedVideo; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 64 | EncodedVideoData* _videoEncodedData; |
| 65 | }; |
| 66 | } // namespace webrtc |
| 67 | #endif // WEBRTC_MODULE_UTILITY_VIDEO |
| 68 | #endif // WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_ |