Create experimental Obj-C++ API.

This can be used to wrap Objective-C components in C++ classes, so users
can use the WebRTC C++ API directly together with the iOS specific
components provided by our SDK.

Bug: webrtc:8832
Change-Id: I6d34f7ec62d51df8d3a5340a2e17d30ae73e13e8
Reviewed-on: https://webrtc-review.googlesource.com/46162
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21850}
This commit is contained in:
Anders Carlsson
2018-02-01 15:47:05 +01:00
committed by Commit Bot
parent bc3b782813
commit 3ff50fba59
24 changed files with 700 additions and 34 deletions

View File

@ -0,0 +1,27 @@
/*
* Copyright 2018 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 SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_DECODER_FACTORY_H_
#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_DECODER_FACTORY_H_
#include <memory>
#import "WebRTC/RTCVideoCodecFactory.h"
#include "api/video_codecs/video_decoder_factory.h"
namespace webrtc {
std::unique_ptr<VideoDecoderFactory> ObjCToNativeVideoDecoderFactory(
id<RTCVideoDecoderFactory> objc_video_decoder_factory);
} // namespace webrtc
#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_DECODER_FACTORY_H_

View File

@ -0,0 +1,23 @@
/*
* Copyright 2018 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.
*/
#include "sdk/objc/Framework/Native/api/video_decoder_factory.h"
#include "rtc_base/ptr_util.h"
#include "sdk/objc/Framework/Native/src/objc_video_decoder_factory.h"
namespace webrtc {
std::unique_ptr<VideoDecoderFactory> ObjCToNativeVideoDecoderFactory(
id<RTCVideoDecoderFactory> objc_video_decoder_factory) {
return rtc::MakeUnique<ObjCVideoDecoderFactory>(objc_video_decoder_factory);
}
} // namespace webrtc

View File

@ -0,0 +1,27 @@
/*
* Copyright 2018 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 SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_ENCODER_FACTORY_H_
#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_ENCODER_FACTORY_H_
#include <memory>
#import "WebRTC/RTCVideoCodecFactory.h"
#include "api/video_codecs/video_encoder_factory.h"
namespace webrtc {
std::unique_ptr<VideoEncoderFactory> ObjCToNativeVideoEncoderFactory(
id<RTCVideoEncoderFactory> objc_video_encoder_factory);
} // namespace webrtc
#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_ENCODER_FACTORY_H_

View File

@ -0,0 +1,23 @@
/*
* Copyright 2018 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.
*/
#include "sdk/objc/Framework/Native/api/video_encoder_factory.h"
#include "rtc_base/ptr_util.h"
#include "sdk/objc/Framework/Native/src/objc_video_encoder_factory.h"
namespace webrtc {
std::unique_ptr<VideoEncoderFactory> ObjCToNativeVideoEncoderFactory(
id<RTCVideoEncoderFactory> objc_video_encoder_factory) {
return rtc::MakeUnique<ObjCVideoEncoderFactory>(objc_video_encoder_factory);
}
} // namespace webrtc

View File

@ -0,0 +1,26 @@
/*
* Copyright 2018 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 SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_BUFFER_H_
#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_BUFFER_H_
#import "WebRTC/RTCVideoFrameBuffer.h"
#include "common_video/include/video_frame_buffer.h"
#include "rtc_base/scoped_ref_ptr.h"
namespace webrtc {
rtc::scoped_refptr<webrtc::VideoFrameBuffer> ObjCToNativeVideoFrameBuffer(
id<RTCVideoFrameBuffer> objc_video_frame_buffer);
} // namespace webrtc
#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_BUFFER_H_

View File

@ -0,0 +1,22 @@
/*
* Copyright 2018 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.
*/
#include "sdk/objc/Framework/Native/api/video_frame_buffer.h"
#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h"
namespace webrtc {
rtc::scoped_refptr<webrtc::VideoFrameBuffer> ObjCToNativeVideoFrameBuffer(
id<RTCVideoFrameBuffer> objc_video_frame_buffer) {
return new rtc::RefCountedObject<webrtc::ObjCFrameBuffer>(objc_video_frame_buffer);
}
} // namespace webrtc