Index: webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h |
diff --git a/webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.h b/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h |
similarity index 20% |
rename from webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.h |
rename to webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h |
index f2252da806c340fc68318e3887c5f0901e2afcde..11c19ad7b43f9692528a614a816ca65b93f0cd1f 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/VideoToolbox/decoder.h |
+++ b/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
+ * Copyright (c) 2017 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 |
@@ -9,51 +9,39 @@ |
* |
*/ |
-#ifndef WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_DECODER_H_ |
-#define WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_DECODER_H_ |
- |
-#include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
+#ifndef WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_ |
+#define WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_ |
+#include <CoreFoundation/CoreFoundation.h> |
#include <VideoToolbox/VideoToolbox.h> |
+#include <string> |
-// This file provides a H264 encoder implementation using the VideoToolbox |
-// APIs. Since documentation is almost non-existent, this is largely based on |
-// the information in the VideoToolbox header files, a talk from WWDC 2014 and |
-// experimentation. |
- |
-namespace webrtc { |
- |
-class H264VideoToolboxDecoder : public H264Decoder { |
- public: |
- H264VideoToolboxDecoder(); |
- |
- ~H264VideoToolboxDecoder() override; |
- |
- int InitDecode(const VideoCodec* video_codec, int number_of_cores) override; |
- |
- int Decode(const EncodedImage& input_image, |
- bool missing_frames, |
- const RTPFragmentationHeader* fragmentation, |
- const CodecSpecificInfo* codec_specific_info, |
- int64_t render_time_ms) override; |
- |
- int RegisterDecodeCompleteCallback(DecodedImageCallback* callback) override; |
+// Convenience function for creating a dictionary. |
+inline CFDictionaryRef CreateCFTypeDictionary(CFTypeRef* keys, |
+ CFTypeRef* values, |
+ size_t size) { |
+ return CFDictionaryCreate(kCFAllocatorDefault, keys, values, size, |
+ &kCFTypeDictionaryKeyCallBacks, |
+ &kCFTypeDictionaryValueCallBacks); |
+} |
- int Release() override; |
+// Copies characters from a CFStringRef into a std::string. |
+std::string CFStringToString(const CFStringRef cf_string); |
- const char* ImplementationName() const override; |
+// Convenience function for setting a VT property. |
+void SetVTSessionProperty(VTSessionRef session, CFStringRef key, int32_t value); |
- private: |
- int ResetDecompressionSession(); |
- void ConfigureDecompressionSession(); |
- void DestroyDecompressionSession(); |
- void SetVideoFormat(CMVideoFormatDescriptionRef video_format); |
+// Convenience function for setting a VT property. |
+void SetVTSessionProperty(VTSessionRef session, |
+ CFStringRef key, |
+ uint32_t value); |
- DecodedImageCallback* callback_; |
- CMVideoFormatDescriptionRef video_format_; |
- VTDecompressionSessionRef decompression_session_; |
-}; // H264VideoToolboxDecoder |
+// Convenience function for setting a VT property. |
+void SetVTSessionProperty(VTSessionRef session, CFStringRef key, bool value); |
-} // namespace webrtc |
+// Convenience function for setting a VT property. |
+void SetVTSessionProperty(VTSessionRef session, |
+ CFStringRef key, |
+ CFStringRef value); |
-#endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_DECODER_H_ |
+#endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_ |