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: |
| 23 | VideoCoder(WebRtc_UWord32 instanceID); |
| 24 | ~VideoCoder(); |
| 25 | |
pwestin@webrtc.org | 52fd98d | 2012-02-13 09:03:53 +0000 | [diff] [blame] | 26 | WebRtc_Word32 ResetDecoder(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
| 28 | WebRtc_Word32 SetEncodeCodec(VideoCodec& videoCodecInst, |
| 29 | WebRtc_UWord32 numberOfCores, |
| 30 | WebRtc_UWord32 maxPayloadSize); |
| 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. |
| 35 | WebRtc_Word32 SetDecodeCodec(VideoCodec& videoCodecInst, |
| 36 | WebRtc_Word32 numberOfCores); |
| 37 | |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame^] | 38 | WebRtc_Word32 Decode(I420VideoFrame& decodedVideo, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | const EncodedVideoData& encodedData); |
| 40 | |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame^] | 41 | WebRtc_Word32 Encode(const I420VideoFrame& videoFrame, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | EncodedVideoData& videoEncodedData); |
| 43 | |
pwestin@webrtc.org | 52fd98d | 2012-02-13 09:03:53 +0000 | [diff] [blame] | 44 | WebRtc_Word8 DefaultPayloadType(const char* plName); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | // VCMReceiveCallback function. |
| 48 | // Note: called by VideoCodingModule when decoding finished. |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame^] | 49 | WebRtc_Word32 FrameToRender(I420VideoFrame& videoFrame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 50 | |
| 51 | // VCMPacketizationCallback function. |
| 52 | // Note: called by VideoCodingModule when encoding finished. |
| 53 | WebRtc_Word32 SendData( |
andrew@webrtc.org | cdfa63f | 2012-08-10 22:56:17 +0000 | [diff] [blame] | 54 | FrameType /*frameType*/, |
| 55 | WebRtc_UWord8 /*payloadType*/, |
| 56 | WebRtc_UWord32 /*timeStamp*/, |
stefan@webrtc.org | ddfdfed | 2012-07-03 13:21:22 +0000 | [diff] [blame] | 57 | int64_t capture_time_ms, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | const WebRtc_UWord8* payloadData, |
andrew@webrtc.org | cdfa63f | 2012-08-10 22:56:17 +0000 | [diff] [blame] | 59 | WebRtc_UWord32 payloadSize, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | const RTPFragmentationHeader& /* fragmentationHeader*/, |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 61 | const RTPVideoHeader* rtpTypeHdr); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 62 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | VideoCodingModule* _vcm; |
mikhal@webrtc.org | 9fedff7 | 2012-10-24 18:33:04 +0000 | [diff] [blame^] | 64 | I420VideoFrame* _decodedVideo; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 65 | EncodedVideoData* _videoEncodedData; |
| 66 | }; |
| 67 | } // namespace webrtc |
| 68 | #endif // WEBRTC_MODULE_UTILITY_VIDEO |
| 69 | #endif // WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_ |