Compare commits

..

40 Commits

Author SHA1 Message Date
toss156 458759db08 rename h264 encode lib to avoid duplicate symbol error 2016-08-03 23:17:10 +08:00
Justin 408e6e17f5 Update LFLiveKit.podspec
fix issue  #36 关于use_frameworks!的问题
2016-08-03 23:16:38 +08:00
琨君 24e6c4576b change the AVAudioSession Category before start, or it will fail 2016-08-03 23:16:38 +08:00
chenliming 7a901b8b36 update.. 2016-08-03 23:16:37 +08:00
chenliming 6cf68fb370 update 2016-08-03 23:16:37 +08:00
chenliming 96f4415f1d update .. 2016-08-03 23:16:37 +08:00
chenliming f379e59a01 add a icon 2016-08-03 23:16:37 +08:00
chenliming 542d8b88d5 update read 2016-08-03 23:16:37 +08:00
chenliming 9566b8ceb9 update readme 2016-08-03 23:16:37 +08:00
chenliming 1e7296c566 update 2016-08-03 23:16:37 +08:00
chenliming 3f3007531f modify read 2016-08-03 23:16:37 +08:00
chenliming 9381d6c79b modify read 2016-08-03 23:16:37 +08:00
chenliming 605b6bc8e8 update travis 2016-08-03 23:16:37 +08:00
chenliming 9bb160132d update read 2016-08-03 23:16:37 +08:00
chenliming 2ada466726 update version2.0 2016-08-03 23:16:37 +08:00
chenliming 11185e3a4d add iOS encoder 2016-08-03 23:16:37 +08:00
chenliming acefbb6e24 add carthage 2016-08-03 23:15:43 +08:00
chenliming c1787ef6c5 update version 2016-08-03 23:15:42 +08:00
chenliming 77b1776e41 update version 2016-08-03 23:13:39 +08:00
chenliming d460a1105e update... 2016-08-03 23:13:39 +08:00
chenliming c89eece287 update.... 2016-08-03 23:13:39 +08:00
chenliming 6c4fc9a98b update.... 2016-08-03 23:13:39 +08:00
chenliming 33070a53c7 update... 2016-08-03 23:13:39 +08:00
chenliming 2d4360fc1d update。。。 2016-08-03 23:13:39 +08:00
chenliming 272165c84c update.. 2016-08-03 23:13:39 +08:00
chenliming 322b74ae2e update... 2016-08-03 23:13:39 +08:00
chenliming 5ee942d4b0 support carthage 2016-08-03 23:13:38 +08:00
chenliming a7595aa776 modify podspec 2016-08-03 23:13:09 +08:00
chenliming 48098066be update version 2016-08-03 23:13:09 +08:00
chenliming 4cf864b79c update read 2016-08-03 23:13:09 +08:00
chenliming 677680fa3f modify readme 2016-08-03 23:13:09 +08:00
chenliming b72b44fece update podspec 2016-08-03 23:12:09 +08:00
chenliming d749db1ddc update version 2016-08-03 23:12:09 +08:00
chenliming 8c492b130e compile question 2016-08-03 23:10:45 +08:00
chenliming 40bc03438d modify cropSize 2016-08-03 23:09:49 +08:00
chenliming 1d53c484e2 modify black screen bug 2016-08-03 23:09:49 +08:00
chenliming e97513c78f modify bug https://github.com/LaiFengiOS/LFLiveKit/issues/11#issuecomment-235147191 2016-08-03 23:09:49 +08:00
chenliming 65619a256a modify bug https://github.com/LaiFengiOS/LFLiveKit/issues/22 2016-08-03 23:09:48 +08:00
小歪~~~ 9f73c10d29 Merge pull request #23 from toss156/master
rename h264 encode lib to avoid duplicate symbol error
2016-07-26 13:46:35 +08:00
toss156 37bfd377d6 rename h264 encode lib to avoid duplicate symbol error 2016-07-26 11:16:43 +08:00
27 changed files with 382 additions and 222 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
language: objective-c
osx_image: xcode7
xcode_workspace: LFLiveKit.xcworkspace
xcode_project: LFLiveKit.xcodeproj
xcode_scheme: LFLiveKit
script:
- xctool -workspace LFLiveKit.xcworkspace -scheme 'LFLiveKit' -configuration Release -sdk iphonesimulator -arch i386 build
- xctool -project LFLiveKit.xcodeproj -scheme 'LFLiveKit' -configuration Release -sdk iphonesimulator -arch i386 build
+3 -2
View File
@@ -2,7 +2,7 @@
Pod::Spec.new do |s|
s.name = "LFLiveKit"
s.version = "1.9.6"
s.version = "2.0"
s.summary = "LaiFeng ios Live. LFLiveKit."
s.homepage = "https://github.com/chenliming777"
s.license = { :type => "MIT", :file => "LICENSE" }
@@ -11,7 +11,8 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "7.0"
s.source = { :git => "https://github.com/LaiFengiOS/LFLiveKit.git", :tag => "#{s.version}" }
s.source_files = "LFLiveKit/**/*.{h,m,mm,cpp,c}"
s.public_header_files = "LFLiveKit/**/*.h"
#s.public_header_files = "LFLiveKit/**/*.h"
s.public_header_files = ['LFLiveKit/*.h', 'LFLiveKit/objects/*.h', 'LFLiveKit/configuration/*.h']
s.frameworks = "VideoToolbox", "AudioToolbox","AVFoundation","Foundation","UIKit"
s.libraries = "c++", "z"
+52 -32
View File
@@ -415,15 +415,15 @@
B289F1DF1D3DE77F00D9C7A5 /* LFStreamSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = B289F1D81D3DE77F00D9C7A5 /* LFStreamSocket.h */; };
B289F1E01D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.h in Headers */ = {isa = PBXBuildFile; fileRef = B289F1D91D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.h */; };
B289F1E11D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = B289F1DA1D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.m */; };
B2CD146D1D45F18B008082E8 /* AVEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14621D45F18B008082E8 /* AVEncoder.h */; };
B2CD146E1D45F18B008082E8 /* AVEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14631D45F18B008082E8 /* AVEncoder.mm */; };
B2CD146D1D45F18B008082E8 /* LFAVEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14621D45F18B008082E8 /* LFAVEncoder.h */; };
B2CD146E1D45F18B008082E8 /* LFAVEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14631D45F18B008082E8 /* LFAVEncoder.mm */; };
B2CD146F1D45F18B008082E8 /* LICENSE.markdown in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14641D45F18B008082E8 /* LICENSE.markdown */; };
B2CD14701D45F18B008082E8 /* MP4Atom.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14651D45F18B008082E8 /* MP4Atom.h */; };
B2CD14711D45F18B008082E8 /* MP4Atom.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14661D45F18B008082E8 /* MP4Atom.m */; };
B2CD14721D45F18B008082E8 /* NALUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14671D45F18B008082E8 /* NALUnit.cpp */; };
B2CD14731D45F18B008082E8 /* NALUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14681D45F18B008082E8 /* NALUnit.h */; };
B2CD14741D45F18B008082E8 /* VideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14691D45F18B008082E8 /* VideoEncoder.h */; };
B2CD14751D45F18B008082E8 /* VideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CD146A1D45F18B008082E8 /* VideoEncoder.m */; };
B2CD14701D45F18B008082E8 /* LFMP4Atom.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14651D45F18B008082E8 /* LFMP4Atom.h */; };
B2CD14711D45F18B008082E8 /* LFMP4Atom.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14661D45F18B008082E8 /* LFMP4Atom.m */; };
B2CD14721D45F18B008082E8 /* LFNALUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2CD14671D45F18B008082E8 /* LFNALUnit.cpp */; };
B2CD14731D45F18B008082E8 /* LFNALUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14681D45F18B008082E8 /* LFNALUnit.h */; };
B2CD14741D45F18B008082E8 /* LFVideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD14691D45F18B008082E8 /* LFVideoEncoder.h */; };
B2CD14751D45F18B008082E8 /* LFVideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CD146A1D45F18B008082E8 /* LFVideoEncoder.m */; };
B2CD14761D45F18B008082E8 /* LFH264VideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CD146B1D45F18B008082E8 /* LFH264VideoEncoder.h */; };
B2CD14771D45F18B008082E8 /* LFH264VideoEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2CD146C1D45F18B008082E8 /* LFH264VideoEncoder.mm */; };
/* End PBXBuildFile section */
@@ -851,15 +851,15 @@
B289F1D81D3DE77F00D9C7A5 /* LFStreamSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LFStreamSocket.h; path = LFLiveKit/publish/LFStreamSocket.h; sourceTree = SOURCE_ROOT; };
B289F1D91D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+LFAdd.h"; path = "LFLiveKit/publish/NSMutableArray+LFAdd.h"; sourceTree = SOURCE_ROOT; };
B289F1DA1D3DE77F00D9C7A5 /* NSMutableArray+LFAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+LFAdd.m"; path = "LFLiveKit/publish/NSMutableArray+LFAdd.m"; sourceTree = SOURCE_ROOT; };
B2CD14621D45F18B008082E8 /* AVEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVEncoder.h; sourceTree = "<group>"; };
B2CD14631D45F18B008082E8 /* AVEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVEncoder.mm; sourceTree = "<group>"; };
B2CD14621D45F18B008082E8 /* LFAVEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFAVEncoder.h; sourceTree = "<group>"; };
B2CD14631D45F18B008082E8 /* LFAVEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LFAVEncoder.mm; sourceTree = "<group>"; };
B2CD14641D45F18B008082E8 /* LICENSE.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.markdown; sourceTree = "<group>"; };
B2CD14651D45F18B008082E8 /* MP4Atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP4Atom.h; sourceTree = "<group>"; };
B2CD14661D45F18B008082E8 /* MP4Atom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MP4Atom.m; sourceTree = "<group>"; };
B2CD14671D45F18B008082E8 /* NALUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NALUnit.cpp; sourceTree = "<group>"; };
B2CD14681D45F18B008082E8 /* NALUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NALUnit.h; sourceTree = "<group>"; };
B2CD14691D45F18B008082E8 /* VideoEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoEncoder.h; sourceTree = "<group>"; };
B2CD146A1D45F18B008082E8 /* VideoEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VideoEncoder.m; sourceTree = "<group>"; };
B2CD14651D45F18B008082E8 /* LFMP4Atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFMP4Atom.h; sourceTree = "<group>"; };
B2CD14661D45F18B008082E8 /* LFMP4Atom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFMP4Atom.m; sourceTree = "<group>"; };
B2CD14671D45F18B008082E8 /* LFNALUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LFNALUnit.cpp; sourceTree = "<group>"; };
B2CD14681D45F18B008082E8 /* LFNALUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFNALUnit.h; sourceTree = "<group>"; };
B2CD14691D45F18B008082E8 /* LFVideoEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFVideoEncoder.h; sourceTree = "<group>"; };
B2CD146A1D45F18B008082E8 /* LFVideoEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFVideoEncoder.m; sourceTree = "<group>"; };
B2CD146B1D45F18B008082E8 /* LFH264VideoEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFH264VideoEncoder.h; sourceTree = "<group>"; };
B2CD146C1D45F18B008082E8 /* LFH264VideoEncoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LFH264VideoEncoder.mm; sourceTree = "<group>"; };
D0BB7E7CE5403C4911E026B9 /* Pods-LFLiveKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKit/Pods-LFLiveKit.debug.xcconfig"; sourceTree = "<group>"; };
@@ -1444,15 +1444,15 @@
B2CD14611D45F18B008082E8 /* H264 */ = {
isa = PBXGroup;
children = (
B2CD14621D45F18B008082E8 /* AVEncoder.h */,
B2CD14631D45F18B008082E8 /* AVEncoder.mm */,
B2CD14621D45F18B008082E8 /* LFAVEncoder.h */,
B2CD14631D45F18B008082E8 /* LFAVEncoder.mm */,
B2CD14641D45F18B008082E8 /* LICENSE.markdown */,
B2CD14651D45F18B008082E8 /* MP4Atom.h */,
B2CD14661D45F18B008082E8 /* MP4Atom.m */,
B2CD14671D45F18B008082E8 /* NALUnit.cpp */,
B2CD14681D45F18B008082E8 /* NALUnit.h */,
B2CD14691D45F18B008082E8 /* VideoEncoder.h */,
B2CD146A1D45F18B008082E8 /* VideoEncoder.m */,
B2CD14651D45F18B008082E8 /* LFMP4Atom.h */,
B2CD14661D45F18B008082E8 /* LFMP4Atom.m */,
B2CD14671D45F18B008082E8 /* LFNALUnit.cpp */,
B2CD14681D45F18B008082E8 /* LFNALUnit.h */,
B2CD14691D45F18B008082E8 /* LFVideoEncoder.h */,
B2CD146A1D45F18B008082E8 /* LFVideoEncoder.m */,
);
path = H264;
sourceTree = "<group>";
@@ -1499,8 +1499,9 @@
843724F21D4F260A002B398B /* GPUImageView.h in Headers */,
843724991D4F260A002B398B /* GPUImageSharpenFilter.h in Headers */,
84001FDD1D0016380026C63F /* LFLiveVideoConfiguration.h in Headers */,
B2CD14701D45F18B008082E8 /* LFMP4Atom.h in Headers */,
849005B61D4B5C8400D2A3D5 /* error.h in Headers */,
843724FB1D4F260A002B398B /* handshake.h in Headers */,
B2CD14701D45F18B008082E8 /* MP4Atom.h in Headers */,
843723F31D4F260A002B398B /* GPUImageFalseColorFilter.h in Headers */,
843723B71D4F260A002B398B /* GPUImageCannyEdgeDetectionFilter.h in Headers */,
843724151D4F260A002B398B /* GPUImageHazeFilter.h in Headers */,
@@ -1510,6 +1511,7 @@
843724AD1D4F260A002B398B /* GPUImageSolidColorGenerator.h in Headers */,
8437244D1D4F260A002B398B /* GPUImageMaskFilter.h in Headers */,
843723E91D4F260A002B398B /* GPUImageDivideBlendFilter.h in Headers */,
B2CD14701D45F18B008082E8 /* LFMP4Atom.h in Headers */,
84001FE31D0016380026C63F /* LFLiveSession.h in Headers */,
843724411D4F260A002B398B /* GPUImageLookupFilter.h in Headers */,
843724E91D4F260A002B398B /* GPUImageFramework.h in Headers */,
@@ -1630,14 +1632,22 @@
84001FE11D0016380026C63F /* LFGPUImageEmptyFilter.h in Headers */,
843724B51D4F260A002B398B /* GPUImageStretchDistortionFilter.h in Headers */,
84001FDA1D0016380026C63F /* LFVideoEncoding.h in Headers */,
84001FE51D0016380026C63F /* LFAudioFrame.h in Headers */,
84001FED1D0016380026C63F /* LFVideoFrame.h in Headers */,
B2CD14741D45F18B008082E8 /* LFVideoEncoder.h in Headers */,
B2CD14731D45F18B008082E8 /* LFNALUnit.h in Headers */,
849005BF1D4B5C8400D2A3D5 /* rtmp_sys.h in Headers */,
849005BE1D4B5C8400D2A3D5 /* rtmp.h in Headers */,
843724BF1D4F260A002B398B /* GPUImageThreeInputFilter.h in Headers */,
843724F71D4F260A002B398B /* dh.h in Headers */,
B2CD14741D45F18B008082E8 /* VideoEncoder.h in Headers */,
843725031D4F260A002B398B /* rtmp_sys.h in Headers */,
843724691D4F260A002B398B /* GPUImageOpeningFilter.h in Headers */,
843723C11D4F260A002B398B /* GPUImageColorBlendFilter.h in Headers */,
8437249F1D4F260A002B398B /* GPUImageSketchFilter.h in Headers */,
B2CD14731D45F18B008082E8 /* NALUnit.h in Headers */,
84001FE51D0016380026C63F /* LFAudioFrame.h in Headers */,
84001FED1D0016380026C63F /* LFVideoFrame.h in Headers */,
B2CD14741D45F18B008082E8 /* LFVideoEncoder.h in Headers */,
B2CD14731D45F18B008082E8 /* LFNALUnit.h in Headers */,
84001FD81D0016380026C63F /* LFHardwareVideoEncoder.h in Headers */,
843724A91D4F260A002B398B /* GPUImageSoftLightBlendFilter.h in Headers */,
843723A91D4F260A002B398B /* GPUImageAverageColor.h in Headers */,
@@ -1651,13 +1661,14 @@
843724611D4F260A002B398B /* GPUImageNobleCornerDetectionFilter.h in Headers */,
8437243D1D4F260A002B398B /* GPUImageLineGenerator.h in Headers */,
84001FD51D0016380026C63F /* LFAudioEncoding.h in Headers */,
B2CD146D1D45F18B008082E8 /* LFAVEncoder.h in Headers */,
849005B11D4B5C8400D2A3D5 /* amf.h in Headers */,
843723AB1D4F260A002B398B /* GPUImageAverageLuminanceThresholdFilter.h in Headers */,
843723F71D4F260A002B398B /* GPUImageFilter.h in Headers */,
8437240F1D4F260A002B398B /* GPUImageHalftoneFilter.h in Headers */,
843723A11D4F260A002B398B /* GPUImageAdaptiveThresholdFilter.h in Headers */,
843723CF1D4F260A002B398B /* GPUImageColorPackingFilter.h in Headers */,
843723B91D4F260A002B398B /* GPUImageCGAColorspaceFilter.h in Headers */,
B2CD146D1D45F18B008082E8 /* AVEncoder.h in Headers */,
843724051D4F260A002B398B /* GPUImageGaussianBlurFilter.h in Headers */,
843724B31D4F260A002B398B /* GPUImageStillCamera.h in Headers */,
843724D51D4F260A002B398B /* GPUImageTwoPassTextureSamplingFilter.h in Headers */,
@@ -1669,6 +1680,7 @@
843724551D4F260A002B398B /* GPUImageMosaicFilter.h in Headers */,
843723BD1D4F260A002B398B /* GPUImageChromaKeyFilter.h in Headers */,
843724171D4F260A002B398B /* GPUImageHighlightShadowFilter.h in Headers */,
B2CD146D1D45F18B008082E8 /* LFAVEncoder.h in Headers */,
84001F8E1D0015D10026C63F /* LFLiveKit.h in Headers */,
843724671D4F260A002B398B /* GPUImageOpacityFilter.h in Headers */,
8437247F1D4F260A002B398B /* GPUImagePosterizeFilter.h in Headers */,
@@ -1776,6 +1788,8 @@
84001FE21D0016380026C63F /* LFGPUImageEmptyFilter.m in Sources */,
843724C21D4F260A002B398B /* GPUImageThresholdEdgeDetectionFilter.m in Sources */,
84001FE41D0016380026C63F /* LFLiveSession.m in Sources */,
B2CD14711D45F18B008082E8 /* LFMP4Atom.m in Sources */,
849005B81D4B5C8400D2A3D5 /* hashswf.c in Sources */,
843724BA1D4F260A002B398B /* GPUImageSwirlFilter.m in Sources */,
843723A41D4F260A002B398B /* GPUImageAddBlendFilter.m in Sources */,
843723B01D4F260A002B398B /* GPUImageBoxBlurFilter.m in Sources */,
@@ -1783,10 +1797,10 @@
843724E41D4F260A002B398B /* GPUImageWhiteBalanceFilter.m in Sources */,
843724101D4F260A002B398B /* GPUImageHalftoneFilter.m in Sources */,
843724301D4F260A002B398B /* GPUImageKuwaharaFilter.m in Sources */,
B2CD14711D45F18B008082E8 /* MP4Atom.m in Sources */,
843724201D4F260A002B398B /* GPUImageHistogramFilter.m in Sources */,
8437246E1D4F260A002B398B /* GPUImageOverlayBlendFilter.m in Sources */,
843723A81D4F260A002B398B /* GPUImageAmatorkaFilter.m in Sources */,
B2CD14711D45F18B008082E8 /* LFMP4Atom.m in Sources */,
84001FE61D0016380026C63F /* LFAudioFrame.m in Sources */,
843724C41D4F260A002B398B /* GPUImageThresholdedNonMaximumSuppressionFilter.m in Sources */,
843724F91D4F260A002B398B /* error.c in Sources */,
@@ -1798,7 +1812,10 @@
84001FD41D0016380026C63F /* LFVideoCapture.m in Sources */,
843723B81D4F260A002B398B /* GPUImageCannyEdgeDetectionFilter.m in Sources */,
84001FE81D0016380026C63F /* LFFrame.m in Sources */,
B2CD14721D45F18B008082E8 /* NALUnit.cpp in Sources */,
<<<<<<< HEAD
B2CD14721D45F18B008082E8 /* LFNALUnit.cpp in Sources */,
=======
>>>>>>> rename h264 encode lib to avoid duplicate symbol error
843724CE1D4F260A002B398B /* GPUImageTransformFilter.m in Sources */,
843723E81D4F260A002B398B /* GPUImageDissolveBlendFilter.m in Sources */,
843723D81D4F260A002B398B /* GPUImageCropFilter.m in Sources */,
@@ -1807,6 +1824,7 @@
843723F21D4F260A002B398B /* GPUImageExposureFilter.m in Sources */,
8437244E1D4F260A002B398B /* GPUImageMaskFilter.m in Sources */,
843724841D4F260A002B398B /* GPUImageRawDataInput.m in Sources */,
B2CD14721D45F18B008082E8 /* LFNALUnit.cpp in Sources */,
B289F1DC1D3DE77F00D9C7A5 /* LFStreamingBuffer.m in Sources */,
843723F01D4F260A002B398B /* GPUImageExclusionBlendFilter.m in Sources */,
843724F31D4F260A002B398B /* GPUImageView.m in Sources */,
@@ -1847,10 +1865,10 @@
843724781D4F260A002B398B /* GPUImagePixellatePositionFilter.m in Sources */,
8437245A1D4F260A002B398B /* GPUImageMotionDetector.m in Sources */,
84001FD21D0016380026C63F /* LFAudioCapture.m in Sources */,
B2CD14751D45F18B008082E8 /* LFVideoEncoder.m in Sources */,
843724B81D4F260A002B398B /* GPUImageSubtractBlendFilter.m in Sources */,
843724741D4F260A002B398B /* GPUImagePinchDistortionFilter.m in Sources */,
843724D61D4F260A002B398B /* GPUImageTwoPassTextureSamplingFilter.m in Sources */,
B2CD14751D45F18B008082E8 /* VideoEncoder.m in Sources */,
843723DA1D4F260A002B398B /* GPUImageCrosshairGenerator.m in Sources */,
843724A01D4F260A002B398B /* GPUImageSketchFilter.m in Sources */,
843723A01D4F260A002B398B /* GPUImage3x3TextureSamplingFilter.m in Sources */,
@@ -1860,6 +1878,7 @@
843723D61D4F260A002B398B /* GPUImageContrastFilter.m in Sources */,
843724BC1D4F260A002B398B /* GPUImageTextureInput.m in Sources */,
843724521D4F260A002B398B /* GPUImageMissEtikateFilter.m in Sources */,
B2CD14751D45F18B008082E8 /* LFVideoEncoder.m in Sources */,
B2CD146F1D45F18B008082E8 /* LICENSE.markdown in Sources */,
B289F1DE1D3DE77F00D9C7A5 /* LFStreamRtmpSocket.m in Sources */,
843724CA1D4F260A002B398B /* GPUImageToneCurveFilter.m in Sources */,
@@ -1967,13 +1986,14 @@
843723AC1D4F260A002B398B /* GPUImageAverageLuminanceThresholdFilter.m in Sources */,
843723FA1D4F260A002B398B /* GPUImageFilterGroup.m in Sources */,
84001FE01D0016380026C63F /* LFGPUImageBeautyFilter.m in Sources */,
B2CD146E1D45F18B008082E8 /* LFAVEncoder.mm in Sources */,
843723FC1D4F260A002B398B /* GPUImageFilterPipeline.m in Sources */,
843724441D4F260A002B398B /* GPUImageLowPassFilter.m in Sources */,
B2CD146E1D45F18B008082E8 /* AVEncoder.mm in Sources */,
843725011D4F260A002B398B /* rtmp.c in Sources */,
843724221D4F260A002B398B /* GPUImageHistogramGenerator.m in Sources */,
843724621D4F260A002B398B /* GPUImageNobleCornerDetectionFilter.m in Sources */,
843724341D4F260A002B398B /* GPUImageLanczosResamplingFilter.m in Sources */,
B2CD146E1D45F18B008082E8 /* LFAVEncoder.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.9.6</string>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+5 -2
View File
@@ -51,10 +51,10 @@
/** The beautyFace control capture shader filter empty or beautiy */
@property (nonatomic, assign) BOOL beautyFace;
/** The beautyLevel control beautyFace Level, default 0.5, between 0.0 ~ 1.0 */
/** The beautyLevel control beautyFace Level. Default is 0.5, between 0.0 ~ 1.0 */
@property (nonatomic, assign) CGFloat beautyLevel;
/** The brightLevel control brightness Level, default 0.5, between 0.0 ~ 1.0 */
/** The brightLevel control brightness Level, Default is 0.5, between 0.0 ~ 1.0 */
@property (nonatomic, assign) CGFloat brightLevel;
/** The torch control camera zoom scale default 1.0, between 1.0 ~ 3.0 */
@@ -69,6 +69,9 @@
/** The muted control callbackAudioData,muted will memset 0.*/
@property (nonatomic, assign) BOOL muted;
/* The adaptiveBitrate control auto adjust bitrate. Default is NO */
@property (nonatomic, assign) BOOL adaptiveBitrate;
/** The stream control upload and package*/
@property (nullable, nonatomic, strong, readonly) LFLiveStreamInfo *streamInfo;
+28 -14
View File
@@ -11,9 +11,11 @@
#import "LFAudioCapture.h"
#import "LFHardwareVideoEncoder.h"
#import "LFHardwareAudioEncoder.h"
#import "LFH264VideoEncoder.h"
#import "LFStreamRTMPSocket.h"
#import "LFLiveStreamInfo.h"
#import "LFGPUImageBeautyFilter.h"
#import "LFH264VideoEncoder.h"
#define LFLiveReportKey @"com.youku.liveSessionReport"
@@ -52,6 +54,8 @@
/**  时间戳 */
#define NOW (CACurrentMediaTime()*1000)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
@interface LFLiveSession ()
@property (nonatomic, assign) uint64_t timestamp;
@@ -69,6 +73,8 @@
_audioConfiguration = audioConfiguration;
_videoConfiguration = videoConfiguration;
_lock = dispatch_semaphore_create(1);
_adaptiveBitrate = NO;
_isFirstFrame = YES;
}
return self;
}
@@ -119,7 +125,7 @@
self.isFirstFrame = YES;
self.uploading = YES;
}
}else if(status == LFLiveStop || status == LFLiveError){
} else if(status == LFLiveStop || status == LFLiveError){
self.uploading = NO;
}
dispatch_async(dispatch_get_main_queue(), ^{
@@ -150,16 +156,20 @@
}
- (void)socketBufferStatus:(nullable id<LFStreamSocket>)socket status:(LFLiveBuffferState)status {
NSUInteger videoBitRate = [_videoEncoder videoBitRate];
if (status == LFLiveBuffferDecline) {
if (videoBitRate < _videoConfiguration.videoMaxBitRate) {
videoBitRate = videoBitRate + 50 * 1000;
[_videoEncoder setVideoBitRate:videoBitRate];
}
} else {
if (videoBitRate > _videoConfiguration.videoMinBitRate) {
videoBitRate = videoBitRate - 100 * 1000;
[_videoEncoder setVideoBitRate:videoBitRate];
if (self.adaptiveBitrate) {
NSUInteger videoBitRate = [_videoEncoder videoBitRate];
if (status == LFLiveBuffferDecline) {
if (videoBitRate < _videoConfiguration.videoMaxBitRate) {
videoBitRate = videoBitRate + 50 * 1000;
[_videoEncoder setVideoBitRate:videoBitRate];
NSLog(@"Increase bitrate %@", @(videoBitRate));
}
} else {
if (videoBitRate > _videoConfiguration.videoMinBitRate) {
videoBitRate = videoBitRate - 100 * 1000;
[_videoEncoder setVideoBitRate:videoBitRate];
NSLog(@"Decline bitrate %@", @(videoBitRate));
}
}
}
}
@@ -290,7 +300,11 @@
- (id<LFVideoEncoding>)videoEncoder {
if (!_videoEncoder) {
_videoEncoder = [[LFHardwareVideoEncoder alloc] initWithVideoStreamConfiguration:_videoConfiguration];
if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
_videoEncoder = [[LFH264VideoEncoder alloc] initWithVideoStreamConfiguration:_videoConfiguration];
} else {
_videoEncoder = [[LFHardwareVideoEncoder alloc] initWithVideoStreamConfiguration:_videoConfiguration];
}
[_videoEncoder setDelegate:self];
}
return _videoEncoder;
@@ -314,9 +328,9 @@
- (uint64_t)currentTimestamp {
dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER);
uint64_t currentts = 0;
if (_isFirstFrame == true) {
if (_isFirstFrame) {
_timestamp = NOW;
_isFirstFrame = false;
_isFirstFrame = NO;
currentts = 0;
} else {
currentts = NOW - _timestamp;
+1
View File
@@ -124,6 +124,7 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
dispatch_async(self.taskQueue, ^{
self.isRunning = YES;
NSLog(@"MicrophoneSource: startRunning");
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
AudioOutputUnitStart(self.componetInstance);
});
} else {
@@ -12,17 +12,17 @@
#import <AVFoundation/AVMediaFormat.h>
#import <AVFoundation/AVVideoSettings.h>
#import "sys/stat.h"
#import "VideoEncoder.h"
#import "MP4Atom.h"
#import "LFVideoEncoder.h"
#import "LFMP4Atom.h"
typedef int (^encoder_handler_t)(NSArray *data, CMTimeValue ptsValue);
typedef int (^param_handler_t)(NSData *params);
@interface AVEncoder : NSObject
@interface LFAVEncoder : NSObject
@property (atomic) NSUInteger bitrate;
+ (AVEncoder *)encoderForHeight:(int)height andWidth:(int)width bitrate:(int)bitrate;
+ (LFAVEncoder *)encoderForHeight:(int)height andWidth:(int)width bitrate:(int)bitrate;
- (void)encodeWithBlock:(encoder_handler_t)block onParams:(param_handler_t)paramsHandler;
- (void)encodeFrame:(CMSampleBufferRef)sampleBuffer;
@@ -6,8 +6,8 @@
// Copyright (c) 2013 GDCL http://www.gdcl.co.uk/license.htm
//
#import "AVEncoder.h"
#import "NALUnit.h"
#import "LFAVEncoder.h"
#import "LFNALUnit.h"
static void *AVEncoderContext = &AVEncoderContext;
@@ -19,14 +19,14 @@ static unsigned int to_host(unsigned char *p){
#define MAX_FILENAME_INDEX 5 // filenames "capture1.mp4" wraps at capture5.mp4
@interface AVEncoder ()
@interface LFAVEncoder ()
{
// initial writer, used to obtain SPS/PPS from header
VideoEncoder *_headerWriter;
LFVideoEncoder *_headerWriter;
// main encoder/writer
VideoEncoder *_writer;
LFVideoEncoder *_writer;
// writer output file (input to our extractor) and monitoring
NSFileHandle *_inputFile;
@@ -70,12 +70,12 @@ static unsigned int to_host(unsigned char *p){
@end
@implementation AVEncoder
@implementation LFAVEncoder
@synthesize bitspersecond = _bitspersecond;
+ (AVEncoder *)encoderForHeight:(int)height andWidth:(int)width bitrate:(int)bitrate {
AVEncoder *enc = [AVEncoder alloc];
+ (LFAVEncoder *)encoderForHeight:(int)height andWidth:(int)width bitrate:(int)bitrate {
LFAVEncoder *enc = [LFAVEncoder alloc];
[enc initForHeight:height andWidth:width bitrate:bitrate];
return enc;
}
@@ -91,12 +91,12 @@ static unsigned int to_host(unsigned char *p){
_width = width;
_bitrate = bitrate;
NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"params.mp4"];
_headerWriter = [VideoEncoder encoderForPath:path Height:height andWidth:width bitrate:self.bitrate];
_headerWriter = [LFVideoEncoder encoderForPath:path Height:height andWidth:width bitrate:self.bitrate];
_times = [NSMutableArray arrayWithCapacity:10];
// swap between 3 filenames
_currentFile = 1;
_writer = [VideoEncoder encoderForPath:[self makeFilename] Height:height andWidth:width bitrate:self.bitrate];
_writer = [LFVideoEncoder encoderForPath:[self makeFilename] Height:height andWidth:width bitrate:self.bitrate];
[self addObserver:self forKeyPath:NSStringFromSelector(@selector(bitrate)) options:0 context:AVEncoderContext];
}
@@ -123,9 +123,9 @@ static unsigned int to_host(unsigned char *p){
NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:path];
struct stat s;
fstat([file fileDescriptor], &s);
MP4Atom *movie = [MP4Atom atomAt:0 size:s.st_size type:(OSType)('file') inFile:file];
MP4Atom *moov = [movie childOfType:(OSType)('moov') startAt:0];
MP4Atom *trak = nil;
LFMP4Atom *movie = [LFMP4Atom atomAt:0 size:s.st_size type:(OSType)('file') inFile:file];
LFMP4Atom *moov = [movie childOfType:(OSType)('moov') startAt:0];
LFMP4Atom *trak = nil;
if (moov != nil) {
for (;; ) {
trak = [moov nextChild];
@@ -134,7 +134,7 @@ static unsigned int to_host(unsigned char *p){
}
if (trak.type == (OSType)('trak')) {
MP4Atom *tkhd = [trak childOfType:(OSType)('tkhd') startAt:0];
LFMP4Atom *tkhd = [trak childOfType:(OSType)('tkhd') startAt:0];
NSData *verflags = [tkhd readAt:0 size:4];
unsigned char *p = (unsigned char *)[verflags bytes];
if (p[3] & 1) {
@@ -145,13 +145,13 @@ static unsigned int to_host(unsigned char *p){
}
}
}
MP4Atom *stsd = nil;
LFMP4Atom *stsd = nil;
if (trak != nil) {
MP4Atom *media = [trak childOfType:(OSType)('mdia') startAt:0];
LFMP4Atom *media = [trak childOfType:(OSType)('mdia') startAt:0];
if (media != nil) {
MP4Atom *minf = [media childOfType:(OSType)('minf') startAt:0];
LFMP4Atom *minf = [media childOfType:(OSType)('minf') startAt:0];
if (minf != nil) {
MP4Atom *stbl = [minf childOfType:(OSType)('stbl') startAt:0];
LFMP4Atom *stbl = [minf childOfType:(OSType)('stbl') startAt:0];
if (stbl != nil) {
stsd = [stbl childOfType:(OSType)('stsd') startAt:0];
}
@@ -159,9 +159,9 @@ static unsigned int to_host(unsigned char *p){
}
}
if (stsd != nil) {
MP4Atom *avc1 = [stsd childOfType:(OSType)('avc1') startAt:8];
LFMP4Atom *avc1 = [stsd childOfType:(OSType)('avc1') startAt:8];
if (avc1 != nil) {
MP4Atom *esd = [avc1 childOfType:(OSType)('avcC') startAt:78];
LFMP4Atom *esd = [avc1 childOfType:(OSType)('avcC') startAt:78];
if (esd != nil) {
// this is the avcC record that we are looking for
_avcC = [esd readAt:0 size:esd.length];
@@ -229,14 +229,14 @@ static unsigned int to_host(unsigned char *p){
if (st.st_size > OUTPUT_FILE_SWITCH_POINT || self.bitrateChanged) {
self.bitrateChanged = NO;
_swapping = YES;
VideoEncoder *oldVideo = _writer;
LFVideoEncoder *oldVideo = _writer;
// construct a new writer to the next filename
if (++_currentFile > MAX_FILENAME_INDEX) {
_currentFile = 1;
}
//NSLog(@"Swap to file %d", _currentFile);
_writer = [VideoEncoder encoderForPath:[self makeFilename] Height:_height andWidth:_width bitrate:self.bitrate];
_writer = [LFVideoEncoder encoderForPath:[self makeFilename] Height:_height andWidth:_width bitrate:self.bitrate];
// to do this seamlessly requires a few steps in the right order
// first, suspend the read source
@@ -385,7 +385,7 @@ static unsigned int to_host(unsigned char *p){
int naltype = pNal[0] & 0x1f;
if (_pendingNALU) {
NALUnit nal(pNal, [nalu length]);
LFNALUnit nal(pNal, [nalu length]);
// we have existing data —is this the same frame?
// typically there are a couple of NALUs per frame in iOS encoding.
@@ -1,5 +1,5 @@
//
// MP4Atom.h
// LFMP4Atom.h
// Encoder Demo
//
// Created by Geraint Davies on 15/01/2013.
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
@interface MP4Atom : NSObject
@interface LFMP4Atom : NSObject
{
NSFileHandle *_file;
@@ -20,11 +20,11 @@
@property OSType type;
@property int64_t length;
+ (MP4Atom *)atomAt:(int64_t)offset size:(int)length type:(OSType)fourcc inFile:(NSFileHandle *)handle;
+ (LFMP4Atom *)atomAt:(int64_t)offset size:(int)length type:(OSType)fourcc inFile:(NSFileHandle *)handle;
- (BOOL)init:(int64_t)offset size:(int)length type:(OSType)fourcc inFile:(NSFileHandle *)handle;
- (NSData *)readAt:(int64_t)offset size:(int)length;
- (BOOL)setChildOffset:(int64_t)offset;
- (MP4Atom *)nextChild;
- (MP4Atom *)childOfType:(OSType)fourcc startAt:(int64_t)offset;
- (LFMP4Atom *)nextChild;
- (LFMP4Atom *)childOfType:(OSType)fourcc startAt:(int64_t)offset;
@end
@@ -1,24 +1,24 @@
//
// MP4Atom.m
// LFMP4Atom.m
// Encoder Demo
//
// Created by Geraint Davies on 15/01/2013.
// Copyright (c) 2013 GDCL http://www.gdcl.co.uk/license.htm
//
#import "MP4Atom.h"
#import "LFMP4Atom.h"
static unsigned int to_host(unsigned char *p){
return (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3];
}
@implementation MP4Atom
@implementation LFMP4Atom
@synthesize type = _type;
@synthesize length = _length;
+ (MP4Atom *)atomAt:(int64_t)offset size:(int)length type:(OSType)fourcc inFile:(NSFileHandle *)handle {
MP4Atom *atom = [MP4Atom alloc];
+ (LFMP4Atom *)atomAt:(int64_t)offset size:(int)length type:(OSType)fourcc inFile:(NSFileHandle *)handle {
LFMP4Atom *atom = [LFMP4Atom alloc];
if (![atom init:offset size:length type:fourcc inFile:handle]) {
return nil;
}
@@ -45,7 +45,7 @@ static unsigned int to_host(unsigned char *p){
return YES;
}
- (MP4Atom *)nextChild {
- (LFMP4Atom *)nextChild {
if (_nextChild <= (_length - 8)) {
[_file seekToFileOffset:_offset + _nextChild];
NSData *data = [_file readDataOfLength:8];
@@ -73,14 +73,14 @@ static unsigned int to_host(unsigned char *p){
int64_t offset = _nextChild + cHeader;
_nextChild += len;
len -= cHeader;
return [MP4Atom atomAt:offset+_offset size:len type:fourcc inFile:_file];
return [LFMP4Atom atomAt:offset+_offset size:len type:fourcc inFile:_file];
}
return nil;
}
- (MP4Atom *)childOfType:(OSType)fourcc startAt:(int64_t)offset {
- (LFMP4Atom *)childOfType:(OSType)fourcc startAt:(int64_t)offset {
[self setChildOffset:offset];
MP4Atom *child = nil;
LFMP4Atom *child = nil;
do {
child = [self nextChild];
} while ((child != nil) && (child.type != fourcc));
@@ -10,18 +10,18 @@
#include "NALUnit.h"
#include "LFNALUnit.h"
// --- core NAL Unit implementation ------------------------------
NALUnit::NALUnit()
LFNALUnit::LFNALUnit()
: m_pStart(NULL),
m_cBytes(0){
}
bool
NALUnit::GetStartCode(const BYTE *& pBegin, const BYTE *& pStart, int& cRemain){
LFNALUnit::GetStartCode(const BYTE *& pBegin, const BYTE *& pStart, int& cRemain){
// start code is any number of 00 followed by 00 00 01
// We need to record the first 00 in pBegin and the first byte
// following the startcode in pStart.
@@ -54,7 +54,7 @@ NALUnit::GetStartCode(const BYTE *& pBegin, const BYTE *& pStart, int& cRemain){
}
bool
NALUnit::Parse(const BYTE *pBuffer, int cSpace, int LengthSize, bool bEnd){
LFNALUnit::Parse(const BYTE *pBuffer, int cSpace, int LengthSize, bool bEnd){
// if we get the start code but not the whole
// NALU, we can return false but still have the length property valid
m_cBytes = 0;
@@ -102,14 +102,14 @@ NALUnit::Parse(const BYTE *pBuffer, int cSpace, int LengthSize, bool bEnd){
// bitwise access to data
void
NALUnit::ResetBitstream(){
LFNALUnit::ResetBitstream(){
m_idx = 0;
m_nBits = 0;
m_cZeros = 0;
}
void
NALUnit::Skip(int nBits){
LFNALUnit::Skip(int nBits){
if (nBits < m_nBits) {
m_nBits -= nBits;
} else {
@@ -129,7 +129,7 @@ NALUnit::Skip(int nBits){
// get the next byte, removing emulation prevention bytes
BYTE
NALUnit::GetBYTE(){
LFNALUnit::GetBYTE(){
if (m_idx >= m_cBytes) {
return 0;
}
@@ -151,7 +151,7 @@ NALUnit::GetBYTE(){
}
unsigned long
NALUnit::GetBit(){
LFNALUnit::GetBit(){
if (m_nBits == 0) {
m_byte = GetBYTE();
m_nBits = 8;
@@ -161,7 +161,7 @@ NALUnit::GetBit(){
}
unsigned long
NALUnit::GetWord(int nBits){
LFNALUnit::GetWord(int nBits){
unsigned long u = 0;
while (nBits > 0) {
u <<= 1;
@@ -172,7 +172,7 @@ NALUnit::GetWord(int nBits){
}
unsigned long
NALUnit::GetUE(){
LFNALUnit::GetUE(){
// Exp-Golomb entropy coding: leading zeros, then a one, then
// the data bits. The number of leading zeros is the number of
// data bits, counting up from that number of 1s as the base.
@@ -188,7 +188,7 @@ NALUnit::GetUE(){
}
long
NALUnit::GetSE(){
LFNALUnit::GetSE(){
// same as UE but signed.
// basically the unsigned numbers are used as codes to indicate signed numbers in pairs
// in increasing value. Thus the encoded values
@@ -206,7 +206,7 @@ NALUnit::GetSE(){
}
// --- sequence params parsing ---------------
SeqParamSet::SeqParamSet()
LFSeqParamSet::LFSeqParamSet()
: m_cx(0),
m_cy(0),
m_FrameBits(0){
@@ -214,7 +214,7 @@ SeqParamSet::SeqParamSet()
}
void
ScalingList(int size, NALUnit *pnalu){
ScalingList(int size, LFNALUnit *pnalu){
long lastScale = 8;
long nextScale = 8;
for (int j = 0; j < size; j++) {
@@ -228,8 +228,8 @@ ScalingList(int size, NALUnit *pnalu){
}
bool
SeqParamSet::Parse(NALUnit *pnalu){
if (pnalu->Type() != NALUnit::NAL_Sequence_Params) {
LFSeqParamSet::Parse(LFNALUnit *pnalu){
if (pnalu->Type() != LFNALUnit::NAL_Sequence_Params) {
return false;
}
@@ -339,11 +339,11 @@ SeqParamSet::Parse(NALUnit *pnalu){
// --- slice header --------------------
bool
SliceHeader::Parse(NALUnit *pnalu){
LFSliceHeader::Parse(LFNALUnit *pnalu){
switch (pnalu->Type()) {
case NALUnit::NAL_IDR_Slice:
case NALUnit::NAL_Slice:
case NALUnit::NAL_PartitionA:
case LFNALUnit::NAL_IDR_Slice:
case LFNALUnit::NAL_Slice:
case LFNALUnit::NAL_PartitionA:
// all these begin with a slice header
break;
@@ -366,7 +366,7 @@ SliceHeader::Parse(NALUnit *pnalu){
// --- SEI ----------------------
SEIMessage::SEIMessage(NALUnit *pnalu){
LFSEIMessage::LFSEIMessage(LFNALUnit *pnalu){
m_pnalu = pnalu;
const BYTE *p = pnalu->Start();
p++; // nalu type byte
@@ -387,7 +387,7 @@ SEIMessage::SEIMessage(NALUnit *pnalu){
m_idxPayload = int(p - m_pnalu->Start());
}
avcCHeader::avcCHeader(const BYTE *header, int cBytes){
LFavcCHeader::LFavcCHeader(const BYTE *header, int cBytes){
if (cBytes < 8) {
return;
}
@@ -405,7 +405,7 @@ avcCHeader::avcCHeader(const BYTE *header, int cBytes){
return;
}
if (i == 0) {
NALUnit n(header, cThis);
LFNALUnit n(header, cThis);
m_sps = n;
}
header += cThis;
@@ -417,7 +417,7 @@ avcCHeader::avcCHeader(const BYTE *header, int cBytes){
if (cPPS > 0) {
int cThis = (header[1] << 8) + header[2];
header += 3;
NALUnit n(header, cThis);
LFNALUnit n(header, cThis);
m_pps = n;
}
}
@@ -18,25 +18,25 @@ typedef unsigned long ULONG;
#define NULL 0
#endif
class NALUnit
class LFNALUnit
{
public:
NALUnit();
NALUnit(const BYTE* pStart, int len){
LFNALUnit();
LFNALUnit(const BYTE* pStart, int len){
m_pStart = m_pStartCodeStart = pStart;
m_cBytes = len;
ResetBitstream();
}
virtual ~NALUnit() {
virtual ~LFNALUnit() {
}
// assignment copies a pointer into a fixed buffer managed elsewhere. We do not copy the data
NALUnit(const NALUnit &r){
LFNALUnit(const LFNALUnit &r){
m_pStart = r.m_pStart;
m_cBytes = r.m_cBytes;
ResetBitstream();
}
const NALUnit& operator = (const NALUnit &r)
const LFNALUnit& operator = (const LFNALUnit &r)
{
m_pStart = r.m_pStart;
m_cBytes = r.m_cBytes;
@@ -109,11 +109,11 @@ private:
// simple parser for the Sequence parameter set things that we need
class SeqParamSet
class LFSeqParamSet
{
public:
SeqParamSet();
bool Parse(NALUnit *pnalu);
LFSeqParamSet();
bool Parse(LFNALUnit *pnalu);
int FrameBits(){
return m_FrameBits;
}
@@ -162,12 +162,12 @@ public:
return m_Compatibility;
}
NALUnit *NALU() {
LFNALUnit *NALU() {
return &m_nalu;
}
private:
NALUnit m_nalu;
LFNALUnit m_nalu;
int m_FrameBits;
long m_cx;
long m_cy;
@@ -180,15 +180,15 @@ private:
};
// extract frame num from slice headers
class SliceHeader
class LFSliceHeader
{
public:
SliceHeader(int nBitsFrame)
LFSliceHeader(int nBitsFrame)
: m_framenum(0),
m_nBitsFrame(nBitsFrame){
}
bool Parse(NALUnit *pnalu);
bool Parse(LFNALUnit *pnalu);
int FrameNum(){
return m_framenum;
}
@@ -199,10 +199,10 @@ private:
};
// SEI message structure
class SEIMessage
class LFSEIMessage
{
public:
SEIMessage(NALUnit* pnalu);
LFSEIMessage(LFNALUnit* pnalu);
int Type() {
return m_type;
}
@@ -216,27 +216,27 @@ public:
}
private:
NALUnit *m_pnalu;
LFNALUnit *m_pnalu;
int m_type;
int m_length;
int m_idxPayload;
};
// avcC structure from MP4
class avcCHeader
class LFavcCHeader
{
public:
avcCHeader(const BYTE* header, int cBytes);
NALUnit *sps() {
LFavcCHeader(const BYTE* header, int cBytes);
LFNALUnit *sps() {
return &m_sps;
}
NALUnit *pps() {
LFNALUnit *pps() {
return &m_pps;
}
private:
NALUnit m_sps;
NALUnit m_pps;
LFNALUnit m_sps;
LFNALUnit m_pps;
};
@@ -12,13 +12,13 @@
#import "AVFoundation/AVMediaFormat.h"
#import "AVFoundation/AVVideoSettings.h"
@interface VideoEncoder : NSObject
@interface LFVideoEncoder : NSObject
@property NSString *path;
@property (nonatomic, readonly) NSUInteger bitrate;
+ (VideoEncoder *)encoderForPath:(NSString *)path Height:(int)height andWidth:(int)width bitrate:(int)bitrate;
+ (LFVideoEncoder *)encoderForPath:(NSString *)path Height:(int)height andWidth:(int)width bitrate:(int)bitrate;
- (void)initPath:(NSString *)path Height:(int)height andWidth:(int)width bitrate:(int)bitrate;
- (void)finishWithCompletionHandler:(void (^)(void))handler;
@@ -1,14 +1,14 @@
//
// VideoEncoder.m
// LFVideoEncoder.m
// Encoder Demo
//
// Created by Geraint Davies on 14/01/2013.
// Copyright (c) 2013 GDCL http://www.gdcl.co.uk/license.htm
//
#import "VideoEncoder.h"
#import "LFVideoEncoder.h"
@implementation VideoEncoder
@implementation LFVideoEncoder
{
AVAssetWriter *_writer;
AVAssetWriterInput *_writerInput;
@@ -17,8 +17,8 @@
@synthesize path = _path;
+ (VideoEncoder *)encoderForPath:(NSString *)path Height:(int)height andWidth:(int)width bitrate:(int)bitrate {
VideoEncoder *enc = [VideoEncoder alloc];
+ (LFVideoEncoder *)encoderForPath:(NSString *)path Height:(int)height andWidth:(int)width bitrate:(int)bitrate {
LFVideoEncoder *enc = [LFVideoEncoder alloc];
[enc initPath:path Height:height andWidth:width bitrate:bitrate];
return enc;
}
+6 -6
View File
@@ -8,8 +8,8 @@
#import <CoreMedia/CoreMedia.h>
#import <mach/mach_time.h>
#import "NALUnit.h"
#import "AVEncoder.h"
#import "LFNALUnit.h"
#import "LFAVEncoder.h"
#import "LFH264VideoEncoder.h"
#import "LFVideoFrame.h"
@@ -24,7 +24,7 @@
@property (nonatomic) NSInteger currentVideoBitRate;
@property (nonatomic, strong) dispatch_queue_t sendQueue;
@property (nonatomic, strong) AVEncoder *encoder;
@property (nonatomic, strong) LFAVEncoder *encoder;
@property (nonatomic, strong) NSData *naluStartCode;
@property (nonatomic, strong) NSMutableData *videoSPSandPPS;
@@ -60,7 +60,7 @@
[self initForFilePath];
#endif
_encoder = [AVEncoder encoderForHeight:_configuration.videoSize.height andWidth:_configuration.videoSize.width bitrate:_configuration.videoBitRate];
_encoder = [LFAVEncoder encoderForHeight:_configuration.videoSize.height andWidth:_configuration.videoSize.width bitrate:_configuration.videoBitRate];
[_encoder encodeWithBlock:^int(NSArray* dataArray, CMTimeValue ptsValue) {
[self incomingVideoFrames:dataArray ptsValue:ptsValue];
return 0;
@@ -85,8 +85,8 @@
if (!config) {
return;
}
avcCHeader avcC((const BYTE*)[config bytes], [config length]);
SeqParamSet seqParams;
LFavcCHeader avcC((const BYTE*)[config bytes], [config length]);
LFSeqParamSet seqParams;
seqParams.Parse(avcC.sps());
NSData* spsData = [NSData dataWithBytes:avcC.sps()->Start() length:avcC.sps()->Length()];
+1 -1
View File
@@ -68,7 +68,7 @@
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_DataRateLimits, (__bridge CFArrayRef)limit);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_RealTime, kCFBooleanFalse);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_ProfileLevel, kVTProfileLevel_H264_Main_AutoLevel);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AllowFrameReordering, kCFBooleanFalse);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AllowFrameReordering, kCFBooleanTrue);
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_H264EntropyMode, kVTH264EntropyMode_CABAC);
VTCompressionSessionPrepareToEncodeFrames(compressionSession);
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B2D23E791D348F3D00B34CA8"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>LFLiveKitDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>B2D23E791D348F3D00B34CA8</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+76 -68
View File
@@ -1,10 +1,12 @@
LFLiveKit
==============
![icon~](https://raw.github.com/LaiFengiOS/LFLiveKit/master/LFLiveKitDemo/LFLiveKitDemo/Icon.png)
[![Build Status](https://travis-ci.org/LaiFengiOS/LFLiveKit.svg)](https://travis-ci.org/LaiFengiOS/LFLiveKit)&nbsp;
[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/chenliming777/LFLiveKit/master/LICENSE)&nbsp;
[![CocoaPods](http://img.shields.io/cocoapods/v/LFLiveKit.svg?style=flat)](http://cocoapods.org/?q=LFLiveKit)&nbsp;
[![Support](https://img.shields.io/badge/support-ios8%2B-orange.svg)](https://www.apple.com/nl/ios/)&nbsp;
[![Support](https://img.shields.io/badge/ios-7-orange.svg)](https://www.apple.com/nl/ios/)&nbsp;
![platform](https://img.shields.io/badge/platform-ios-ff69b4.svg)&nbsp;
@@ -27,6 +29,9 @@ LFLiveKit
- [x] Swift Support
- [ ] ~~FLV package and send~~
## Requirements
- iOS 7.0+
- Xcode 7.3
## Installation
@@ -34,93 +39,96 @@ LFLiveKit
# To integrate LFLiveKit into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
platform :ios, '7.0'
pod 'LFLiveKit'
# Then, run the following command:
$ pod install
### Manually
#### Carthage
1. Add `github "LaiFengiOS/LFLiveKit"` to your Cartfile.
2. Run `carthage update --platform ios` and add the framework to your project.
3. Import \<LFLiveKit/LFLiveKit.h\>.
1. Download all the files in the `LFLiveKit` subdirectory.
2. Add the source files to your Xcode project.
3. Link with required frameworks:
* UIKit
* Foundation
* AVFoundation
* VideoToolbox
* AudioToolbox
* libz
5. Add `LMGPUImage and pili-librtmp`(static library) to your Xcode project.
## Architecture:
#### Manually
capture: LFAudioCapture and LFVideoCapture
encode: LFHardwareAudioEncoder and LFHardwareVideoEncoder
publish: LFStreamRtmpSocket
1. Download all the files in the `LFLiveKit` subdirectory.
2. Add the source files to your Xcode project.
3. Link with required frameworks:
* UIKit
* Foundation
* AVFoundation
* VideoToolbox
* AudioToolbox
* libz
## Usage:
## Usage example
#### Objective-C
```
- (LFLiveSession*)session {
if (!_session) {
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
_session.preView = self;
_session.delegate = self;
- (LFLiveSession*)session {
if (!_session) {
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
_session.preView = self;
_session.delegate = self;
}
return _session;
}
- (void)startLive {
LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new];
streamInfo.url = @"your server rtmp url";
[self.session startLive:streamInfo];
}
return _session;
}
- (void)startLive {
LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new];
streamInfo.url = @"your server rtmp url";
[self.session startLive:streamInfo];
}
- (void)stopLive {
[self.session stopLive];
}
- (void)stopLive {
[self.session stopLive];
}
//MARK: - CallBack:
- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state;
- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo;
- (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode;
//MARK: - CallBack:
- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state;
- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo;
- (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode;
```
#### Swift
```
// import LFLiveKit in [ProjectName]-Bridging-Header.h
import <LFLiveKit.h>
// import LFLiveKit in [ProjectName]-Bridging-Header.h
import <LFLiveKit.h>
//MARK: - Getters and Setters
lazy var session: LFLiveSession = {
let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration()
let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false)
let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration)
session?.delegate = self
session?.preView = self.view
return session!
}()
//MARK: - Getters and Setters
lazy var session: LFLiveSession = {
let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration()
let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false)
let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration)
session?.delegate = self
session?.preView = self.view
return session!
}()
//MARK: - Event
func startLive() -> Void {
let stream = LFLiveStreamInfo()
stream.url = "your server rtmp url";
session.startLive(stream)
}
//MARK: - Event
func startLive() -> Void {
let stream = LFLiveStreamInfo()
stream.url = "your server rtmp url";
session.startLive(stream)
}
func stopLive() -> Void {
session.stopLive()
}
func stopLive() -> Void {
session.stopLive()
}
//MARK: - Callback
func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?)
func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode)
func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState)
## Release History
* 2.0.0
* CHANGE: modify bugs,support ios7 live.
//MARK: - Callback
func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?)
func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode)
func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState)
```
## License
**LFLiveKit is released under the MIT license. See LICENSE for details.**