blob: 03aa511147b01ae376964a79a80e0844018ce023 [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
pbos@webrtc.org8b062002013-07-12 08:28:10 +000016#include "webrtc/engine_configurations.h"
17#include "webrtc/modules/video_coding/main/interface/video_coding.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
19namespace webrtc {
20class VideoCoder : public VCMPacketizationCallback, public VCMReceiveCallback
21{
22public:
stefan@webrtc.org34c5da62014-04-11 14:08:35 +000023 VideoCoder();
niklase@google.com470e71d2011-07-07 08:21:25 +000024 ~VideoCoder();
25
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000026 int32_t SetEncodeCodec(VideoCodec& videoCodecInst,
27 uint32_t numberOfCores,
28 uint32_t maxPayloadSize);
niklase@google.com470e71d2011-07-07 08:21:25 +000029
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.orgc75102e2013-04-09 13:32:55 +000033 int32_t SetDecodeCodec(VideoCodec& videoCodecInst, int32_t numberOfCores);
niklase@google.com470e71d2011-07-07 08:21:25 +000034
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000035 int32_t Decode(I420VideoFrame& decodedVideo,
36 const EncodedVideoData& encodedData);
niklase@google.com470e71d2011-07-07 08:21:25 +000037
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000038 int32_t Encode(const I420VideoFrame& videoFrame,
39 EncodedVideoData& videoEncodedData);
niklase@google.com470e71d2011-07-07 08:21:25 +000040
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000041 int8_t DefaultPayloadType(const char* plName);
niklase@google.com470e71d2011-07-07 08:21:25 +000042
43private:
44 // VCMReceiveCallback function.
45 // Note: called by VideoCodingModule when decoding finished.
henrike@webrtc.orgcc774a62014-09-11 22:45:54 +000046 virtual int32_t FrameToRender(I420VideoFrame& videoFrame) OVERRIDE;
niklase@google.com470e71d2011-07-07 08:21:25 +000047
48 // VCMPacketizationCallback function.
49 // Note: called by VideoCodingModule when encoding finished.
henrike@webrtc.orgcc774a62014-09-11 22:45:54 +000050 virtual int32_t SendData(
andrew@webrtc.orgcdfa63f2012-08-10 22:56:17 +000051 FrameType /*frameType*/,
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000052 uint8_t /*payloadType*/,
53 uint32_t /*timeStamp*/,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +000054 int64_t capture_time_ms,
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000055 const uint8_t* payloadData,
56 uint32_t payloadSize,
niklase@google.com470e71d2011-07-07 08:21:25 +000057 const RTPFragmentationHeader& /* fragmentationHeader*/,
henrike@webrtc.orgcc774a62014-09-11 22:45:54 +000058 const RTPVideoHeader* rtpTypeHdr) OVERRIDE;
niklase@google.com470e71d2011-07-07 08:21:25 +000059
niklase@google.com470e71d2011-07-07 08:21:25 +000060 VideoCodingModule* _vcm;
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000061 I420VideoFrame* _decodedVideo;
niklase@google.com470e71d2011-07-07 08:21:25 +000062 EncodedVideoData* _videoEncodedData;
63};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000064} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000065#endif // WEBRTC_MODULE_UTILITY_VIDEO
66#endif // WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_