blob: 2f3b769c1204dfd602ae0898053ca2529fb58f47 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
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
19namespace webrtc {
20class VideoCoder : public VCMPacketizationCallback, public VCMReceiveCallback
21{
22public:
23 VideoCoder(WebRtc_UWord32 instanceID);
24 ~VideoCoder();
25
26 WebRtc_Word32 Reset();
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
38 WebRtc_Word32 CodecConfigParameters(WebRtc_UWord8* buffer,
39 WebRtc_Word32 size);
40
41 WebRtc_Word32 SetCodecConfigParameters(WebRtc_UWord8 payloadType,
42 const WebRtc_UWord8* buffer,
43 WebRtc_Word32 length);
44
45 WebRtc_Word32 Decode(VideoFrame& decodedVideo,
46 const EncodedVideoData& encodedData);
47
48 WebRtc_Word32 Encode(const VideoFrame& videoFrame,
49 EncodedVideoData& videoEncodedData);
50
51 WebRtc_Word8 DefaultPayloadType(const WebRtc_Word8* plName);
52
53private:
54 // VCMReceiveCallback function.
55 // Note: called by VideoCodingModule when decoding finished.
56 WebRtc_Word32 FrameToRender(VideoFrame& videoFrame);
57
58 // VCMPacketizationCallback function.
59 // Note: called by VideoCodingModule when encoding finished.
60 WebRtc_Word32 SendData(
61 const FrameType /*frameType*/,
62 const WebRtc_UWord8 /*payloadType*/,
63 const WebRtc_UWord32 /*timeStamp*/,
64 const WebRtc_UWord8* payloadData,
65 const WebRtc_UWord32 payloadSize,
66 const RTPFragmentationHeader& /* fragmentationHeader*/,
67 const RTPVideoTypeHeader* rtpTypeHdr);
68
69 WebRtc_UWord32 _instanceID;
70 VideoCodingModule* _vcm;
71 VideoFrame* _decodedVideo;
72 EncodedVideoData* _videoEncodedData;
73};
74} // namespace webrtc
75#endif // WEBRTC_MODULE_UTILITY_VIDEO
76#endif // WEBRTC_MODULES_UTILITY_SOURCE_VIDEO_CODER_H_