├── .DS_Store ├── .gitattributes ├── GetVolumeLevelsFromeSampleBuffer.podspec ├── GetVolumeLevelsFromeSampleBuffer.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── huyangyang.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── huyangyang.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── GetVolumeLevelsFromeSampleBuffer ├── GetVolumeLevelsFromeSampleBuffer.h ├── Info.plist ├── SampleBufferToVolumeLevelsEngine.h └── SampleBufferToVolumeLevelsEngine.m ├── LICENSE └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doubleYang1020/GetVolumeLevelsFromeSampleBuffer/c8e272e5017e7f06f824df0fb739266aae9e090c/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'GetVolumeLevelsFromeSampleBuffer' 4 | s.version = '1.0.7' 5 | s.authors = { "阳眼的熊" => "237505990@qq.com" } 6 | s.homepage = 'https://github.com/doubleYang1020/GetVolumeLevelsFromeSampleBuffer' 7 | s.summary = 'this is get volumeLevels from sampleBuffer engine' 8 | s.source = { :git => 'https://github.com/doubleYang1020/GetVolumeLevelsFromeSampleBuffer',:tag => s.version.to_s } 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | 11 | s.platform = :ios, '8.0' 12 | s.requires_arc = true 13 | s.source_files = 'GetVolumeLevelsFromeSampleBuffer' 14 | s.public_header_files = 'GetVolumeLevelsFromeSampleBuffer/*.h' 15 | 16 | s.ios.deployment_target = '8.0' 17 | s.frameworks = 'AVFoundation' 18 | end 19 | 20 | 21 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F287FCD41FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = F287FCD21FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | F287FCDC1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = F287FCDA1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | F287FCDD1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = F287FCDB1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.m */; }; 13 | F287FCDF1FDAA6EA000F29B1 /* GetVolumeLevelsFromeSampleBuffer.podspec in Resources */ = {isa = PBXBuildFile; fileRef = F287FCDE1FDAA6EA000F29B1 /* GetVolumeLevelsFromeSampleBuffer.podspec */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | F287FCCF1FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GetVolumeLevelsFromeSampleBuffer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | F287FCD21FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GetVolumeLevelsFromeSampleBuffer.h; sourceTree = ""; }; 19 | F287FCD31FDAA4C3000F29B1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 20 | F287FCDA1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SampleBufferToVolumeLevelsEngine.h; sourceTree = ""; }; 21 | F287FCDB1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SampleBufferToVolumeLevelsEngine.m; sourceTree = ""; }; 22 | F287FCDE1FDAA6EA000F29B1 /* GetVolumeLevelsFromeSampleBuffer.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GetVolumeLevelsFromeSampleBuffer.podspec; sourceTree = SOURCE_ROOT; }; 23 | /* End PBXFileReference section */ 24 | 25 | /* Begin PBXFrameworksBuildPhase section */ 26 | F287FCCB1FDAA4C3000F29B1 /* Frameworks */ = { 27 | isa = PBXFrameworksBuildPhase; 28 | buildActionMask = 2147483647; 29 | files = ( 30 | ); 31 | runOnlyForDeploymentPostprocessing = 0; 32 | }; 33 | /* End PBXFrameworksBuildPhase section */ 34 | 35 | /* Begin PBXGroup section */ 36 | F287FCC51FDAA4C3000F29B1 = { 37 | isa = PBXGroup; 38 | children = ( 39 | F287FCD11FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer */, 40 | F287FCD01FDAA4C3000F29B1 /* Products */, 41 | ); 42 | sourceTree = ""; 43 | }; 44 | F287FCD01FDAA4C3000F29B1 /* Products */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | F287FCCF1FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.framework */, 48 | ); 49 | name = Products; 50 | sourceTree = ""; 51 | }; 52 | F287FCD11FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | F287FCD21FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.h */, 56 | F287FCDA1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.h */, 57 | F287FCDB1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.m */, 58 | F287FCD31FDAA4C3000F29B1 /* Info.plist */, 59 | F287FCDE1FDAA6EA000F29B1 /* GetVolumeLevelsFromeSampleBuffer.podspec */, 60 | ); 61 | path = GetVolumeLevelsFromeSampleBuffer; 62 | sourceTree = ""; 63 | }; 64 | /* End PBXGroup section */ 65 | 66 | /* Begin PBXHeadersBuildPhase section */ 67 | F287FCCC1FDAA4C3000F29B1 /* Headers */ = { 68 | isa = PBXHeadersBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | F287FCDC1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.h in Headers */, 72 | F287FCD41FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.h in Headers */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXHeadersBuildPhase section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | F287FCCE1FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = F287FCD71FDAA4C3000F29B1 /* Build configuration list for PBXNativeTarget "GetVolumeLevelsFromeSampleBuffer" */; 82 | buildPhases = ( 83 | F287FCCA1FDAA4C3000F29B1 /* Sources */, 84 | F287FCCB1FDAA4C3000F29B1 /* Frameworks */, 85 | F287FCCC1FDAA4C3000F29B1 /* Headers */, 86 | F287FCCD1FDAA4C3000F29B1 /* Resources */, 87 | ); 88 | buildRules = ( 89 | ); 90 | dependencies = ( 91 | ); 92 | name = GetVolumeLevelsFromeSampleBuffer; 93 | productName = GetVolumeLevelsFromeSampleBuffer; 94 | productReference = F287FCCF1FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer.framework */; 95 | productType = "com.apple.product-type.framework"; 96 | }; 97 | /* End PBXNativeTarget section */ 98 | 99 | /* Begin PBXProject section */ 100 | F287FCC61FDAA4C3000F29B1 /* Project object */ = { 101 | isa = PBXProject; 102 | attributes = { 103 | LastUpgradeCheck = 0910; 104 | ORGANIZATIONNAME = HuYangYang.com; 105 | TargetAttributes = { 106 | F287FCCE1FDAA4C3000F29B1 = { 107 | CreatedOnToolsVersion = 9.1; 108 | ProvisioningStyle = Automatic; 109 | }; 110 | }; 111 | }; 112 | buildConfigurationList = F287FCC91FDAA4C3000F29B1 /* Build configuration list for PBXProject "GetVolumeLevelsFromeSampleBuffer" */; 113 | compatibilityVersion = "Xcode 8.0"; 114 | developmentRegion = en; 115 | hasScannedForEncodings = 0; 116 | knownRegions = ( 117 | en, 118 | ); 119 | mainGroup = F287FCC51FDAA4C3000F29B1; 120 | productRefGroup = F287FCD01FDAA4C3000F29B1 /* Products */; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | F287FCCE1FDAA4C3000F29B1 /* GetVolumeLevelsFromeSampleBuffer */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXResourcesBuildPhase section */ 130 | F287FCCD1FDAA4C3000F29B1 /* Resources */ = { 131 | isa = PBXResourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | F287FCDF1FDAA6EA000F29B1 /* GetVolumeLevelsFromeSampleBuffer.podspec in Resources */, 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | /* End PBXResourcesBuildPhase section */ 139 | 140 | /* Begin PBXSourcesBuildPhase section */ 141 | F287FCCA1FDAA4C3000F29B1 /* Sources */ = { 142 | isa = PBXSourcesBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | F287FCDD1FDAA4E0000F29B1 /* SampleBufferToVolumeLevelsEngine.m in Sources */, 146 | ); 147 | runOnlyForDeploymentPostprocessing = 0; 148 | }; 149 | /* End PBXSourcesBuildPhase section */ 150 | 151 | /* Begin XCBuildConfiguration section */ 152 | F287FCD51FDAA4C3000F29B1 /* Debug */ = { 153 | isa = XCBuildConfiguration; 154 | buildSettings = { 155 | ALWAYS_SEARCH_USER_PATHS = NO; 156 | CLANG_ANALYZER_NONNULL = YES; 157 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 158 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 159 | CLANG_CXX_LIBRARY = "libc++"; 160 | CLANG_ENABLE_MODULES = YES; 161 | CLANG_ENABLE_OBJC_ARC = YES; 162 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 163 | CLANG_WARN_BOOL_CONVERSION = YES; 164 | CLANG_WARN_COMMA = YES; 165 | CLANG_WARN_CONSTANT_CONVERSION = YES; 166 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 167 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 168 | CLANG_WARN_EMPTY_BODY = YES; 169 | CLANG_WARN_ENUM_CONVERSION = YES; 170 | CLANG_WARN_INFINITE_RECURSION = YES; 171 | CLANG_WARN_INT_CONVERSION = YES; 172 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 173 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 174 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 175 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 176 | CLANG_WARN_STRICT_PROTOTYPES = YES; 177 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 178 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 179 | CLANG_WARN_UNREACHABLE_CODE = YES; 180 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 181 | CODE_SIGN_IDENTITY = "iPhone Developer"; 182 | COPY_PHASE_STRIP = NO; 183 | CURRENT_PROJECT_VERSION = 1; 184 | DEBUG_INFORMATION_FORMAT = dwarf; 185 | ENABLE_STRICT_OBJC_MSGSEND = YES; 186 | ENABLE_TESTABILITY = YES; 187 | GCC_C_LANGUAGE_STANDARD = gnu11; 188 | GCC_DYNAMIC_NO_PIC = NO; 189 | GCC_NO_COMMON_BLOCKS = YES; 190 | GCC_OPTIMIZATION_LEVEL = 0; 191 | GCC_PREPROCESSOR_DEFINITIONS = ( 192 | "DEBUG=1", 193 | "$(inherited)", 194 | ); 195 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 196 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 197 | GCC_WARN_UNDECLARED_SELECTOR = YES; 198 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 199 | GCC_WARN_UNUSED_FUNCTION = YES; 200 | GCC_WARN_UNUSED_VARIABLE = YES; 201 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 202 | MTL_ENABLE_DEBUG_INFO = YES; 203 | ONLY_ACTIVE_ARCH = YES; 204 | SDKROOT = iphoneos; 205 | VERSIONING_SYSTEM = "apple-generic"; 206 | VERSION_INFO_PREFIX = ""; 207 | }; 208 | name = Debug; 209 | }; 210 | F287FCD61FDAA4C3000F29B1 /* Release */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | CLANG_ANALYZER_NONNULL = YES; 215 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 216 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 217 | CLANG_CXX_LIBRARY = "libc++"; 218 | CLANG_ENABLE_MODULES = YES; 219 | CLANG_ENABLE_OBJC_ARC = YES; 220 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 221 | CLANG_WARN_BOOL_CONVERSION = YES; 222 | CLANG_WARN_COMMA = YES; 223 | CLANG_WARN_CONSTANT_CONVERSION = YES; 224 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 225 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 226 | CLANG_WARN_EMPTY_BODY = YES; 227 | CLANG_WARN_ENUM_CONVERSION = YES; 228 | CLANG_WARN_INFINITE_RECURSION = YES; 229 | CLANG_WARN_INT_CONVERSION = YES; 230 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 231 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 232 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 233 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 234 | CLANG_WARN_STRICT_PROTOTYPES = YES; 235 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 236 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 237 | CLANG_WARN_UNREACHABLE_CODE = YES; 238 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 239 | CODE_SIGN_IDENTITY = "iPhone Developer"; 240 | COPY_PHASE_STRIP = NO; 241 | CURRENT_PROJECT_VERSION = 1; 242 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 243 | ENABLE_NS_ASSERTIONS = NO; 244 | ENABLE_STRICT_OBJC_MSGSEND = YES; 245 | GCC_C_LANGUAGE_STANDARD = gnu11; 246 | GCC_NO_COMMON_BLOCKS = YES; 247 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 248 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 249 | GCC_WARN_UNDECLARED_SELECTOR = YES; 250 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 251 | GCC_WARN_UNUSED_FUNCTION = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 254 | MTL_ENABLE_DEBUG_INFO = NO; 255 | SDKROOT = iphoneos; 256 | VALIDATE_PRODUCT = YES; 257 | VERSIONING_SYSTEM = "apple-generic"; 258 | VERSION_INFO_PREFIX = ""; 259 | }; 260 | name = Release; 261 | }; 262 | F287FCD81FDAA4C3000F29B1 /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | CODE_SIGN_IDENTITY = ""; 266 | CODE_SIGN_STYLE = Automatic; 267 | DEFINES_MODULE = YES; 268 | DEVELOPMENT_TEAM = DASH6JFSDW; 269 | DYLIB_COMPATIBILITY_VERSION = 1; 270 | DYLIB_CURRENT_VERSION = 1; 271 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 272 | INFOPLIST_FILE = GetVolumeLevelsFromeSampleBuffer/Info.plist; 273 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 274 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 275 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 276 | PRODUCT_BUNDLE_IDENTIFIER = HuYangYang.GetVolumeLevelsFromeSampleBuffer; 277 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 278 | SKIP_INSTALL = YES; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | }; 281 | name = Debug; 282 | }; 283 | F287FCD91FDAA4C3000F29B1 /* Release */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | CODE_SIGN_IDENTITY = ""; 287 | CODE_SIGN_STYLE = Automatic; 288 | DEFINES_MODULE = YES; 289 | DEVELOPMENT_TEAM = DASH6JFSDW; 290 | DYLIB_COMPATIBILITY_VERSION = 1; 291 | DYLIB_CURRENT_VERSION = 1; 292 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 293 | INFOPLIST_FILE = GetVolumeLevelsFromeSampleBuffer/Info.plist; 294 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 295 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 296 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 297 | PRODUCT_BUNDLE_IDENTIFIER = HuYangYang.GetVolumeLevelsFromeSampleBuffer; 298 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 299 | SKIP_INSTALL = YES; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | }; 302 | name = Release; 303 | }; 304 | /* End XCBuildConfiguration section */ 305 | 306 | /* Begin XCConfigurationList section */ 307 | F287FCC91FDAA4C3000F29B1 /* Build configuration list for PBXProject "GetVolumeLevelsFromeSampleBuffer" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | F287FCD51FDAA4C3000F29B1 /* Debug */, 311 | F287FCD61FDAA4C3000F29B1 /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | F287FCD71FDAA4C3000F29B1 /* Build configuration list for PBXNativeTarget "GetVolumeLevelsFromeSampleBuffer" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | F287FCD81FDAA4C3000F29B1 /* Debug */, 320 | F287FCD91FDAA4C3000F29B1 /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = F287FCC61FDAA4C3000F29B1 /* Project object */; 328 | } 329 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer.xcodeproj/project.xcworkspace/xcuserdata/huyangyang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doubleYang1020/GetVolumeLevelsFromeSampleBuffer/c8e272e5017e7f06f824df0fb739266aae9e090c/GetVolumeLevelsFromeSampleBuffer.xcodeproj/project.xcworkspace/xcuserdata/huyangyang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer.xcodeproj/xcuserdata/huyangyang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GetVolumeLevelsFromeSampleBuffer.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer/GetVolumeLevelsFromeSampleBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // GetVolumeLevelsFromeSampleBuffer.h 3 | // GetVolumeLevelsFromeSampleBuffer 4 | // 5 | // Created by huyangyang on 2017/12/8. 6 | // Copyright © 2017年 HuYangYang.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for GetVolumeLevelsFromeSampleBuffer. 12 | FOUNDATION_EXPORT double GetVolumeLevelsFromeSampleBufferVersionNumber; 13 | 14 | //! Project version string for GetVolumeLevelsFromeSampleBuffer. 15 | FOUNDATION_EXPORT const unsigned char GetVolumeLevelsFromeSampleBufferVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer/SampleBufferToVolumeLevelsEngine.h: -------------------------------------------------------------------------------- 1 | // 2 | // SampleBufferToVolumeLevelsEngine.h 3 | // GetVolumeLevelsFromeSampleBuffer 4 | // 5 | // Created by huyangyang on 2017/12/8. 6 | // Copyright © 2017年 HuYangYang.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | @interface SampleBufferToVolumeLevelsEngine : NSObject 12 | +(float)getVolumeLevelsFromeSampleBuffer:(CMSampleBufferRef)sampleBuffer; 13 | @end 14 | -------------------------------------------------------------------------------- /GetVolumeLevelsFromeSampleBuffer/SampleBufferToVolumeLevelsEngine.m: -------------------------------------------------------------------------------- 1 | // 2 | // SampleBufferToVolumeLevelsEngine.m 3 | // GetVolumeLevelsFromeSampleBuffer 4 | // 5 | // Created by huyangyang on 2017/12/8. 6 | // Copyright © 2017年 HuYangYang.com. All rights reserved. 7 | // 8 | 9 | #import "SampleBufferToVolumeLevelsEngine.h" 10 | @implementation SampleBufferToVolumeLevelsEngine 11 | 12 | +(float)getVolumeLevelsFromeSampleBuffer:(CMSampleBufferRef)sampleBuffer{ 13 | CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer); 14 | const AudioStreamBasicDescription asbd = *CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription); 15 | 16 | AudioBufferList bufferList; 17 | int listSize = sizeof(bufferList); 18 | CMBlockBufferRef blockBuffer; 19 | OSStatus result; 20 | result = CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, nil, &bufferList, listSize, nil, nil, kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment, &blockBuffer); 21 | 22 | float avgLevel = 0.0; 23 | if (result == 0) { 24 | AudioBuffer audioBuffer = bufferList.mBuffers[0]; 25 | if (asbd.mFormatFlags & kAudioFormatFlagIsFloat) { // float 26 | 27 | float* x = (float*) audioBuffer.mData; 28 | float sum = 0; 29 | int count = audioBuffer.mDataByteSize / sizeof(float); 30 | for (long i = 0; i < count; i ++) { 31 | sum += (*x) * (*x); 32 | x++; 33 | } 34 | 35 | avgLevel = sqrtf(sum / count); 36 | 37 | } 38 | else { 39 | assert(asbd.mFormatFlags & kLinearPCMFormatFlagIsSignedInteger); // signed int 40 | Byte *frame = (Byte *)audioBuffer.mData; 41 | float sum = 0; 42 | int d = audioBuffer.mDataByteSize/2; 43 | for (long i = 0; i < d; i++) { 44 | long x1, x2; 45 | if (asbd.mFormatFlags & kAudioFormatFlagIsPacked) { 46 | x1 = frame[i * 2 + 1] << 8; 47 | x2 = frame[i * 2]; 48 | } 49 | else { 50 | x1 = frame[i * 2 + 1]; 51 | x2 = frame[i * 2] << 8; 52 | } 53 | short int w = x1 | x2; 54 | 55 | sum += w*w; 56 | } 57 | 58 | avgLevel = sqrtf(sum/d); 59 | } 60 | 61 | } 62 | 63 | CFRelease(blockBuffer); 64 | 65 | return avgLevel; 66 | } 67 | @end 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 阳眼的熊 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GetVolumeLevelsFromeSampleBuffer 2 | 3 | * An easy way to get volumeLevels frome sampleBuffer 4 | * use Objective-C 5 | 6 | ### How to use GetVolumeLevelsFromeSampleBuffer 7 | 8 | * Installation with CocoaPods:```pod 'GetVolumeLevelsFromeSampleBuffer'``` 9 | * Manual import:```#import "SampleBufferToVolumeLevelsEngine.h"``` 10 | * ```float volume = [SampleBufferToVolumeLevelsEngine getVolumeLevelsFromeSampleBuffer:buffer];``` 11 | 12 | 13 | ### Contact information: 14 | * weibo: [阳眼的熊1993](https://weibo.com/u/5696616175) 15 | * email: [hu-yangyang@qq.com](mailto:hu-yangyang@qq.com) 16 | --------------------------------------------------------------------------------