| Index: third_party/openh264/testing/h264_encoder_impl.h
|
| diff --git a/third_party/openh264/testing/h264_encoder_impl.h b/third_party/openh264/testing/h264_encoder_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..91ab4c8e964b6aef2fd8d87baa6ecc2dc5151558
|
| --- /dev/null
|
| +++ b/third_party/openh264/testing/h264_encoder_impl.h
|
| @@ -0,0 +1,84 @@
|
| +/*
|
| + * Copyright (c) 2015 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.
|
| + *
|
| + */
|
| +
|
| +// TODO(hbos): This is essentially a copy of an encoder class in WebRTC that as
|
| +// of this statement has not yet landed, but that I want to have accessible in
|
| +// Chromium before that CL lands. This is because I use it in order to validate
|
| +// the build files for OpenH264 and the WebRTC encoder/decoder CL cannot land
|
| +// until I can build OpenH264 from source. Once the build files are stable I
|
| +// will land both CLs and remove this copy of the encoder.
|
| +
|
| +#ifndef OPENH264_TESTING_H264_ENCODER_IMPL_H_
|
| +#define OPENH264_TESTING_H264_ENCODER_IMPL_H_
|
| +
|
| +#include "webrtc/base/scoped_ptr.h"
|
| +#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
|
| +
|
| +#include <vector>
|
| +
|
| +class ISVCEncoder;
|
| +
|
| +using webrtc::CodecSpecificInfo;
|
| +using webrtc::EncodedImage;
|
| +using webrtc::EncodedImageCallback;
|
| +using webrtc::FrameType;
|
| +using webrtc::VideoCodec;
|
| +using webrtc::VideoEncoder;
|
| +using webrtc::VideoFrame;
|
| +
|
| +namespace openh264 {
|
| +
|
| +class H264EncoderImpl : public webrtc::H264Encoder {
|
| + public:
|
| + H264EncoderImpl();
|
| + ~H264EncoderImpl() override;
|
| +
|
| + // |number_of_cores| and |max_payload_size| are ignored.
|
| + // The following members of |codec_settings| are used. The rest are ignored.
|
| + // - codecType (must be kVideoCodecH264)
|
| + // - targetBitrate
|
| + // - maxFramerate
|
| + // - width
|
| + // - height
|
| + int32_t InitEncode(const VideoCodec* codec_settings,
|
| + int32_t /*number_of_cores*/,
|
| + size_t /*max_payload_size*/) override;
|
| + int32_t Release() override;
|
| +
|
| + int32_t RegisterEncodeCompleteCallback(
|
| + EncodedImageCallback* callback) override;
|
| + int32_t SetRates(uint32_t bitrate, uint32_t framerate) override;
|
| +
|
| + // The result of encoding - an EncodedImage and RTPFragmentationHeader - are
|
| + // passed to the encode complete callback.
|
| + int32_t Encode(const VideoFrame& frame,
|
| + const CodecSpecificInfo* codec_specific_info,
|
| + const std::vector<FrameType>* frame_types) override;
|
| +
|
| + bool IsInitialized();
|
| +
|
| + // Unsupported / Do nothing.
|
| + int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
|
| + int32_t SetPeriodicKeyFrames(bool enable) override;
|
| + void OnDroppedFrame() override;
|
| +
|
| + private:
|
| + ISVCEncoder* openh264_encoder_;
|
| + VideoCodec codec_settings_;
|
| +
|
| + EncodedImage encoded_image_;
|
| + rtc::scoped_ptr<uint8_t[]> encoded_image_buffer_;
|
| + EncodedImageCallback* encoded_image_callback_;
|
| +};
|
| +
|
| +} // namespace openh264
|
| +
|
| +#endif // OPENH264_TESTING_H264_ENCODER_IMPL_H_
|
|
|