blob: c69c3e46d468e66d63e03f48417be793cc3ee256 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.org52fd98d2012-02-13 09:03:53 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
19namespace webrtc {
20class VideoCoder : public VCMPacketizationCallback, public VCMReceiveCallback
21{
22public:
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000023 VideoCoder(uint32_t instanceID);
niklase@google.com470e71d2011-07-07 08:21:25 +000024 ~VideoCoder();
25
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000026 int32_t ResetDecoder();
niklase@google.com470e71d2011-07-07 08:21:25 +000027
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000028 int32_t SetEncodeCodec(VideoCodec& videoCodecInst,
29 uint32_t numberOfCores,
30 uint32_t maxPayloadSize);
niklase@google.com470e71d2011-07-07 08:21:25 +000031
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.orgc75102e2013-04-09 13:32:55 +000035 int32_t SetDecodeCodec(VideoCodec& videoCodecInst, int32_t numberOfCores);
niklase@google.com470e71d2011-07-07 08:21:25 +000036
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000037 int32_t Decode(I420VideoFrame& decodedVideo,
38 const EncodedVideoData& encodedData);
niklase@google.com470e71d2011-07-07 08:21:25 +000039
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000040 int32_t Encode(const I420VideoFrame& videoFrame,
41 EncodedVideoData& videoEncodedData);
niklase@google.com470e71d2011-07-07 08:21:25 +000042
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000043 int8_t DefaultPayloadType(const char* plName);
niklase@google.com470e71d2011-07-07 08:21:25 +000044
45private:
46 // VCMReceiveCallback function.
47 // Note: called by VideoCodingModule when decoding finished.
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000048 int32_t FrameToRender(I420VideoFrame& videoFrame);
niklase@google.com470e71d2011-07-07 08:21:25 +000049
50 // VCMPacketizationCallback function.
51 // Note: called by VideoCodingModule when encoding finished.
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000052 int32_t SendData(
andrew@webrtc.orgcdfa63f2012-08-10 22:56:17 +000053 FrameType /*frameType*/,
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000054 uint8_t /*payloadType*/,
55 uint32_t /*timeStamp*/,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +000056 int64_t capture_time_ms,
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000057 const uint8_t* payloadData,
58 uint32_t payloadSize,
niklase@google.com470e71d2011-07-07 08:21:25 +000059 const RTPFragmentationHeader& /* fragmentationHeader*/,
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000060 const RTPVideoHeader* rtpTypeHdr);
niklase@google.com470e71d2011-07-07 08:21:25 +000061
niklase@google.com470e71d2011-07-07 08:21:25 +000062 VideoCodingModule* _vcm;
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000063 I420VideoFrame* _decodedVideo;
niklase@google.com470e71d2011-07-07 08:21:25 +000064 EncodedVideoData* _videoEncodedData;
65};
66} // namespace webrtc
67#endif // WEBRTC_MODULE_UTILITY_VIDEO
68#endif // WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_