blob: b1d8c7d42c08ecf0a8ca264b3baf0d1afc45c5e1 [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:
23 VideoCoder(WebRtc_UWord32 instanceID);
24 ~VideoCoder();
25
pwestin@webrtc.org52fd98d2012-02-13 09:03:53 +000026 WebRtc_Word32 ResetDecoder();
niklase@google.com470e71d2011-07-07 08:21:25 +000027
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.org9fedff72012-10-24 18:33:04 +000038 WebRtc_Word32 Decode(I420VideoFrame& decodedVideo,
niklase@google.com470e71d2011-07-07 08:21:25 +000039 const EncodedVideoData& encodedData);
40
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000041 WebRtc_Word32 Encode(const I420VideoFrame& videoFrame,
niklase@google.com470e71d2011-07-07 08:21:25 +000042 EncodedVideoData& videoEncodedData);
43
pwestin@webrtc.org52fd98d2012-02-13 09:03:53 +000044 WebRtc_Word8 DefaultPayloadType(const char* plName);
niklase@google.com470e71d2011-07-07 08:21:25 +000045
46private:
47 // VCMReceiveCallback function.
48 // Note: called by VideoCodingModule when decoding finished.
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000049 WebRtc_Word32 FrameToRender(I420VideoFrame& videoFrame);
niklase@google.com470e71d2011-07-07 08:21:25 +000050
51 // VCMPacketizationCallback function.
52 // Note: called by VideoCodingModule when encoding finished.
53 WebRtc_Word32 SendData(
andrew@webrtc.orgcdfa63f2012-08-10 22:56:17 +000054 FrameType /*frameType*/,
55 WebRtc_UWord8 /*payloadType*/,
56 WebRtc_UWord32 /*timeStamp*/,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +000057 int64_t capture_time_ms,
niklase@google.com470e71d2011-07-07 08:21:25 +000058 const WebRtc_UWord8* payloadData,
andrew@webrtc.orgcdfa63f2012-08-10 22:56:17 +000059 WebRtc_UWord32 payloadSize,
niklase@google.com470e71d2011-07-07 08:21:25 +000060 const RTPFragmentationHeader& /* fragmentationHeader*/,
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000061 const RTPVideoHeader* rtpTypeHdr);
niklase@google.com470e71d2011-07-07 08:21:25 +000062
niklase@google.com470e71d2011-07-07 08:21:25 +000063 VideoCodingModule* _vcm;
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000064 I420VideoFrame* _decodedVideo;
niklase@google.com470e71d2011-07-07 08:21:25 +000065 EncodedVideoData* _videoEncodedData;
66};
67} // namespace webrtc
68#endif // WEBRTC_MODULE_UTILITY_VIDEO
69#endif // WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_