aboutsummaryrefslogtreecommitdiff
path: root/webrtc/video_encoder.h
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org>2014-09-17 09:02:25 +0000
committerpbos@webrtc.org <pbos@webrtc.org>2014-09-17 09:02:25 +0000
commitab990ae43a2b84b103cb3c50bc38502375c13e68 (patch)
tree2585e6962d23200f41a2fc87059eb915edac599f /webrtc/video_encoder.h
parent6a9b155798ebe0854f035de61bae79460060f3d3 (diff)
downloadwebrtc-ab990ae43a2b84b103cb3c50bc38502375c13e68.tar.gz
Revert 7151 "Revert 7114 "Expose VideoEncoders with webrtc/video_encoder.h.""
Re-lands r7114 after landing r7204 to adress the compile error causing the rollback in r7151. BUG=3070 TBR=henrikg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/28489004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7207 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'webrtc/video_encoder.h')
-rw-r--r--webrtc/video_encoder.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/webrtc/video_encoder.h b/webrtc/video_encoder.h
new file mode 100644
index 0000000000..6d57d9264b
--- /dev/null
+++ b/webrtc/video_encoder.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_VIDEO_ENCODER_H_
+#define WEBRTC_VIDEO_ENCODER_H_
+
+#include <vector>
+
+#include "webrtc/typedefs.h"
+#include "webrtc/video_frame.h"
+
+namespace webrtc {
+
+class RTPFragmentationHeader;
+// TODO(pbos): Expose these through a public (root) header or change these APIs.
+struct CodecSpecificInfo;
+struct VideoCodec;
+
+class EncodedImageCallback {
+ public:
+ virtual ~EncodedImageCallback() {}
+
+ // Callback function which is called when an image has been encoded.
+ // TODO(pbos): Make encoded_image const or pointer. Remove default arguments.
+ virtual int32_t Encoded(
+ EncodedImage& encoded_image,
+ const CodecSpecificInfo* codec_specific_info = NULL,
+ const RTPFragmentationHeader* fragmentation = NULL) = 0;
+};
+
+class VideoEncoder {
+ public:
+ enum EncoderType {
+ kVp8,
+ };
+
+ static VideoEncoder* Create(EncoderType codec_type);
+
+ virtual ~VideoEncoder() {}
+
+ virtual int32_t InitEncode(const VideoCodec* codec_settings,
+ int32_t number_of_cores,
+ uint32_t max_payload_size) = 0;
+ virtual int32_t RegisterEncodeCompleteCallback(
+ EncodedImageCallback* callback) = 0;
+ virtual int32_t Release() = 0;
+
+
+ virtual int32_t Encode(const I420VideoFrame& frame,
+ const CodecSpecificInfo* codec_specific_info,
+ const std::vector<VideoFrameType>* frame_types) = 0;
+
+ virtual int32_t SetChannelParameters(uint32_t packet_loss, int rtt) = 0;
+ virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0;
+
+ virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; }
+ virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/, int32_t /*size*/) {
+ return -1;
+ }
+};
+
+} // namespace webrtc
+#endif // WEBRTC_VIDEO_ENCODER_H_