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