├── DVAVKit ├── DVAVKit.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── mlgPro.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── DVAVKit.xcscheme │ │ │ ├── DVAVKitBundle.xcscheme │ │ │ └── DVAVKitShell.xcscheme │ └── xcuserdata │ │ └── mlgPro.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── DVAVKit │ ├── DVAVKit.h │ ├── DVAVKitHeader.pch │ ├── Info.plist │ ├── Utils │ │ ├── AVPlayer │ │ │ └── AudioPlayer │ │ │ │ ├── DVAudioPlayer.h │ │ │ │ └── DVAudioPlayer.m │ │ ├── AudioTool │ │ │ ├── AudioCoder │ │ │ │ ├── DVAudioCoderKit.h │ │ │ │ ├── DVAudioDecoder.h │ │ │ │ ├── DVAudioEncoder.h │ │ │ │ ├── Decoder │ │ │ │ │ ├── DVAudioAACHardwareDecoder.h │ │ │ │ │ └── DVAudioAACHardwareDecoder.m │ │ │ │ └── Encoder │ │ │ │ │ ├── DVAudioAACHardwareEncoder.h │ │ │ │ │ └── DVAudioAACHardwareEncoder.m │ │ │ ├── AudioQueue │ │ │ │ ├── DVAudioQueue.h │ │ │ │ └── DVAudioQueue.m │ │ │ ├── AudioUnit │ │ │ │ ├── DVAudioUnit.h │ │ │ │ ├── DVAudioUnit.m │ │ │ │ ├── DVAudioUnitKit.h │ │ │ │ └── Unit │ │ │ │ │ ├── DVAudioIOUnit.h │ │ │ │ │ ├── DVAudioIOUnit.m │ │ │ │ │ ├── DVAudioMixUnit.h │ │ │ │ │ └── DVAudioMixUnit.m │ │ │ ├── Configuration │ │ │ │ ├── DVAudioComponentDesc.h │ │ │ │ ├── DVAudioComponentDesc.m │ │ │ │ ├── DVAudioConfig.h │ │ │ │ ├── DVAudioConfig.m │ │ │ │ ├── DVAudioStreamBaseDesc.h │ │ │ │ └── DVAudioStreamBaseDesc.m │ │ │ ├── DVAudioToolKit.h │ │ │ ├── Other │ │ │ │ ├── DVAudioError.h │ │ │ │ └── DVAudioError.m │ │ │ └── Packet │ │ │ │ ├── DVAudioPacket.h │ │ │ │ └── DVAudioPacket.m │ │ ├── FFmpeg │ │ │ ├── DVFFmpegKit.h │ │ │ ├── FFBuffer │ │ │ │ ├── FFBuffer.h │ │ │ │ ├── FFBuffer.m │ │ │ │ ├── NSMutableArray+FFBuffer.h │ │ │ │ └── NSMutableArray+FFBuffer.m │ │ │ ├── FFCodec │ │ │ │ ├── AudioCodec │ │ │ │ │ └── Encodec │ │ │ │ │ │ └── G726 │ │ │ │ │ │ ├── EncoderG726.h │ │ │ │ │ │ ├── EncoderG726.mm │ │ │ │ │ │ ├── G726Encodec.cpp │ │ │ │ │ │ └── G726Encodec.hpp │ │ │ │ └── VideoCodec │ │ │ │ │ └── Encodec │ │ │ │ │ ├── FFH264Encodec.h │ │ │ │ │ └── FFH264Encodec.m │ │ │ ├── FFFormatContext │ │ │ │ ├── InFormatContext │ │ │ │ │ ├── FFInFormatContext+IO.h │ │ │ │ │ ├── FFInFormatContext+IO.mm │ │ │ │ │ ├── FFInFormatContext.h │ │ │ │ │ └── FFInFormatContext.mm │ │ │ │ └── OutFormatContext │ │ │ │ │ ├── FFOutFormatContext+IO.h │ │ │ │ │ ├── FFOutFormatContext+IO.mm │ │ │ │ │ ├── FFOutFormatContext.h │ │ │ │ │ └── FFOutFormatContext.mm │ │ │ ├── FFFrame │ │ │ │ ├── FFFrame.h │ │ │ │ └── FFFrame.mm │ │ │ ├── FFInfo │ │ │ │ ├── FFAudioInfo.h │ │ │ │ ├── FFAudioInfo.m │ │ │ │ ├── FFVideoInfo.h │ │ │ │ └── FFVideoInfo.m │ │ │ ├── FFLibrary │ │ │ │ ├── libFFmpeg.cpp │ │ │ │ └── libFFmpeg.hpp │ │ │ ├── FFPacket │ │ │ │ ├── FFPacket.h │ │ │ │ └── FFPacket.mm │ │ │ ├── FFSession │ │ │ │ ├── FFSession.h │ │ │ │ └── FFSession.mm │ │ │ └── FFUtils │ │ │ │ ├── FFUtils.h │ │ │ │ └── FFUtils.mm │ │ ├── Flv │ │ │ ├── DVFlv.h │ │ │ ├── DVFlv.m │ │ │ ├── DVFlvKit.h │ │ │ └── FlvTag │ │ │ │ ├── DVFlvTag.h │ │ │ │ ├── DVFlvTag.m │ │ │ │ ├── FlvTagData │ │ │ │ ├── AudioFlvTagData │ │ │ │ │ ├── AudioPacket │ │ │ │ │ │ ├── DVAACAudioPacket.h │ │ │ │ │ │ └── DVAACAudioPacket.m │ │ │ │ │ ├── DVAudioFlvTagData.h │ │ │ │ │ └── DVAudioFlvTagData.m │ │ │ │ ├── DVFlvTagData.h │ │ │ │ ├── MetaFlvTagData │ │ │ │ │ ├── AMF │ │ │ │ │ │ ├── DVAMF.h │ │ │ │ │ │ ├── NSMutableDictionary+DVAMF.h │ │ │ │ │ │ ├── NSMutableDictionary+DVAMF.m │ │ │ │ │ │ ├── NSNumber+DVAMF.h │ │ │ │ │ │ ├── NSNumber+DVAMF.m │ │ │ │ │ │ ├── NSString+DVAMF.h │ │ │ │ │ │ └── NSString+DVAMF.m │ │ │ │ │ ├── DVMetaFlvTagData.h │ │ │ │ │ └── DVMetaFlvTagData.m │ │ │ │ └── VideoFlvTagData │ │ │ │ │ ├── DVVideoFlvTagData.h │ │ │ │ │ ├── DVVideoFlvTagData.m │ │ │ │ │ └── VideoPacket │ │ │ │ │ ├── DVAVCVideoPacket.h │ │ │ │ │ ├── DVAVCVideoPacket.m │ │ │ │ │ ├── DVHEVCVideoPacket.h │ │ │ │ │ └── DVHEVCVideoPacket.m │ │ │ │ └── FlvTagHeader │ │ │ │ ├── DVFlvTagHeader.h │ │ │ │ └── DVFlvTagHeader.m │ │ ├── GLKit │ │ │ ├── Application │ │ │ │ ├── DVGLColorLayer.h │ │ │ │ ├── DVGLColorLayer.m │ │ │ │ ├── DVGLPNGLayer.h │ │ │ │ ├── DVGLPNGLayer.m │ │ │ │ ├── DVGLPreview.h │ │ │ │ └── DVGLPreview.m │ │ │ ├── Category │ │ │ │ ├── GLKTextureLoader+DVGL.h │ │ │ │ └── GLKTextureLoader+DVGL.m │ │ │ ├── ContextLayer │ │ │ │ ├── DVGLContextLayer.h │ │ │ │ └── DVGLContextLayer.m │ │ │ ├── DVGLKits.h │ │ │ └── RenderLayer │ │ │ │ ├── DVGLRenderLayer.h │ │ │ │ └── DVGLRenderLayer.m │ │ ├── Live │ │ │ ├── DVLive.h │ │ │ ├── DVLive.m │ │ │ ├── DVLiveKit.h │ │ │ ├── DVLivePlayer.h │ │ │ └── DVLivePlayer.m │ │ ├── OpenGL │ │ │ ├── Application │ │ │ │ ├── Color │ │ │ │ │ ├── DVOPGLColorLayer.h │ │ │ │ │ ├── DVOPGLColorLayer.m │ │ │ │ │ ├── color_fragment.fs │ │ │ │ │ └── color_vertex.vs │ │ │ │ ├── PNG │ │ │ │ │ ├── DVOPGLPNGLayer.h │ │ │ │ │ ├── DVOPGLPNGLayer.m │ │ │ │ │ ├── png_fragment.fs │ │ │ │ │ └── png_vertex.vs │ │ │ │ └── Preview │ │ │ │ │ ├── DVOPGLPreview.h │ │ │ │ │ ├── DVOPGLPreview.m │ │ │ │ │ ├── pre_fragment.fs │ │ │ │ │ └── pre_vertex.vs │ │ │ ├── ContextLayer │ │ │ │ ├── DVOPGLContextLayer.h │ │ │ │ └── DVOPGLContextLayer.m │ │ │ ├── DVOpenGLKit.h │ │ │ ├── ProgramLayer │ │ │ │ ├── DVOPGLProgramLayer.h │ │ │ │ └── DVOPGLProgramLayer.m │ │ │ ├── Protocol │ │ │ │ └── DVOPGLShaderDataSource.h │ │ │ └── RenderLayer │ │ │ │ ├── DVOPGLRenderLayer.h │ │ │ │ └── DVOPGLRenderLayer.m │ │ ├── RTMP │ │ │ ├── Buffer │ │ │ │ ├── DVRtmpBuffer.h │ │ │ │ ├── DVRtmpBuffer.m │ │ │ │ ├── NSMutableArray+DVRtmpBuffer.h │ │ │ │ └── NSMutableArray+DVRtmpBuffer.m │ │ │ ├── DVRtmpKit.h │ │ │ ├── Debug │ │ │ │ ├── DVRtmpError.h │ │ │ │ └── DVRtmpError.m │ │ │ ├── Packet │ │ │ │ ├── DVRtmpPacket.h │ │ │ │ └── DVRtmpPacket.m │ │ │ └── Socket │ │ │ │ ├── DVRtmp.h │ │ │ │ ├── FFRtmpSocket │ │ │ │ ├── DVFFRtmpSocket.h │ │ │ │ ├── DVFFRtmpSocket.mm │ │ │ │ ├── FFRtmp.cpp │ │ │ │ └── FFRtmp.hpp │ │ │ │ └── RtmpSocket │ │ │ │ ├── DVRtmpSocket.h │ │ │ │ └── DVRtmpSocket.m │ │ └── VideoTool │ │ │ ├── Capture │ │ │ ├── DVVideoCamera.h │ │ │ ├── DVVideoCamera.m │ │ │ ├── DVVideoCapture.h │ │ │ └── DVVideoCapture.m │ │ │ ├── Configuration │ │ │ ├── DVVideoConfig.h │ │ │ └── DVVideoConfig.m │ │ │ ├── DVVideoToolKit.h │ │ │ ├── Other │ │ │ ├── DVVideoError.h │ │ │ └── DVVideoError.m │ │ │ ├── Packet │ │ │ ├── DVVideoPacket.h │ │ │ └── DVVideoPacket.m │ │ │ ├── Utils │ │ │ ├── DVVideoUtils.h │ │ │ └── DVVideoUtils.m │ │ │ └── VideoCoder │ │ │ ├── DVVideoCoderKit.h │ │ │ ├── DVVideoDecoder.h │ │ │ ├── DVVideoEncoder.h │ │ │ ├── Decoder │ │ │ ├── DVVideoH264HardwareDecoder.h │ │ │ ├── DVVideoH264HardwareDecoder.m │ │ │ ├── DVVideoHEVCHardwareDecoder.h │ │ │ └── DVVideoHEVCHardwareDecoder.m │ │ │ └── Encoder │ │ │ ├── DVVideoH264HardwareEncoder.h │ │ │ ├── DVVideoH264HardwareEncoder.m │ │ │ ├── DVVideoHEVCHardwareEncoder.h │ │ │ └── DVVideoHEVCHardwareEncoder.m │ └── Vendor │ │ ├── FFmpeg-iOS │ │ ├── include │ │ │ ├── libavcodec │ │ │ │ ├── avcodec.h │ │ │ │ ├── avdct.h │ │ │ │ ├── avfft.h │ │ │ │ ├── d3d11va.h │ │ │ │ ├── dirac.h │ │ │ │ ├── dv_profile.h │ │ │ │ ├── dxva2.h │ │ │ │ ├── jni.h │ │ │ │ ├── mediacodec.h │ │ │ │ ├── qsv.h │ │ │ │ ├── vaapi.h │ │ │ │ ├── vda.h │ │ │ │ ├── vdpau.h │ │ │ │ ├── version.h │ │ │ │ ├── videotoolbox.h │ │ │ │ ├── vorbis_parser.h │ │ │ │ └── xvmc.h │ │ │ ├── libavdevice │ │ │ │ ├── avdevice.h │ │ │ │ └── version.h │ │ │ ├── libavformat │ │ │ │ ├── avformat.h │ │ │ │ ├── avio.h │ │ │ │ └── version.h │ │ │ ├── libavutil │ │ │ │ ├── adler32.h │ │ │ │ ├── aes.h │ │ │ │ ├── aes_ctr.h │ │ │ │ ├── attributes.h │ │ │ │ ├── audio_fifo.h │ │ │ │ ├── avassert.h │ │ │ │ ├── avconfig.h │ │ │ │ ├── avstring.h │ │ │ │ ├── avutil.h │ │ │ │ ├── base64.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bprint.h │ │ │ │ ├── bswap.h │ │ │ │ ├── buffer.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast5.h │ │ │ │ ├── channel_layout.h │ │ │ │ ├── common.h │ │ │ │ ├── cpu.h │ │ │ │ ├── crc.h │ │ │ │ ├── des.h │ │ │ │ ├── dict.h │ │ │ │ ├── display.h │ │ │ │ ├── downmix_info.h │ │ │ │ ├── error.h │ │ │ │ ├── eval.h │ │ │ │ ├── ffversion.h │ │ │ │ ├── fifo.h │ │ │ │ ├── file.h │ │ │ │ ├── frame.h │ │ │ │ ├── hash.h │ │ │ │ ├── hmac.h │ │ │ │ ├── hwcontext.h │ │ │ │ ├── hwcontext_cuda.h │ │ │ │ ├── hwcontext_d3d11va.h │ │ │ │ ├── hwcontext_drm.h │ │ │ │ ├── hwcontext_dxva2.h │ │ │ │ ├── hwcontext_qsv.h │ │ │ │ ├── hwcontext_vaapi.h │ │ │ │ ├── hwcontext_vdpau.h │ │ │ │ ├── hwcontext_videotoolbox.h │ │ │ │ ├── imgutils.h │ │ │ │ ├── intfloat.h │ │ │ │ ├── intreadwrite.h │ │ │ │ ├── lfg.h │ │ │ │ ├── log.h │ │ │ │ ├── macros.h │ │ │ │ ├── mastering_display_metadata.h │ │ │ │ ├── mathematics.h │ │ │ │ ├── md5.h │ │ │ │ ├── mem.h │ │ │ │ ├── motion_vector.h │ │ │ │ ├── murmur3.h │ │ │ │ ├── opt.h │ │ │ │ ├── parseutils.h │ │ │ │ ├── pixdesc.h │ │ │ │ ├── pixelutils.h │ │ │ │ ├── pixfmt.h │ │ │ │ ├── random_seed.h │ │ │ │ ├── rational.h │ │ │ │ ├── rc4.h │ │ │ │ ├── replaygain.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── samplefmt.h │ │ │ │ ├── sha.h │ │ │ │ ├── sha512.h │ │ │ │ ├── spherical.h │ │ │ │ ├── stereo3d.h │ │ │ │ ├── tea.h │ │ │ │ ├── threadmessage.h │ │ │ │ ├── time.h │ │ │ │ ├── timecode.h │ │ │ │ ├── timestamp.h │ │ │ │ ├── tree.h │ │ │ │ ├── twofish.h │ │ │ │ ├── version.h │ │ │ │ └── xtea.h │ │ │ ├── libswresample │ │ │ │ ├── swresample.h │ │ │ │ └── version.h │ │ │ └── libswscale │ │ │ │ ├── swscale.h │ │ │ │ └── version.h │ │ └── lib │ │ │ ├── libavcodec.a │ │ │ ├── libavdevice.a │ │ │ ├── libavformat.a │ │ │ ├── libavutil.a │ │ │ ├── libswresample.a │ │ │ └── libswscale.a │ │ └── pili-librtmp │ │ ├── amf.c │ │ ├── amf.h │ │ ├── bytes.h │ │ ├── dh.h │ │ ├── dhgroups.h │ │ ├── error.c │ │ ├── error.h │ │ ├── handshake.h │ │ ├── hashswf.c │ │ ├── http.h │ │ ├── log.c │ │ ├── log.h │ │ ├── parseurl.c │ │ ├── rtmp.c │ │ ├── rtmp.h │ │ └── rtmp_sys.h └── DVAVKitBundle │ └── Info.plist ├── DVAVKitDemo ├── DVAVKitDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── mlgPro.xcuserdatad │ │ │ ├── IDEFindNavigatorScopes.plist │ │ │ └── UserInterfaceState.xcuserstate │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── DVAVKitDemo.xcscheme │ └── xcuserdata │ │ └── mlgPro.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist └── DVAVKitDemo │ ├── AOP │ ├── AOPKit.h │ ├── UIViewController+AOP.h │ └── UIViewController+AOP.m │ ├── AppDelegate │ ├── AppDelegate+Notification.h │ ├── AppDelegate+Notification.m │ ├── AppDelegate+UISetting.h │ ├── AppDelegate+UISetting.m │ ├── AppDelegate.h │ └── AppDelegate.m │ ├── Category │ ├── DVCategoryKit.h │ └── UI │ │ ├── UIBarButtonItem+Common.h │ │ ├── UIBarButtonItem+Common.m │ │ ├── UIButton+Common.h │ │ ├── UIButton+Common.m │ │ ├── UICollectionView+Common.h │ │ ├── UICollectionView+Common.m │ │ ├── UIColor+BaseColor.h │ │ ├── UIColor+BaseColor.m │ │ ├── UIColor+Common.h │ │ ├── UIColor+Common.m │ │ ├── UIImage+Common.h │ │ ├── UIImage+Common.m │ │ ├── UILabel+Common.h │ │ ├── UILabel+Common.m │ │ ├── UINavigationController+Common.h │ │ ├── UINavigationController+Common.m │ │ ├── UIPanGestureRecognizer+Common.h │ │ ├── UIPanGestureRecognizer+Common.m │ │ ├── UITabBarController+Common.h │ │ ├── UITabBarController+Common.m │ │ ├── UITableView+Common.h │ │ ├── UITableView+Common.m │ │ ├── UITextField+Common.h │ │ ├── UITextField+Common.m │ │ ├── UIToolbar+Common.h │ │ ├── UIToolbar+Common.m │ │ ├── UIView+Common.h │ │ ├── UIView+Common.m │ │ ├── UIViewController+Common.h │ │ └── UIViewController+Common.m │ ├── Define │ └── Header.pch │ ├── Manager │ ├── DVAPPManager.h │ ├── DVAPPManager.m │ ├── DVManager.h │ └── DVManager.m │ ├── Other │ └── main.m │ ├── Project │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── Info.plist │ ├── Resource │ └── image │ │ ├── icon-dog.jpg │ │ ├── password.png │ │ └── user.png │ ├── UI │ ├── MainViewController │ │ ├── View │ │ │ ├── MainTableView.h │ │ │ └── MainTableView.m │ │ ├── ViewController │ │ │ ├── MainViewController.h │ │ │ └── MainViewController.m │ │ └── ViewModel │ │ │ ├── MainViewModel.h │ │ │ └── MainViewModel.m │ ├── RootNavigationController.h │ ├── RootNavigationController.m │ ├── 录音 │ │ └── ViewController │ │ │ ├── RecordViewController.h │ │ │ ├── RecordViewController.m │ │ │ └── RecordViewController.xib │ └── 直播 │ │ ├── H264 HEVC拉流 │ │ └── ViewController │ │ │ ├── H264HEVCLivePlayerViewController.h │ │ │ └── H264HEVCLivePlayerViewController.m │ │ ├── H264推流 │ │ └── ViewController │ │ │ ├── H264LiveViewController.h │ │ │ └── H264LiveViewController.m │ │ ├── HEVC推流 │ │ └── ViewController │ │ │ ├── HEVCLiveViewController.h │ │ │ └── HEVCLiveViewController.m │ │ ├── Template │ │ ├── LivePlayerViewController.h │ │ ├── LivePlayerViewController.m │ │ ├── LivePlayerViewController.xib │ │ ├── LiveViewController.h │ │ ├── LiveViewController.m │ │ └── LiveViewController.xib │ │ ├── View │ │ ├── LiveListView.h │ │ ├── LiveListView.m │ │ └── LiveListView.xib │ │ ├── ViewController │ │ ├── LiveListViewController.h │ │ └── LiveListViewController.m │ │ └── ViewModel │ │ ├── LiveListViewModel.h │ │ ├── LiveListViewModel.m │ │ ├── LiveTableDataSource.h │ │ └── LiveTableDataSource.m │ └── Utils │ ├── Color │ ├── DVColor.h │ └── DVColor.m │ ├── Frame │ ├── DVFrame.h │ └── DVFrame.m │ ├── GCD │ ├── DVGCD+Class.h │ ├── DVGCD+Class.m │ ├── DVGCD+CountDown.h │ ├── DVGCD+CountDown.m │ ├── DVGCD+Timer.h │ ├── DVGCD+Timer.m │ ├── DVGCD.h │ ├── DVGCD.m │ └── DVGCDKit.h │ ├── Info │ ├── DVInfo.h │ └── DVInfo.m │ ├── NoticeView │ ├── AlertView │ │ ├── DVNoticeAlertView.h │ │ └── DVNoticeAlertView.m │ ├── Category │ │ ├── CALayer+DVNotice.h │ │ └── CALayer+DVNotice.m │ ├── DVNotice.h │ ├── DVNotice.m │ ├── DVNoticeViewKit.h │ ├── Define │ │ └── DVNoticeDefine.h │ ├── LoadingView │ │ ├── DVNoticeLoadingView.h │ │ └── DVNoticeLoadingView.m │ ├── MessageView │ │ ├── DVNoticeMessageView.h │ │ └── DVNoticeMessageView.m │ └── Reesource │ │ ├── icon_message_error.png │ │ ├── icon_message_info.png │ │ ├── icon_message_success.png │ │ └── icon_message_warn.png │ └── Runtime │ ├── Category │ ├── NSObject+Runtime_Class.h │ ├── NSObject+Runtime_Class.m │ ├── NSObject+Runtime_Method.h │ ├── NSObject+Runtime_Method.m │ ├── NSObject+Runtime_VAR.h │ └── NSObject+Runtime_VAR.m │ ├── DVRuntime.h │ ├── DVRuntime.m │ ├── DVRuntimeKit.h │ └── Model │ ├── DVRuntimeObjectModel.h │ └── DVRuntimeObjectModel.m ├── LICENSE └── README.md /DVAVKit/DVAVKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit.xcodeproj/project.xcworkspace/xcuserdata/mlgPro.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit.xcodeproj/project.xcworkspace/xcuserdata/mlgPro.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DVAVKit/DVAVKit.xcodeproj/xcuserdata/mlgPro.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DVAVKit.xcscheme_^#shared#^_ 8 | 9 | isShown 10 | 11 | orderHint 12 | 6 13 | 14 | DVAVKitBundle.xcscheme_^#shared#^_ 15 | 16 | orderHint 17 | 10 18 | 19 | DVAVKitShell.xcscheme_^#shared#^_ 20 | 21 | orderHint 22 | 14 23 | 24 | 25 | SuppressBuildableAutocreation 26 | 27 | 3E28391D2436574C00EC34A4 28 | 29 | primary 30 | 31 | 32 | FFEE2D7E23C2D44D00022E68 33 | 34 | primary 35 | 36 | 37 | FFF84F4E24400F5000DD23EF 38 | 39 | primary 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/DVAVKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAVKit.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/1/6. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | #if __has_include() 13 | FOUNDATION_EXPORT double DVAVKitVersionNumber; 14 | FOUNDATION_EXPORT const unsigned char DVAVKitVersionString[]; 15 | 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | 25 | #else 26 | 27 | #import "DVFFmpegKit.h" 28 | #import "DVVideoToolKit.h" 29 | #import "DVAudioToolKit.h" 30 | #import "DVFlvKit.h" 31 | #import "DVRtmpKit.h" 32 | #import "DVLiveKit.h" 33 | #import "DVOpenGLKit.h" 34 | #import "DVGLKits.h" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/DVAVKitHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // DVAVKitHeader.pch 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/1/6. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #ifdef __OBJC__ 10 | 11 | #ifndef DVAVKitHeader_pch 12 | #define DVAVKitHeader_pch 13 | 14 | 15 | //#import "DVVideoToolKit.h" 16 | //#import "DVAudioToolKit.h" 17 | //#import "DVFlvKit.h" 18 | //#import "DVRtmpKit.h" 19 | 20 | #endif /* DVAVKitHeader_pch */ 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AVPlayer/AudioPlayer/DVAudioPlayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioPlayer.h 3 | // French 4 | // 5 | // Created by 施达威 on 2019/5/3. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSUInteger, DVAudioPlayerStatus) { 14 | DVAudioPlayerStatusPlay, 15 | DVAudioPlayerStatusPause, 16 | DVAudioPlayerStatusStop, 17 | }; 18 | 19 | @class DVAudioPlayer; 20 | @protocol DVAudioPlayerDelegate 21 | 22 | - (void)DVAudioPlayer:(DVAudioPlayer *)player status:(DVAudioPlayerStatus)status; 23 | 24 | @end 25 | 26 | 27 | @interface DVAudioPlayer : NSObject 28 | 29 | @property(nonatomic, weak) id mDelegate; 30 | 31 | @property(nonatomic, assign, readonly) DVAudioPlayerStatus playerStatus; 32 | 33 | 34 | 35 | - (instancetype)initWithDelegate:(id)mDelegate; 36 | 37 | - (void)playWithURL:(NSString *)url; 38 | - (void)playWithURLs:(NSArray *)urls; 39 | 40 | - (void)addURL:(NSString *)url; 41 | - (void)addURLs:(NSArray *)urls; 42 | 43 | //- (void)removeURL:(NSString *)url; 44 | //- (void)removeURLs:(NSArray *)urls; 45 | //- (void)removeAllURLs; 46 | 47 | - (void)play; 48 | - (void)pause; 49 | - (void)stop; 50 | 51 | - (void)seekToTime:(NSUInteger)time; 52 | 53 | //- (void) 54 | 55 | //- (void)pre; 56 | //- (void)next; 57 | 58 | //- (void)forward:(NSTimeInterval)interval; 59 | //- (void)back:(NSTimeInterval)interval; 60 | 61 | @end 62 | 63 | NS_ASSUME_NONNULL_END 64 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioCoder/DVAudioCoderKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioCoderKit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVAudioCoderKit_h 10 | #define DVAudioCoderKit_h 11 | 12 | #import "DVAudioEncoder.h" 13 | #import "DVAudioDecoder.h" 14 | 15 | #import "DVAudioAACHardwareEncoder.h" 16 | 17 | #import "DVAudioAACHardwareDecoder.h" 18 | 19 | 20 | #endif /* DVAudioCoderKit_h */ 21 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioCoder/DVAudioDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioDecoder.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #pragma mark - <-------------------- DVAudioDecoderDelegate --------------------> 15 | @protocol DVAudioDecoder; 16 | @protocol DVAudioDecoderDelegate 17 | 18 | - (void)DVAudioDecoder:(id)decoder 19 | decodedData:(NSData *)data 20 | userInfo:(nullable void *)userInfo; 21 | 22 | @end 23 | 24 | 25 | #pragma mark - <-------------------- DVAudioDecoder --------------------> 26 | @protocol DVAudioDecoder 27 | @optional 28 | 29 | #pragma mark - <-- Property --> 30 | @property(nonatomic, weak) id delegate; 31 | 32 | 33 | #pragma mark - <-- Method --> 34 | - (instancetype)initWithInputBasicDesc:(AudioStreamBasicDescription)inputBasicDesc 35 | outputBasicDesc:(AudioStreamBasicDescription)outputBasicDesc 36 | delegate:(id)delegate; 37 | 38 | - (void)decodeAudioData:(nullable NSData *)data 39 | userInfo:(nullable void *)userInfo; 40 | 41 | - (void)decodeAudioData:(nullable void *)data 42 | size:(UInt32)size 43 | userInfo:(nullable void *)userInfo; 44 | 45 | - (void)closeDecoder; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioCoder/DVAudioEncoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioEncoder.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | @protocol DVAudioEncoder; 14 | @protocol DVAudioEncoderDelegate 15 | 16 | - (void)DVAudioEncoder:(nullable id)encoder 17 | codedData:(nullable NSData *)data 18 | userInfo:(nullable void *)userInfo; 19 | @end 20 | 21 | 22 | 23 | @protocol DVAudioEncoder 24 | @optional 25 | 26 | #pragma mark - <-- Property --> 27 | @property(nonatomic, weak) id delegate; 28 | 29 | 30 | #pragma mark - <-- Method --> 31 | - (instancetype)initWithInputBasicDesc:(AudioStreamBasicDescription)inputBasicDesc 32 | outputBasicDesc:(AudioStreamBasicDescription)outputBasicDesc 33 | delegate:(id)delegate; 34 | 35 | - (void)encodeAudioData:(nullable NSData *)data 36 | userInfo:(nullable void *)userInfo; 37 | 38 | - (void)encodeAudioData:(nullable void *)data 39 | size:(UInt32)size 40 | userInfo:(nullable void *)userInfo; 41 | 42 | - (void)closeEncoder; 43 | 44 | 45 | - (NSData *)convertToADTSWithData:(NSData *)sourceData channel:(NSInteger)channel; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioCoder/Decoder/DVAudioAACHardwareDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioAACHardwareDecoder.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/4/7. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAudioDecoder.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVAudioAACHardwareDecoder : NSObject 15 | 16 | #pragma mark - <-- Property --> 17 | /// 解码数据包大小, 默认:1024 18 | @property(nonatomic, assign) UInt32 outputDataPacketSize; 19 | 20 | 21 | #pragma mark - <-- Initializer --> 22 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 23 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioCoder/Encoder/DVAudioAACHardwareEncoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioHardwareEncoder.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAudioEncoder.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVAudioAACHardwareEncoder : NSObject 15 | 16 | #pragma mark - <-- Initializer --> 17 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 18 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioUnit/DVAudioUnitKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioUnit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/12. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVAudioUnit_h 10 | #define DVAudioUnit_h 11 | 12 | 13 | 14 | #pragma mark - <-- Core --> 15 | #import "DVAudioUnit.h" 16 | #import "DVAudioQueue.h" 17 | 18 | #pragma mark - <-- Unit --> 19 | #import "DVAudioIOUnit.h" 20 | #import "DVAudioMixUnit.h" 21 | 22 | #endif /* DVAudioUnit_h */ 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioUnit/Unit/DVAudioIOUnit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioIOUnit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/11. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAudioStreamBaseDesc.h" 11 | #import "DVAudioPacket.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface DVAudioIOUnit : NSObject 17 | 18 | #pragma mark - <-- Property --> 19 | /// 音频格式 默认: 空 (可调用 DVAudioConfig 转换为 DVAudioStreamBaseDesc) 20 | @property(nonatomic, assign) AudioStreamBasicDescription audioFormat; 21 | 22 | /// 麦克风状态 默认:关闭 NO 23 | @property(nonatomic, assign) BOOL inputPortStatus; 24 | 25 | /// 扬声器状态 默认:关闭 NO 26 | @property(nonatomic, assign) BOOL outputPortStatus; 27 | 28 | /// 麦克风数据回调开关 默认:关闭 NO 29 | @property(nonatomic, assign) BOOL inputCallBackSwitch; 30 | 31 | /// 扬声器数据回调开关 默认:关闭 NO 32 | @property(nonatomic, assign) BOOL outputCallBackSwitch; 33 | 34 | /// 麦克风数据反馈回扬声器, 默认: 关闭 NO ('outputPortStatus'=YES 和 'outputCallBackSwitch'=YES 才能使用) 35 | @property(nonatomic, assign) BOOL feedbackSwitch; 36 | 37 | /// 回声消除开关 默认:开启 YES (必须设置 'outputPortStatus'=YES 和 'kComponentDesc_Output_VPIO' 才能使用与设置) 38 | @property(nonatomic, assign) BOOL bypassVoiceProcessingStatus; 39 | 40 | /// 麦克风数据回调 自动分配缓存 默认:开启 YES 41 | @property(nonatomic, assign) BOOL shouldAllocateBufferStatus; 42 | 43 | 44 | #pragma mark - <-- Method --> 45 | - (void)playAudioData:(uint8_t *)data size:(UInt32)size; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioUnit/Unit/DVAudioMixUnit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioMixUnit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/12. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVAudioMixUnit : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/AudioUnit/Unit/DVAudioMixUnit.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioMixUnit.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/12. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVAudioMixUnit.h" 10 | #import "DVAudioUnit.h" 11 | 12 | @interface DVAudioMixUnit() 13 | 14 | @property (nonatomic, weak) DVAudioUnit* wAudioUnit; 15 | 16 | @end 17 | 18 | @implementation DVAudioMixUnit 19 | 20 | - (void)dealloc { 21 | _wAudioUnit = nil; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Configuration/DVAudioComponentDesc.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioComponentDesc.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/11. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVAudioComponentDesc : NSObject 15 | 16 | #pragma mark - <-- Instancetype --> 17 | + (AudioComponentDescription)kComponentDescWithType:(OSType)type subType:(OSType)subType; 18 | 19 | #pragma mark - <-- Default --> 20 | + (AudioComponentDescription)kComponentDesc_Output_IO; 21 | + (AudioComponentDescription)kComponentDesc_Output_VPIO; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Configuration/DVAudioComponentDesc.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioComponentDesc.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/11. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVAudioComponentDesc.h" 10 | 11 | @implementation DVAudioComponentDesc 12 | 13 | #pragma mark - <-- Instancetype --> 14 | + (AudioComponentDescription)kComponentDescWithType:(OSType)type subType:(OSType)subType { 15 | AudioComponentDescription componentDesc = { 16 | .componentType = type, 17 | .componentSubType = subType, 18 | .componentManufacturer = kAudioUnitManufacturer_Apple, 19 | .componentFlagsMask = 0, 20 | .componentFlags = 0, 21 | }; 22 | return componentDesc; 23 | } 24 | 25 | #pragma mark - <-- Default --> 26 | + (AudioComponentDescription)kComponentDesc_Output_IO { 27 | return [self kComponentDescWithType:kAudioUnitType_Output 28 | subType:kAudioUnitSubType_RemoteIO]; 29 | } 30 | 31 | + (AudioComponentDescription)kComponentDesc_Output_VPIO { 32 | return [self kComponentDescWithType:kAudioUnitType_Output 33 | subType:kAudioUnitSubType_VoiceProcessingIO]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Configuration/DVAudioConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioConfig.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/10. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVAudioConfig : NSObject 15 | 16 | /// 采样率 17 | @property(nonatomic, assign) NSUInteger sampleRate; 18 | 19 | /// 位数 20 | @property(nonatomic, assign) UInt32 bitsPerChannel; 21 | 22 | /// 通道 23 | @property(nonatomic, assign) UInt32 numberOfChannels; 24 | 25 | /// 码率 Kbps : ( 位数 / 8 * 通道数 ) * 采样率 = 每秒多少字节 26 | @property(nonatomic, assign, readonly) NSUInteger bitRate; 27 | 28 | 29 | 30 | #pragma mark - <-- Instance --> 31 | - (instancetype)initWithSampleRate:(NSUInteger)sampleRate 32 | bitsPerChannel:(UInt32)bits 33 | numberOfChannels:(UInt32)channels; 34 | 35 | + (instancetype)configWithSampleRate:(NSUInteger)sampleRate 36 | bitsPerChannel:(UInt32)bits 37 | numberOfChannels:(UInt32)channels; 38 | 39 | 40 | 41 | #pragma mark - <-- PCM Default --> 42 | + (DVAudioConfig *)kConfig_8k_16bit_1ch; 43 | + (DVAudioConfig *)kConfig_8k_16bit_2ch; 44 | 45 | + (DVAudioConfig *)kConfig_16k_16bit_1ch; 46 | + (DVAudioConfig *)kConfig_16k_16bit_2ch; 47 | 48 | + (DVAudioConfig *)kConfig_44k_16bit_1ch; 49 | + (DVAudioConfig *)kConfig_44k_16bit_2ch; 50 | 51 | + (DVAudioConfig *)kConfig_48k_16bit_1ch; 52 | + (DVAudioConfig *)kConfig_48k_16bit_2ch; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Configuration/DVAudioStreamBaseDesc.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioStreamBaseDesc.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/11. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "DVAudioConfig.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface DVAudioStreamBaseDesc : NSObject 16 | 17 | #pragma mark - <-- Instance --> 18 | + (AudioStreamBasicDescription)pcmBasicDescWithConfig:(DVAudioConfig *)config; 19 | 20 | + (AudioStreamBasicDescription)aacBasicDescWithConfig:(DVAudioConfig *)config; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/DVAudioToolKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioToolKit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVAudioToolKit_h 10 | #define DVAudioToolKit_h 11 | 12 | 13 | #pragma mark - <-- Define --> 14 | #import "DVAudioError.h" 15 | 16 | 17 | #pragma mark - <-- Configuration --> 18 | #import "DVAudioConfig.h" 19 | #import "DVAudioStreamBaseDesc.h" 20 | #import "DVAudioComponentDesc.h" 21 | 22 | 23 | #import "DVAudioUnitKit.h" 24 | #import "DVAudioCoderKit.h" 25 | 26 | #import "DVAudioPacket.h" 27 | 28 | 29 | #endif /* DVAudioToolKit_h */ 30 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Other/DVAudioError.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioError.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/1/11. 6 | // Copyright © 2019年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSInteger, DVAudioErrorType) { 14 | DVAudioError_notErr = 0, 15 | DVAudioError_notRecord = 10000, 16 | DVAudioError_notPlay = 10001, 17 | }; 18 | 19 | 20 | void AudioCheckStatus(OSStatus status, NSString *message); 21 | 22 | 23 | 24 | @interface DVAudioError : NSError 25 | 26 | @property(nonatomic, assign, readonly) DVAudioErrorType errorType; 27 | 28 | - (instancetype)initWithType:(DVAudioErrorType)errorType; 29 | 30 | + (instancetype)errorWithType:(DVAudioErrorType)errorType; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Packet/DVAudioPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioPacket.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/7. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVAudioPacket : NSObject { 14 | @public 15 | void *_userInfo; 16 | } 17 | 18 | @property(nonatomic, assign) UInt32 mSize; 19 | @property(nonatomic, assign) UInt32 readIndex; 20 | @property(nonatomic, assign) uint8_t *mData; 21 | 22 | - (instancetype)initWithData:(uint8_t *)mData size:(UInt32)mSize; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/AudioTool/Packet/DVAudioPacket.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioPacket.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/7. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVAudioPacket.h" 10 | 11 | @implementation DVAudioPacket 12 | 13 | - (instancetype)initWithData:(uint8_t *)mData size:(UInt32)mSize { 14 | self = [super init]; 15 | if (self) { 16 | _mData = (uint8_t *)malloc(mSize * sizeof(uint8_t)); 17 | memcpy(_mData, mData, mSize); 18 | _mSize = mSize; 19 | _readIndex = 0; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)dealloc { 25 | _userInfo = nil; 26 | 27 | free(_mData); 28 | _mData = nil; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/DVFFmpegKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFFmpegKit.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #ifndef DVFFmpegKit_h 10 | #define DVFFmpegKit_h 11 | 12 | #import "FFSession.h" 13 | 14 | #import "FFInFormatContext.h" 15 | #import "FFInFormatContext+IO.h" 16 | #import "FFOutFormatContext.h" 17 | #import "FFOutFormatContext+IO.h" 18 | 19 | #import "FFPacket.h" 20 | 21 | #endif /* DVFFmpegKit_h */ 22 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFBuffer/FFBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFBuffer.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FFPacket.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #pragma mark - <-------------------- Define --------------------> 15 | typedef NS_ENUM(UInt8, FFBufferStatus) { 16 | FFBufferStatus_Steady = 0, // 缓冲稳定 17 | FFBufferStatus_Increase = 1, // 缓冲增加中 18 | FFBufferStatus_Decrease = 2, // 缓冲减少中 19 | }; 20 | 21 | 22 | #pragma mark - <-------------------- Protocol --------------------> 23 | @class FFBuffer; 24 | @protocol FFBufferDelegate 25 | 26 | - (void)FFBuffer:(FFBuffer *)rtmpBuffer bufferStatus:(FFBufferStatus)bufferStatus; 27 | 28 | - (void)FFBuffer:(FFBuffer *)rtmpBuffer bufferOverMaxCount:(NSArray *)bufferList 29 | deleteBuffer:(void(^)(NSArray *))deleteBlock; 30 | 31 | @end 32 | 33 | 34 | #pragma mark - <-------------------- Class --------------------> 35 | @interface FFBuffer : NSObject 36 | 37 | #pragma mark - <-- Property --> 38 | /// 监听缓冲变化状态 39 | @property(nonatomic, weak, nullable) id delegate; 40 | /// 最大缓冲数量, 默认: 25 FPS x 60s = 1500 41 | @property(nonatomic, assign) NSUInteger bufferMaxCount; 42 | 43 | /// 缓冲区 44 | @property(nonatomic, strong, readonly) NSArray *bufferList; 45 | /// 缓冲数量 46 | @property(nonatomic, assign, readonly) NSUInteger bufferCount; 47 | 48 | 49 | #pragma mark - <-- Method --> 50 | - (void)pushBuffer:(FFPacket *)buffer; 51 | - (nullable FFPacket *)popBuffer; 52 | - (void)removeAllBuffer; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFBuffer/NSMutableArray+FFBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+FFBuffer.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSMutableArray (FFBuffer) 14 | 15 | - (nullable ObjectType)popFirstBuffer; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFBuffer/NSMutableArray+FFBuffer.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+FFBuffer.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "NSMutableArray+FFBuffer.h" 10 | 11 | @implementation NSMutableArray (FFBuffer) 12 | 13 | - (id)popFirstBuffer { 14 | id buffer = nil; 15 | if (self.count > 0) { 16 | buffer = self.firstObject; 17 | [self removeObjectAtIndex:0]; 18 | } 19 | return buffer; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFCodec/AudioCodec/Encodec/G726/EncoderG726.h: -------------------------------------------------------------------------------- 1 | // 2 | // EncoderG726.h 3 | // TalkDemo_G711_AAC 4 | // 5 | // Created by DV on 2018/11/6. 6 | // Copyright © 2018年 aipu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface EncoderG726 : NSObject 15 | 16 | - (instancetype)init; 17 | 18 | - (NSData*)encoder:(NSData*)pcm; 19 | 20 | - (NSData *)encoder:(uint8_t *)data size:(int)size; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFCodec/AudioCodec/Encodec/G726/EncoderG726.mm: -------------------------------------------------------------------------------- 1 | // 2 | // EncoderG726.m 3 | // TalkDemo_G711_AAC 4 | // 5 | // Created by DV on 2018/11/6. 6 | // Copyright © 2018年 aipu. All rights reserved. 7 | // 8 | 9 | #import "EncoderG726.h" 10 | #import "G726Encodec.hpp" 11 | 12 | @implementation EncoderG726 { 13 | G726 *g726; 14 | } 15 | 16 | 17 | - (instancetype)init{ 18 | self = [super init]; 19 | if (self) { 20 | g726 = new G726(); 21 | } 22 | return self; 23 | } 24 | 25 | - (void)dealloc 26 | { 27 | if (g726 != NULL) { 28 | delete g726; 29 | } 30 | } 31 | 32 | //- (void)initConfig{ 33 | // g726 = new G726(); 34 | //// g726->init(); 35 | //} 36 | 37 | 38 | //- (NSData *)encoder:(NSData *)pcm{ 39 | // 40 | // uint8_t *cdata = (uint8_t*)[pcm bytes]; 41 | // G726AudioPacket packet = g726->encoder(cdata); 42 | // 43 | // if (packet.flag == 1) { 44 | // NSData *result = [NSData dataWithBytes:packet.data length:packet.dataSize]; 45 | // return result; 46 | // } 47 | // 48 | // return [NSData new]; 49 | //} 50 | 51 | 52 | - (NSData *)encoder:(uint8_t *)data size:(int)size { 53 | G726AudioPacket packet = g726->encoder((uint8_t*)data, size); 54 | 55 | if (packet.flag == 1) { 56 | NSData *result = [NSData dataWithBytes:packet.data length:packet.dataSize]; 57 | return result; 58 | } 59 | return [NSData new]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFCodec/AudioCodec/Encodec/G726/G726Encodec.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // G726Encodec.hpp 3 | // LFLiveKit 4 | // 5 | // Created by DV on 2018/10/26. 6 | // Copyright © 2018年 admin. All rights reserved. 7 | // 8 | 9 | #ifndef G726Encodec_hpp 10 | #define G726Encodec_hpp 11 | 12 | #include 13 | #include "libFFmpeg.hpp" 14 | 15 | typedef struct _G726AudioPacket { 16 | uint8_t* data; 17 | int dataSize; 18 | int flag; 19 | }G726AudioPacket; 20 | 21 | class G726{ 22 | public: 23 | G726(); 24 | ~G726(); 25 | 26 | void init(); 27 | 28 | G726AudioPacket encoder(uint8_t* buf, int buf_size); 29 | 30 | private: 31 | AVCodec *codec; 32 | AVCodecContext *c = NULL; 33 | AVPacket avpkt; 34 | AVFrame *decoded_frame = NULL; 35 | }; 36 | 37 | #endif /* G726Encodec_hpp */ 38 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFCodec/VideoCodec/Encodec/FFH264Encodec.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFH264Encodec.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface FFH264Encodec : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFCodec/VideoCodec/Encodec/FFH264Encodec.m: -------------------------------------------------------------------------------- 1 | // 2 | // FFH264Encodec.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFH264Encodec.h" 10 | 11 | @implementation FFH264Encodec 12 | 13 | //- (void)_newEncodecForH264:(AVCodec **)encodec { 14 | // AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264); 15 | //// codec->height = dec_ctx->height; 16 | //// codec->width = dec_ctx->width; 17 | //// codec->sample_aspect_ratio = dec_ctx->sample_aspect_ratio; 18 | //// codec->pix_fmt = encoder->pix_fmts[0]; 19 | //// codec->time_base = dec_ctx->time_base; 20 | // //codec->time_base.num = 1; 21 | // //codec->time_base.den = 25; 22 | // //H264的必备选项,没有就会错 23 | // codec->me_range=16; 24 | // codec->max_qdiff = 4; 25 | // codec->qmin = 10; 26 | // codec->qmax = 51; 27 | // codec->qcompress = 0.6; 28 | // codec->refs=3; 29 | // codec->bit_rate = 500000; 30 | // 31 | // int ret = avcodec_open2(codec, encoder, NULL); 32 | // if (ret < 0) { 33 | // av_log(NULL, AV_LOG_ERROR, "Cannot open video encoder for stream #%u\n", i); 34 | // return ret; 35 | // } 36 | // 37 | //} 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFFormatContext/InFormatContext/FFInFormatContext+IO.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFInFormatContext+IO.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFInFormatContext.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Class --------------------> 14 | @interface FFInFormatContext (IO) 15 | 16 | #pragma mark - <-- Initializer --> 17 | + (instancetype)IOWithBufferSize:(int)bufferSize; 18 | 19 | 20 | #pragma mark - <-- Method --> 21 | - (void)openIO; 22 | - (void)closeIO; 23 | 24 | - (void)startReadIO; 25 | - (void)stopReadIO; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFFormatContext/InFormatContext/FFInFormatContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFInFormatContext.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/30. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FFPacket.h" 11 | #import "FFVideoInfo.h" 12 | #import "FFAudioInfo.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | #pragma mark - <-------------------- Protocol --------------------> 17 | @class FFInFormatContext; 18 | @protocol FFInFormatContextDelegate 19 | @optional 20 | 21 | // 读取音视频信息 22 | - (void)FFInFormatContext:(FFInFormatContext *)context videoInfo:(FFVideoInfo *)videoInfo; 23 | - (void)FFInFormatContext:(FFInFormatContext *)context audioInfo:(FFAudioInfo *)audioInfo; 24 | 25 | // 读取音视频数据 26 | - (void)FFInFormatContext:(FFInFormatContext *)context readVideoPacket:(FFPacket *)packet; 27 | - (void)FFInFormatContext:(FFInFormatContext *)context readAudioPacket:(FFPacket *)packet; 28 | 29 | // IO 30 | - (void)FFInFormatContext:(FFInFormatContext *)context inIOPacket:(FFPacket **)packet; 31 | 32 | @end 33 | 34 | 35 | #pragma mark - <-------------------- Class --------------------> 36 | @interface FFInFormatContext : NSObject 37 | 38 | #pragma mark - <-- Property --> 39 | @property(nonatomic, weak) id delegate; 40 | @property(nonatomic, assign, readonly) BOOL isReading; 41 | @property(nonatomic, assign, readonly) BOOL isOpening; 42 | 43 | @property(nonatomic, strong, readonly, nullable) FFVideoInfo *videoInfo; 44 | @property(nonatomic, strong, readonly, nullable) FFAudioInfo *audioInfo; 45 | 46 | 47 | #pragma mark - <-- Initializer --> 48 | + (instancetype)context; 49 | 50 | 51 | #pragma mark - <-- Method --> 52 | - (void)openWithURL:(NSString *)url; 53 | - (void)closeURL; 54 | 55 | - (void)startReadPacket; 56 | - (void)stopReadPacket; 57 | 58 | @end 59 | 60 | NS_ASSUME_NONNULL_END 61 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFFormatContext/OutFormatContext/FFOutFormatContext+IO.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFOutFormatContext+IO.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFOutFormatContext.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | 14 | #pragma mark - <-------------------- Class --------------------> 15 | @interface FFOutFormatContext (IO) 16 | 17 | #pragma mark - <-- Initializer --> 18 | + (instancetype)IOWithBufferSize:(int)bufferSize; 19 | 20 | 21 | #pragma mark - <-- Method --> 22 | - (void)openIOWithFormat:(NSString *)format; 23 | - (void)closeIO; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFFormatContext/OutFormatContext/FFOutFormatContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFOutFormatContext.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/30. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FFInFormatContext.h" 11 | #import "FFPacket.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | #pragma mark - <-------------------- Protocol --------------------> 16 | @class FFOutFormatContext; 17 | @protocol FFOutFormatContextDelegate 18 | @optional 19 | 20 | - (void)FFOutFormatContextDidFinishedOutput:(FFOutFormatContext *)context; 21 | 22 | - (void)FFOutFormatContext:(FFOutFormatContext *)context outIOPacket:(FFPacket *)packet; 23 | 24 | @end 25 | 26 | 27 | #pragma mark - <-------------------- Class --------------------> 28 | @interface FFOutFormatContext : NSObject 29 | 30 | #pragma mark - <-- Property --> 31 | @property(nonatomic, weak) id delegate; 32 | @property(nonatomic, assign, readonly) BOOL isOpening; 33 | @property(nonatomic, copy, readonly) NSString *url; 34 | 35 | 36 | #pragma mark - <-- Initializer --> 37 | + (instancetype)contextFromInFmtCtx:(FFInFormatContext *)inFmtCtx; 38 | 39 | 40 | #pragma mark - <-- Method --> 41 | - (void)openWithURL:(NSString *)url format:(nullable NSString *)format; 42 | - (void)closeURL; 43 | 44 | - (void)writePacket:(FFPacket *)packet; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFFrame/FFFrame.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFFrame.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface FFFrame : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFFrame/FFFrame.mm: -------------------------------------------------------------------------------- 1 | // 2 | // FFFrame.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFFrame.h" 10 | 11 | @implementation FFFrame 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFInfo/FFAudioInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFAudioInfo.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FFAudioInfo : NSObject 15 | 16 | /// 采样率 17 | @property(nonatomic, assign) NSUInteger sampleRate; 18 | /// 位数 19 | @property(nonatomic, assign) UInt32 bitsPerChannel; 20 | /// 通道 21 | @property(nonatomic, assign) UInt32 numberOfChannels; 22 | /// @"aac" 23 | @property(nonatomic, copy) NSString *codecName; 24 | /// 25 | @property(nonatomic, strong) NSData *extraData; 26 | /// 时间基准 27 | @property(nonatomic, assign) CMTime timeBase; 28 | /// 首帧 pts 29 | @property(nonatomic, assign) int64_t pts; 30 | /// 首帧 dts 31 | @property(nonatomic, assign) int64_t dts; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFInfo/FFAudioInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // FFAudioInfo.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFAudioInfo.h" 10 | 11 | @implementation FFAudioInfo 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFInfo/FFVideoInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFVideoInfo.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #pragma mark - <-------------------- Class --------------------> 15 | @interface FFVideoInfo : NSObject 16 | 17 | /// 宽高 18 | @property(nonatomic, assign) CGSize size; 19 | /// 帧率 20 | @property (nonatomic, assign) NSUInteger fps; 21 | /// 码率,单位是 bps 22 | @property (nonatomic, assign) int64_t bitRate; 23 | /// @"h264" / @"hevc" 24 | @property(nonatomic, copy) NSString *codecName; 25 | /// 时间基准 26 | @property(nonatomic, assign) CMTime timeBase; 27 | /// 首帧 pts 28 | @property(nonatomic, assign) int64_t pts; 29 | /// 首帧 dts 30 | @property(nonatomic, assign) int64_t dts; 31 | /// vps 32 | @property(nonatomic, strong, nullable) NSData *vps; 33 | /// sps 34 | @property(nonatomic, strong, nullable) NSData *sps; 35 | /// pps 36 | @property(nonatomic, strong, nullable) NSData *pps; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFInfo/FFVideoInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // FFVideoInfo.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFVideoInfo.h" 10 | 11 | @implementation FFVideoInfo 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFLibrary/libFFmpeg.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // libFFmpeg.cpp 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/1/6. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #include "libFFmpeg.hpp" 10 | 11 | 12 | libFFmpeg::libFFmpeg() { 13 | 14 | av_register_all(); 15 | avformat_network_init(); 16 | } 17 | 18 | libFFmpeg::~libFFmpeg() { 19 | this->closeURL(); 20 | 21 | avformat_network_deinit(); 22 | } 23 | 24 | 25 | int libFFmpeg::openURL(const char *url) { 26 | if (this->formatCtx != NULL) this->closeURL(); 27 | 28 | int ret = 0; 29 | AVFormatContext *formatCtx = NULL; 30 | 31 | do { 32 | // 1.初始化上下文 33 | formatCtx = avformat_alloc_context(); 34 | 35 | // 2.打开文件 36 | 37 | AVDictionary *opts = NULL; 38 | av_dict_set(&opts, "timeout", NULL, 0); // 设置超时5秒 39 | 40 | ret = avformat_open_input(&formatCtx, url, NULL, &opts); 41 | // ret = avformat_alloc_output_context2(&formatCtx, NULL, NULL, url); 42 | av_dict_free(&opts); 43 | if (ret < 0) { 44 | printf("[libFFmpeg LOG]: 无法打开 %s", url); 45 | break; 46 | } 47 | 48 | // 3.填充文件的meta信息 49 | ret = avformat_find_stream_info(formatCtx, NULL); 50 | if (ret < 0) { 51 | printf("[libFFmpeg LOG]: 无法打开 %s", url); 52 | break; 53 | } 54 | 55 | this->formatCtx = formatCtx; 56 | 57 | } while (false); 58 | 59 | if (ret < 0) { 60 | if (formatCtx) { 61 | avformat_close_input(&formatCtx); 62 | avformat_free_context(formatCtx); 63 | } 64 | } 65 | 66 | return ret; 67 | } 68 | 69 | int libFFmpeg::closeURL() { 70 | avformat_close_input(&this->formatCtx); 71 | avformat_free_context(this->formatCtx); 72 | this->formatCtx = NULL; 73 | return 1; 74 | } 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFLibrary/libFFmpeg.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // libFFmpeg.hpp 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/1/6. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #ifndef libFFmpeg_hpp 10 | #define libFFmpeg_hpp 11 | 12 | #include 13 | #include "pthread.h" 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #ifdef __cplusplus 25 | }; 26 | #endif 27 | 28 | 29 | class libFFmpeg { 30 | public: 31 | libFFmpeg(); 32 | ~libFFmpeg(); 33 | 34 | int openURL(const char *url); 35 | int closeURL(); 36 | 37 | pthread_mutex_t queue; 38 | 39 | private: 40 | AVFormatContext *formatCtx; 41 | 42 | 43 | }; 44 | 45 | 46 | 47 | #endif /* libFFmpeg_hpp */ 48 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFPacket/FFPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFPacket.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/30. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Define --------------------> 14 | typedef NS_ENUM(NSUInteger, FFPacketType) { 15 | FFPacketTypeVideo = 0, 16 | FFPacketTypeAudio = 1, 17 | }; 18 | 19 | 20 | #pragma mark - <-------------------- Class --------------------> 21 | @interface FFPacket : NSObject 22 | 23 | @property(nonatomic, assign) FFPacketType type; 24 | 25 | @property(nonatomic, weak, readonly) NSData *datas; 26 | 27 | @property(nonatomic, assign) uint8_t *data; 28 | @property(nonatomic, assign) int size; 29 | 30 | @property(nonatomic, assign) int64_t pts; 31 | @property(nonatomic, assign) int64_t dts; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFPacket/FFPacket.mm: -------------------------------------------------------------------------------- 1 | // 2 | // FFPacket.m 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/30. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFPacket.h" 10 | #import "libFFmpeg.hpp" 11 | 12 | @interface FFPacket () { 13 | @public 14 | AVPacket *_pkt; 15 | } 16 | @end 17 | 18 | 19 | @implementation FFPacket 20 | 21 | - (void)dealloc 22 | { 23 | if (_pkt != NULL) { 24 | av_packet_unref(_pkt); 25 | av_packet_free(&_pkt); 26 | } 27 | } 28 | 29 | - (NSData *)datas { 30 | // 不复制 data内存,只存指针地址 31 | return [NSData dataWithBytesNoCopy:_pkt->data length:_pkt->size freeWhenDone:NO]; 32 | } 33 | 34 | - (uint8_t *)data { 35 | return _pkt->data; 36 | } 37 | 38 | - (void)setData:(uint8_t *)data { 39 | _pkt->data = data; 40 | } 41 | 42 | - (int)size { 43 | return _pkt->size; 44 | } 45 | 46 | - (void)setSize:(int)size { 47 | _pkt->size = size; 48 | } 49 | 50 | - (int64_t)pts { 51 | return _pkt->pts; 52 | } 53 | 54 | - (void)setPts:(int64_t)pts { 55 | _pkt->pts = pts; 56 | } 57 | 58 | - (int64_t)dts { 59 | return _pkt->dts; 60 | } 61 | 62 | - (void)setDts:(int64_t)dts { 63 | _pkt->dts = dts; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFSession/FFSession.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFSession.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface FFSession : NSObject 14 | 15 | + (void)enableSession; 16 | 17 | + (void)enableNetWork; 18 | + (void)disableNetWork; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFSession/FFSession.mm: -------------------------------------------------------------------------------- 1 | // 2 | // FFSession.m 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/3/31. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "FFSession.h" 10 | #import "libFFmpeg.hpp" 11 | 12 | @implementation FFSession 13 | 14 | + (void)enableSession { 15 | av_register_all(); 16 | } 17 | 18 | + (void)enableNetWork { 19 | avformat_network_init(); 20 | } 21 | 22 | + (void)disableNetWork { 23 | avformat_network_deinit(); 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/FFmpeg/FFUtils/FFUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // FFUtils.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/30. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FFInFormatContext.h" 11 | #import "FFOutFormatContext.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface FFUtils : NSObject 16 | 17 | + (int)convertCodecparFromInFmtCtx:(FFInFormatContext *)inFmtCtx 18 | toOutFmtCtx:(FFOutFormatContext *)outFmtCtx; 19 | 20 | + (void)convertTimeBaseWithPacket:(FFPacket *)packet 21 | fromInFmtCtx:(FFInFormatContext *)inFmtCtx 22 | toOutFmtCtx:(FFOutFormatContext *)outFmtCtx; 23 | 24 | + (NSArray *)analyH264SpsPpsWithExtradata:(const uint8_t *)extradata size:(int)size; 25 | 26 | + (NSArray *)analyHEVCVpsSpsPpsWithExtradata:(const uint8_t *)extradata size:(int)size; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/DVFlv.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlv.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVFlvTag.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVFlv : NSObject 15 | 16 | - (void)addTag:(DVFlvTag *)flvTag; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/DVFlv.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlv.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVFlv.h" 10 | 11 | @implementation DVFlv 12 | 13 | - (void)addTag:(DVFlvTag *)flvTag { 14 | 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/DVFlvKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlvKit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVFlvKit_h 10 | #define DVFlvKit_h 11 | 12 | #import "DVFlv.h" 13 | #import "DVFlvTag.h" 14 | #import "DVFlvTagHeader.h" 15 | #import "DVMetaFlvTagData.h" 16 | #import "DVVideoFlvTagData.h" 17 | #import "DVAudioFlvTagData.h" 18 | 19 | #endif /* DVFlvKit_h */ 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/DVFlvTag.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlvTag.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVFlvTagHeader.h" 11 | #import "DVFlvTagData.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface DVFlvTag : NSObject 16 | 17 | @property(nonatomic, strong, readonly) DVFlvTagHeader *tagHeader; 18 | @property(nonatomic, strong, readonly) id tagData; 19 | @property(nonatomic, strong, readonly) NSData *fullData; 20 | 21 | 22 | #pragma mark - <-- Initializer --> 23 | - (instancetype)initWithType:(DVFlvTagType)tagType 24 | tagData:(id)tagData; 25 | 26 | - (instancetype)initWithType:(DVFlvTagType)tagType 27 | timeStamp:(UInt32)timeStamp 28 | tagData:(id)tagData; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/DVFlvTag.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlvTag.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVFlvTag.h" 10 | 11 | @interface DVFlvTag () 12 | 13 | @property(nonatomic, strong, readwrite) DVFlvTagHeader *tagHeader; 14 | @property(nonatomic, strong, readwrite) id tagData; 15 | 16 | @end 17 | 18 | @implementation DVFlvTag 19 | 20 | #pragma mark - <-- Initializer --> 21 | - (instancetype)initWithType:(DVFlvTagType)tagType 22 | tagData:(id)tagData { 23 | return [self initWithType:tagType timeStamp:0 tagData:tagData]; 24 | } 25 | 26 | - (instancetype)initWithType:(DVFlvTagType)tagType 27 | timeStamp:(UInt32)timeStamp 28 | tagData:(id)tagData { 29 | self = [super init]; 30 | if (self) { 31 | self.tagHeader = [[DVFlvTagHeader alloc] initWithTagType:tagType]; 32 | self.tagHeader.timeStamp = timeStamp; 33 | [self.tagHeader setValue:@((UInt32)(tagData.fullData.length)) forKey:@"_dataSize"]; 34 | self.tagData = tagData; 35 | } 36 | return self; 37 | } 38 | 39 | 40 | 41 | #pragma mark - <-- Property --> 42 | - (NSData *)fullData { 43 | NSMutableData *mData = [NSMutableData data]; 44 | [mData appendData:self.tagHeader.fullData]; 45 | [mData appendData:self.tagData.fullData]; 46 | return [mData copy]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/AudioFlvTagData/AudioPacket/DVAACAudioPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAACAudioPacket.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/21. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Define --------------------> 14 | typedef NS_ENUM(UInt8,DVAACAudioPacketType) { 15 | DVAACAudioPacketType_Header = 0x00, 16 | DVAACAudioPacketType_AAC = 0x01, 17 | }; 18 | 19 | 20 | 21 | #pragma mark - <-------------------- Class --------------------> 22 | @interface DVAACAudioPacket : NSObject 23 | 24 | #pragma mark - <-- Property --> 25 | @property(nonatomic, assign, readonly) DVAACAudioPacketType packetType; 26 | @property(nonatomic, strong, readonly, nullable) NSData *sequenceHeader; 27 | @property(nonatomic, strong, readonly, nullable) NSData *audioData; 28 | 29 | @property(nonatomic, strong, readonly) NSData *fullData; 30 | 31 | 32 | #pragma mark - <-- Initializer --> 33 | + (instancetype)headerPacketWithSampleRate:(NSUInteger)sampleRate channels:(UInt32)channels; 34 | + (instancetype)packetWithAAC:(NSData *)aacData; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/AudioFlvTagData/DVAudioFlvTagData.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVAudioFlvTagData.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVAudioFlvTagData.h" 10 | 11 | @interface DVAudioFlvTagData () 12 | 13 | @property(nonatomic, assign, readwrite) DVAudioPacketFormatType formatType; 14 | @property(nonatomic, assign, readwrite) DVAudioPacketSampleRateType sampleRateType; 15 | @property(nonatomic, assign, readwrite) DVAudioPackeBitsType bitsType; 16 | @property(nonatomic, assign, readwrite) DVAudioPacketAudioType audioType; 17 | @property(nonatomic, strong, readwrite) NSData *packetData; 18 | 19 | @end 20 | 21 | 22 | @implementation DVAudioFlvTagData 23 | 24 | #pragma mark - <-- Initializer --> 25 | + (instancetype)tagDataWithAACPacket:(DVAACAudioPacket *)packet { 26 | DVAudioFlvTagData *tagData = [[DVAudioFlvTagData alloc] init]; 27 | tagData.formatType = DVAudioPacketFormatType_AAC; 28 | tagData.sampleRateType = DVAudioPacketSampleRateType_44Khz; 29 | tagData.bitsType = DVAudioPackeBitsType_16Bit; 30 | tagData.audioType = DVAudioPacketAudioType_Stereo; 31 | tagData.packetData = packet.fullData; 32 | return tagData; 33 | } 34 | 35 | 36 | #pragma mark - <-- Property --> 37 | - (NSData *)fullData { 38 | NSMutableData *mData = [NSMutableData data]; 39 | 40 | UInt8 header = (self.formatType << 4) 41 | | (self.sampleRateType << 2) 42 | | (self.bitsType << 1) 43 | | self.audioType; 44 | [mData appendBytes:&header length:1]; 45 | [mData appendData:self.packetData]; 46 | 47 | return [mData copy]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/DVFlvTagData.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlvTagData.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol DVFlvTagData 14 | 15 | @property(nonatomic, strong, readonly) NSData *fullData; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/DVAMF.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAMF.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Define --------------------> 14 | typedef NS_ENUM(UInt8, DVAMFType) { 15 | DVAMFTypeNumber = 0x00, 16 | DVAMFTypeBool = 0x01, 17 | DVAMFTypeString = 0x02, 18 | DVAMFTypeObject = 0x03, 19 | DVAMFTypeObjectEnd = 0x09, 20 | DVAMFTypeLongString = 0x0C, 21 | }; 22 | 23 | 24 | #pragma mark - <-------------------- Protocol --------------------> 25 | @protocol DVAMF 26 | 27 | @property(nonatomic, assign, readonly) DVAMFType amfType; 28 | @property(nonatomic, assign, readonly) NSData *amfData; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/NSMutableDictionary+DVAMF.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+DVAMF.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAMF.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSMutableDictionary (DVAMF) 15 | 16 | - (void)setAMFObject:(id)anObject forAMFKey:(NSString *)aKey; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/NSMutableDictionary+DVAMF.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+DVAMF.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "NSMutableDictionary+DVAMF.h" 10 | 11 | @implementation NSMutableDictionary (DVAMF) 12 | 13 | - (DVAMFType)amfType { 14 | return DVAMFTypeObject; 15 | } 16 | 17 | - (NSData *)amfData { 18 | NSMutableData *mData = [NSMutableData data]; 19 | 20 | DVAMFType amfType = self.amfType; 21 | [mData appendBytes:&amfType length:1]; 22 | 23 | for (NSString *key in self.allKeys) { 24 | NSData *keyData = key.amfData; 25 | [mData appendData:[keyData subdataWithRange:NSMakeRange(1, keyData.length - 1)]]; 26 | [mData appendData:((id)self[key]).amfData]; 27 | } 28 | 29 | uint16_t end1 = 0x0000; 30 | [mData appendBytes:&end1 length:2]; 31 | uint8_t end2 = DVAMFTypeObjectEnd; 32 | [mData appendBytes:&end2 length:1]; 33 | 34 | return [mData copy]; 35 | } 36 | 37 | - (void)setAMFObject:(id)anObject forAMFKey:(NSString *)aKey { 38 | self[aKey] = anObject; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/NSNumber+DVAMF.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+DVAMF.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAMF.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSNumber (DVAMF) 15 | 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/NSNumber+DVAMF.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+DVAMF.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "NSNumber+DVAMF.h" 10 | 11 | @implementation NSNumber (DVAMF) 12 | 13 | - (DVAMFType)amfType { 14 | return strcmp(self.objCType, "c") == 0 ? DVAMFTypeBool : DVAMFTypeNumber; 15 | } 16 | 17 | - (NSData *)amfData { 18 | NSMutableData *mData = [NSMutableData data]; 19 | 20 | DVAMFType amfType = self.amfType; 21 | [mData appendBytes:&amfType length:1]; 22 | 23 | if (amfType == DVAMFTypeBool) { 24 | uint8_t num = (uint8_t)[self boolValue]; 25 | [mData appendBytes:&num length:1]; 26 | } else if (amfType == DVAMFTypeNumber) { 27 | double value = [self doubleValue]; 28 | uint8_t *pIn = (uint8_t *)&value; 29 | uint8_t pOut[8] = {0}; 30 | 31 | pOut[0] = pIn[7]; 32 | pOut[1] = pIn[6]; 33 | pOut[2] = pIn[5]; 34 | pOut[3] = pIn[4]; 35 | pOut[4] = pIn[3]; 36 | pOut[5] = pIn[2]; 37 | pOut[6] = pIn[1]; 38 | pOut[7] = pIn[0]; 39 | 40 | [mData appendBytes:&pOut length:8]; 41 | } 42 | 43 | return [mData copy]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/NSString+DVAMF.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+DVAMF.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAMF.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSString (DVAMF) 15 | 16 | 17 | 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/AMF/NSString+DVAMF.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+DVAMF.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "NSString+DVAMF.h" 10 | 11 | @implementation NSString (DVAMF) 12 | 13 | - (DVAMFType)amfType { 14 | return self.length > 0xFFFF ? DVAMFTypeLongString : DVAMFTypeString; 15 | } 16 | 17 | - (NSData *)amfData { 18 | NSMutableData *mData = [NSMutableData data]; 19 | 20 | DVAMFType amfType = self.amfType; 21 | [mData appendBytes:&amfType length:1]; 22 | 23 | if (amfType == DVAMFTypeString) { 24 | uint16_t len = CFSwapInt16HostToBig(self.length); 25 | [mData appendBytes:&len length:2]; 26 | } else if (amfType == DVAMFTypeLongString) { 27 | uint32_t len = CFSwapInt32HostToBig((uint32_t)self.length); 28 | [mData appendBytes:&len length:4]; 29 | } 30 | 31 | NSData *strData = [self dataUsingEncoding:NSASCIIStringEncoding]; 32 | [mData appendData:strData]; 33 | 34 | return [mData copy]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/MetaFlvTagData/DVMetaFlvTagData.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVMetaFlvTagData.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVFlvTagData.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVMetaFlvTagData : NSObject 15 | 16 | #pragma mark - <-- Base --> 17 | /// 时长, 默认: 0 18 | @property(nonatomic, assign) float duration; 19 | /// 文件大小, 默认: 0 20 | @property(nonatomic, assign) float fileSize; 21 | 22 | 23 | #pragma mark - <-- Video --> 24 | /// 宽度 25 | @property(nonatomic, assign) CGFloat videoWidth; 26 | /// 高度 27 | @property(nonatomic, assign) CGFloat videoHeight; 28 | /// 帧率 29 | @property(nonatomic, assign) NSUInteger videoFps; 30 | /// 码率,单位是 bps 31 | @property(nonatomic, assign) NSUInteger videoBitRate; 32 | /// 视频编码器ID,默认: avc1 33 | @property(nonatomic, copy) NSString *videoCodecID; 34 | 35 | 36 | #pragma mark - <-- Audio --> 37 | /// 采样率 38 | @property(nonatomic, assign) NSUInteger audioSampleRate; 39 | /// 位数 40 | @property(nonatomic, assign) UInt32 audioBits; 41 | /// 通道 42 | @property(nonatomic, assign) UInt32 audioChannels; 43 | /// 音频编码器ID,默认: mp4a 44 | @property(nonatomic, copy) NSString *audioCodecID; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/VideoFlvTagData/DVVideoFlvTagData.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoFlvTagData.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVVideoFlvTagData.h" 10 | 11 | @interface DVVideoFlvTagData () 12 | 13 | @property(nonatomic, assign, readwrite) DVVideoFlvTagFrameType frameType; 14 | @property(nonatomic, assign, readwrite) DVVideoFlvTagCodecIDType codecIDType; 15 | @property(nonatomic, strong, readwrite) NSData *packetData; 16 | 17 | @end 18 | 19 | 20 | @implementation DVVideoFlvTagData 21 | 22 | #pragma mark - <-- Initializer --> 23 | + (instancetype)tagDataWithFrameType:(DVVideoFlvTagFrameType)frameType 24 | avcPacket:(DVAVCVideoPacket *)packet { 25 | DVVideoFlvTagData *tagData = [[DVVideoFlvTagData alloc] init]; 26 | tagData.frameType = frameType; 27 | tagData.codecIDType = DVVideoFlvTagCodecIDType_AVC; 28 | tagData.packetData = packet.fullData; 29 | return tagData; 30 | } 31 | 32 | + (instancetype)tagDataWithFrameType:(DVVideoFlvTagFrameType)frameType 33 | hevcPacket:(DVHEVCVideoPacket *)packet { 34 | DVVideoFlvTagData *tagData = [[DVVideoFlvTagData alloc] init]; 35 | tagData.frameType = frameType; 36 | tagData.codecIDType = DVVideoFlvTagCodecIDType_HEVC; 37 | tagData.packetData = packet.fullData; 38 | return tagData; 39 | } 40 | 41 | 42 | #pragma mark - <-- Property --> 43 | - (NSData *)fullData { 44 | NSMutableData *mData = [NSMutableData data]; 45 | 46 | UInt8 header = (_frameType << 4) | _codecIDType; 47 | 48 | [mData appendBytes:&header length:1]; 49 | [mData appendData:self.packetData]; 50 | 51 | return [mData copy]; 52 | } 53 | 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/VideoFlvTagData/VideoPacket/DVAVCVideoPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAVCVideoPacket.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Define --------------------> 14 | typedef NS_ENUM(UInt8, DVAVCVideoPacketType) { 15 | DVAVCVideoPacketType_Header = 0x00, 16 | DVAVCVideoPacketType_AVC = 0x01, 17 | DVAVCVideoPacketType_End = 0x02, 18 | }; 19 | 20 | 21 | 22 | #pragma mark - <-------------------- Class --------------------> 23 | @interface DVAVCVideoPacket : NSObject 24 | 25 | #pragma mark - <-- Property --> 26 | @property(nonatomic, assign, readonly) DVAVCVideoPacketType packetType; 27 | @property(nonatomic, assign, readonly) UInt32 timeStamp; 28 | @property(nonatomic, strong, readonly) NSData *videoData; 29 | 30 | @property(nonatomic, strong, readonly) NSData *fullData; 31 | 32 | 33 | #pragma mark - <-- Initializer --> 34 | + (instancetype)headerPacketWithSps:(NSData *)sps pps:(NSData *)pps; 35 | + (instancetype)packetWithAVC:(NSData *)avcData timeStamp:(UInt32)timeStamp; 36 | + (instancetype)endPacket; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagData/VideoFlvTagData/VideoPacket/DVHEVCVideoPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVHEVCVideoPacket.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/22. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | 14 | #pragma mark - <-------------------- Define --------------------> 15 | typedef NS_ENUM(UInt8, DVHEVCVideoPacketType) { 16 | DVHEVCVideoPacketType_Header = 0x00, 17 | DVHEVCVideoPacketType_HEVC = 0x01, 18 | DVHEVCVideoPacketType_End = 0x02, 19 | }; 20 | 21 | 22 | #pragma mark - <-------------------- Class --------------------> 23 | @interface DVHEVCVideoPacket : NSObject 24 | 25 | #pragma mark - <-- Property --> 26 | @property(nonatomic, assign, readonly) DVHEVCVideoPacketType packetType; 27 | @property(nonatomic, assign, readonly) UInt32 timeStamp; 28 | @property(nonatomic, strong, readonly) NSData *videoData; 29 | 30 | @property(nonatomic, strong, readonly) NSData *fullData; 31 | 32 | 33 | #pragma mark - <-- Initializer --> 34 | + (instancetype)headerPacketWithVps:(NSData *)vps sps:(NSData *)sps pps:(NSData *)pps; 35 | + (instancetype)packetWithHEVC:(NSData *)hevcData timeStamp:(UInt32)timeStamp; 36 | + (instancetype)endPacket; 37 | 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagHeader/DVFlvTagHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlvTagHeader.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Define --------------------> 14 | typedef NS_ENUM(UInt8, DVFlvTagType) { 15 | DVFlvTagType_Mate = 0x12, 16 | DVFlvTagType_Video = 0x09, 17 | DVFlvTagType_Audio = 0x08, 18 | }; 19 | 20 | 21 | #pragma mark - <-------------------- Class --------------------> 22 | @interface DVFlvTagHeader : NSObject 23 | 24 | #pragma mark - <-- Property --> 25 | /// 类型, 1Bytes 26 | @property(nonatomic, assign, readonly) DVFlvTagType tagType; 27 | /// tagData长度, 3Bytes 28 | @property(nonatomic, assign, readonly) UInt32 dataSize; 29 | /// 时间戳, 4Bytes 30 | @property(nonatomic, assign) UInt32 timeStamp; 31 | /// 3Bytes, 默认:0 32 | @property(nonatomic, assign) UInt32 streamsID; 33 | 34 | @property(nonatomic, strong, readonly) NSData *fullData; 35 | 36 | 37 | #pragma mark - <-- Initializer --> 38 | - (instancetype)initWithTagType:(DVFlvTagType)tagType; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Flv/FlvTag/FlvTagHeader/DVFlvTagHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVFlvTagHeader.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVFlvTagHeader.h" 10 | 11 | @interface DVFlvTagHeader () 12 | 13 | @property(nonatomic, assign, readwrite) DVFlvTagType tagType; 14 | @property(nonatomic, assign, readwrite) UInt32 dataSize; 15 | 16 | @end 17 | 18 | 19 | @implementation DVFlvTagHeader 20 | 21 | #pragma mark - <-- Initializer --> 22 | - (instancetype)init { 23 | self = [super init]; 24 | if (self) { 25 | self.timeStamp = 0; 26 | self.streamsID = 0; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithTagType:(DVFlvTagType)tagType { 32 | self = [self init]; 33 | if (self) { 34 | self.tagType = tagType; 35 | } 36 | return self; 37 | } 38 | 39 | 40 | 41 | #pragma mark - <-- Property --> 42 | - (NSData *)fullData { 43 | NSMutableData *mData = [NSMutableData data]; 44 | 45 | DVFlvTagType tagType = _tagType; 46 | [mData appendBytes:&(tagType) length:1]; 47 | 48 | UInt32 dataSize = (_dataSize & 0x00ffffff) << 8; 49 | [mData appendBytes:&dataSize length:3]; 50 | 51 | UInt32 timeStamp = (_timeStamp & 0x00ffffff) << 8; 52 | [mData appendBytes:&timeStamp length:3]; 53 | 54 | UInt32 timeStampEx = (_timeStamp & 0xff000000); 55 | [mData appendBytes:&timeStampEx length:1]; 56 | 57 | UInt32 streamsID = (_streamsID & 0x00ffffff) << 8; 58 | [mData appendBytes:&streamsID length:3]; 59 | 60 | return [mData copy]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Application/DVGLColorLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLColorLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLRenderLayer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGLColorLayer : DVGLRenderLayer 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Application/DVGLColorLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLColorLayer.m 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLColorLayer.h" 10 | 11 | @interface DVGLColorLayer () 12 | 13 | @end 14 | 15 | @implementation DVGLColorLayer 16 | 17 | #pragma mark - <-- Instancetype --> 18 | - (instancetype)initWithFrame:(CGRect)frame { 19 | self = [super initWithFrame:frame]; 20 | if (self) { 21 | self.delegate = self; 22 | [self initVertices]; 23 | 24 | } 25 | return self; 26 | } 27 | 28 | 29 | #pragma mark - <-- Init --> 30 | - (void)initVertices { 31 | const GLfloat vertices[] = { 32 | -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 33 | 1.0f, 1.0f, 0.0f, 0.8f, 0.8f, 1.0f, 1.0f, 34 | -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 35 | 1.0f, -1.0f, 0.0f, 0.6f, 0.6f, 1.0f, 1.0f, 36 | }; 37 | 38 | const GLubyte indeices[] = { 39 | 0, 1, 2, 40 | 1, 2, 3, 41 | }; 42 | 43 | [self bindVertexBufferWithVertices:(GLfloat *)vertices size:sizeof(vertices)]; 44 | [self bindIndexBufferWithIndices:(GLubyte *)indeices size:sizeof(indeices)]; 45 | 46 | [self enableVertexAttribPositionWithIndex:0 len:3 stride:7]; 47 | [self enableVertexAttribColorWithIndex:3 len:4 stride:7]; 48 | } 49 | 50 | 51 | #pragma mark - <-- Delegate --> 52 | - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { 53 | [self drawElements]; 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Application/DVGLPNGLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLPNGLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLRenderLayer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGLPNGLayer : DVGLRenderLayer 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Application/DVGLPNGLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLPNGLayer.m 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLPNGLayer.h" 10 | #import "GLKTextureLoader+DVGL.h" 11 | 12 | @interface DVGLPNGLayer () 13 | 14 | @end 15 | 16 | 17 | @implementation DVGLPNGLayer 18 | 19 | #pragma mark - <-- Instancetype --> 20 | - (instancetype)initWithFrame:(CGRect)frame { 21 | self = [super initWithFrame:frame]; 22 | if (self) { 23 | self.delegate = self; 24 | [self initVertices]; 25 | [self initTexture]; 26 | } 27 | return self; 28 | } 29 | 30 | 31 | #pragma mark - <-- Init --> 32 | - (void)initVertices { 33 | 34 | const GLfloat vertices[] = { 35 | -0.9f, -0.6f, 0.0f, 0.0f, 0.0f, 36 | 0.9f, -0.6f, 0.0f, 1.0f, 0.0f, 37 | -0.9f, 0.6f, 0.0f, 0.0f, 1.0f, 38 | 0.9f, 0.6f, 0.0f, 1.0f, 1.0f, 39 | }; 40 | 41 | const GLubyte indeices[] = { 42 | 0, 1, 2, 43 | 1, 2, 3, 44 | }; 45 | 46 | 47 | [self bindVertexBufferWithVertices:(GLfloat *)vertices size:sizeof(vertices)]; 48 | [self bindIndexBufferWithIndices:(GLubyte *)indeices size:sizeof(indeices)]; 49 | 50 | [self enableVertexAttribPositionWithIndex:0 len:3 stride:5]; 51 | [self enableVertexAttribTexCoord0WithIndex:3 len:2 stride:5]; 52 | } 53 | 54 | - (void)initTexture { 55 | GLKTextureInfo *textureInfo = [GLKTextureLoader textureWithBundleName:@"1.png"]; 56 | 57 | self.baseEffect.texture2d0.enabled = GL_TRUE; 58 | self.baseEffect.texture2d0.name = textureInfo.name; 59 | } 60 | 61 | 62 | #pragma mark - <-- Delegate --> 63 | - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { 64 | [self drawElements]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Application/DVGLPreview.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLPreview.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/2. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLRenderLayer.h" 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVGLPreview : DVGLRenderLayer 15 | 16 | - (void)displayWithPixelBuffer:(CVPixelBufferRef)pixelBuffer; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Category/GLKTextureLoader+DVGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // GLKTextureLoader+GL.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/16. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface GLKTextureLoader (DVGL) 14 | 15 | + (nullable GLKTextureInfo *)textureWithBundleName:(NSString *)bundleName; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/Category/GLKTextureLoader+DVGL.m: -------------------------------------------------------------------------------- 1 | // 2 | // GLKTextureLoader+GL.m 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/16. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "GLKTextureLoader+DVGL.h" 10 | 11 | @implementation GLKTextureLoader (DVGL) 12 | 13 | + (GLKTextureInfo *)textureWithBundleName:(NSString *)bundleName { 14 | NSString *path = [NSBundle.mainBundle.resourcePath stringByAppendingPathComponent:bundleName]; 15 | NSDictionary *options = @{ 16 | GLKTextureLoaderOriginBottomLeft : @(1), 17 | }; 18 | NSError *error; 19 | 20 | GLKTextureInfo *textureInfo = [GLKTextureLoader textureWithContentsOfFile:path 21 | options:options 22 | error:&error]; 23 | if (error) { 24 | NSAssert(error, @"[GLKTextureLoader ERROR]: textureInfo failer to load",error.localizedDescription); 25 | } 26 | 27 | return textureInfo; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/ContextLayer/DVGLContextLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLContextLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGLContextLayer : GLKView 14 | 15 | #pragma mark - <-- Initializer --> 16 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 17 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/ContextLayer/DVGLContextLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLContextLayer.m 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLContextLayer.h" 10 | 11 | @interface DVGLContextLayer () 12 | 13 | 14 | @end 15 | 16 | @implementation DVGLContextLayer 17 | 18 | - (instancetype)initWithFrame:(CGRect)frame { 19 | self = [super initWithFrame:frame]; 20 | if (self) { 21 | [self initContext]; 22 | } 23 | return self; 24 | } 25 | 26 | - (void)dealloc { 27 | self.delegate = nil; 28 | } 29 | 30 | 31 | #pragma mark - <-- Init --> 32 | - (void)initContext { 33 | EAGLContext *context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; 34 | NSAssert(context, @"OpenGL create context failed"); 35 | 36 | BOOL ret = [EAGLContext setCurrentContext:context]; 37 | NSAssert(ret, @"OpenGL set context failed"); 38 | 39 | self.context = context; 40 | self.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888; // 颜色格式 41 | self.drawableDepthFormat = GLKViewDrawableDepthFormat24; // 深度格式 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/DVGLKits.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLKits.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #ifndef DVGLKits_h 10 | #define DVGLKits_h 11 | 12 | #import "GLKTextureLoader+DVGL.h" 13 | 14 | #import "DVGLPreview.h" 15 | #import "DVGLPNGLayer.h" 16 | #import "DVGLColorLayer.h" 17 | 18 | #endif /* DVGLKits_h */ 19 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/GLKit/RenderLayer/DVGLRenderLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLRenderLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGLContextLayer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGLRenderLayer : DVGLContextLayer 14 | 15 | #pragma mark - <-- Property --> 16 | @property(nonatomic, strong, readonly) GLKBaseEffect *baseEffect; 17 | 18 | 19 | #pragma mark - <-- Initializer --> 20 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 21 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 22 | 23 | 24 | #pragma mark - <-- Method --> 25 | - (void)setBackgroundColorWithR:(float)r G:(float)g B:(float)b A:(float)a; 26 | 27 | - (void)bindVertexBufferWithVertices:(GLfloat *)vertices size:(int32_t)size; 28 | - (void)bindIndexBufferWithIndices:(GLubyte *)indices size:(int32_t)size; 29 | 30 | - (void)enableVertexAttribPositionWithIndex:(int32_t)index 31 | len:(int32_t)len 32 | stride:(size_t)stride; 33 | - (void)enableVertexAttribColorWithIndex:(int32_t)index 34 | len:(int32_t)len 35 | stride:(size_t)stride; 36 | - (void)enableVertexAttribTexCoord0WithIndex:(int32_t)index 37 | len:(int32_t)len 38 | stride:(size_t)stride; 39 | - (void)enableVertexAttribTexCoord1WithIndex:(int32_t)index 40 | len:(int32_t)len 41 | stride:(size_t)stride; 42 | 43 | - (void)clearLayer; 44 | - (void)drawElements; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Live/DVLiveKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVLiveKit.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/22. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #ifndef DVLiveKit_h 10 | #define DVLiveKit_h 11 | 12 | #import "DVLive.h" 13 | #import "DVLivePlayer.h" 14 | 15 | #endif /* DVLiveKit_h */ 16 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/Live/DVLivePlayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVLivePlayer.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/22. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVLivePlayer : NSObject 14 | 15 | #pragma mark - <-- Property --> 16 | @property(nonatomic, weak, readonly) UIView *preView; 17 | 18 | 19 | //MARK: - <-- Initializer --> 20 | - (instancetype)initWithPreViewFrame:(CGRect)previewFrame; 21 | 22 | 23 | #pragma mark - <-- Method --> 24 | - (void)connectToURL:(NSString *)url; 25 | - (void)disconnect; 26 | 27 | - (void)startPlay; 28 | - (void)stopPlay; 29 | 30 | - (UIImage *)screenshot; 31 | - (void)saveScreenshotToPhotoAlbumWithCompletion:(void(^)(BOOL finished))completion; 32 | 33 | - (void)startRecordToURL:(NSString *)url completion:(void(^)(BOOL finished))completion; 34 | - (void)startRecordToPhotoAlbumWithCompletion:(void(^)(BOOL finished))completion; 35 | - (void)stopRecord; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/Color/DVOPGLColorLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOPGLColorLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVOPGLRenderLayer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVOPGLColorLayer : DVOPGLRenderLayer 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/Color/color_fragment.fs: -------------------------------------------------------------------------------- 1 | varying lowp vec4 outColor; 2 | void main(void){ 3 | gl_FragColor=outColor; 4 | } 5 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/Color/color_vertex.vs: -------------------------------------------------------------------------------- 1 | attribute vec4 position; 2 | attribute vec4 inColor; 3 | varying vec4 outColor; 4 | void main() { 5 | gl_Position=position; 6 | outColor=inColor; 7 | } 8 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/PNG/DVOPGLPNGLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOPGLPNGLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVOPGLRenderLayer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVOPGLPNGLayer : DVOPGLRenderLayer 14 | 15 | - (void)renderData:(NSData *)data size:(CGSize)size; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/PNG/png_fragment.fs: -------------------------------------------------------------------------------- 1 | precision highp float; 2 | varying highp vec2 v_texcoord; 3 | uniform sampler2D texSampler; 4 | void main() { 5 | gl_FragColor = texture2D(texSampler,v_texcoord); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/PNG/png_vertex.vs: -------------------------------------------------------------------------------- 1 | attribute vec4 position; 2 | attribute vec2 texcoord; 3 | varying vec2 v_texcoord; 4 | void main() { 5 | gl_Position=position; 6 | v_texcoord=texcoord; 7 | } 8 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/Preview/DVOPGLPreview.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOPGLPreview.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/4/3. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVOPGLRenderLayer.h" 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVOPGLPreview : DVOPGLRenderLayer 15 | 16 | #pragma mark - <-- Property --> 17 | @property(nonatomic, assign) BOOL isFullYUVRange; 18 | 19 | 20 | #pragma mark - <-- Method --> 21 | - (void)displayWithPixelBuffer:(CVPixelBufferRef)pixelBuffer; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/Preview/pre_fragment.fs: -------------------------------------------------------------------------------- 1 | varying highp vec2 outTexcoord; 2 | precision mediump float; 3 | uniform sampler2D yTexture; 4 | uniform sampler2D uvTexture; 5 | uniform mediump mat3 colorMatrix; 6 | void main(){ 7 | mediump vec3 yuv; 8 | lowp vec3 rgb; 9 | yuv.x = texture2D(yTexture, outTexcoord).r; 10 | yuv.yz = texture2D(uvTexture, outTexcoord).ra - vec2(0.5, 0.5); 11 | rgb = colorMatrix * yuv; 12 | gl_FragColor = vec4(rgb, 1); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Application/Preview/pre_vertex.vs: -------------------------------------------------------------------------------- 1 | attribute vec4 position; 2 | attribute vec2 inTexcoord; 3 | varying vec2 outTexcoord; 4 | void main() { 5 | gl_Position = position; 6 | outTexcoord = inTexcoord; 7 | } 8 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/ContextLayer/DVOPGLContextLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOPGLContextLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface DVOPGLContextLayer : UIView 17 | 18 | @property(nonatomic, strong, readonly) EAGLContext *context; 19 | @property(nonatomic, assign, readonly) GLint glWidth; 20 | @property(nonatomic, assign, readonly) GLint glHeight; 21 | 22 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 23 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/DVOpenGLKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOpenGLKit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/11/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVOpenGLKit_h 10 | #define DVOpenGLKit_h 11 | 12 | #pragma mark - <-------------------- Import --------------------> 13 | #import "DVOPGLPNGLayer.h" 14 | #import "DVOPGLColorLayer.h" 15 | #import "DVOPGLPreview.h" 16 | 17 | #endif /* DVOpenGLKit_h */ 18 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/ProgramLayer/DVOPGLProgramLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOPGLProgramLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVOPGLContextLayer.h" 10 | #import "DVOPGLShaderDataSource.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVOPGLProgramLayer : DVOPGLContextLayer 15 | 16 | @property(nonatomic, assign, readonly) GLuint program; 17 | 18 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 19 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/Protocol/DVOPGLShaderDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGLShaderDataSource.h 3 | // DVLibrary 4 | // 5 | // Created by DV on 2019/1/14. 6 | // Copyright © 2019 DVLibrary. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol DVOPGLShaderDataSource 14 | @optional 15 | - (NSString *)vertexShaderBundleName; 16 | - (NSString *)fragmentShaderBundleName; 17 | 18 | - (NSString *)vertexShaderString; 19 | - (NSString *)fragmentShaderString; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/OpenGL/RenderLayer/DVOPGLRenderLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVOPGLRenderLayer.h 3 | // DVGLKit 4 | // 5 | // Created by DV on 2019/1/15. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVOPGLProgramLayer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVOPGLRenderLayer : DVOPGLProgramLayer 14 | 15 | #pragma mark - <-- Initializer --> 16 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 17 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 18 | 19 | 20 | #pragma mark - <-- Method --> 21 | // 截图 22 | - (UIImage *)openglSnapshotImage; 23 | 24 | 25 | // 配置 26 | - (void)setBackgroundColorWithR:(float)r G:(float)g B:(float)b A:(float)a; 27 | 28 | 29 | // 内存数据 30 | - (void)createBuffer:(GLuint *)buffer vertices:(GLfloat *)vertices size:(int32_t)size; 31 | - (void)createBuffer:(GLuint *)buffer indices:(GLubyte *)indices size:(int32_t)size; 32 | - (void)deleteBuffer:(GLuint *)buffer; 33 | 34 | 35 | // 顶点 36 | - (GLuint)getAttribLocationWithName:(NSString *)name; 37 | - (GLuint)getUniformLocationWithName:(NSString *)name; 38 | 39 | - (void)enableVertexAttrib:(GLuint *)vertexAttrib index:(int32_t)index len:(int32_t)len stride:(size_t)stride; 40 | - (void)disableVertexAttrib:(GLuint *)vertexAttrib; 41 | 42 | 43 | // 纹理 44 | - (void)createTexture:(GLuint *)texture; 45 | - (void)deleteTexture:(GLuint *)texture; 46 | 47 | - (void)preEnableTextureWithUniform:(GLuint *)uniform index:(int)index; 48 | - (void)enableTexture2DWithTexture:(GLuint *)texture; 49 | - (void)fillTexture2DFromRGBAData:(NSData *)data size:(CGSize)size; 50 | - (void)disableTexture2D; 51 | 52 | 53 | // 绘画 54 | - (void)clearLayer; 55 | - (void)drawElements; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Buffer/DVRtmpBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRtmpBuffer.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/22. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVRtmpPacket.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #pragma mark - <-------------------- Define --------------------> 15 | typedef NS_ENUM(UInt8, DVRtmpBufferStatus) { 16 | DVRtmpBufferStatus_Steady = 0, // 缓冲稳定 17 | DVRtmpBufferStatus_Increase = 1, // 缓冲增加中 18 | DVRtmpBufferStatus_Decrease = 2, // 缓冲减少中 19 | }; 20 | 21 | 22 | 23 | #pragma mark - <-------------------- Delegate --------------------> 24 | @class DVRtmpBuffer; 25 | @protocol DVRtmpBufferDelegate 26 | 27 | - (void)DVRtmpBuffer:(DVRtmpBuffer *)rtmpBuffer bufferStatus:(DVRtmpBufferStatus)bufferStatus; 28 | 29 | - (void)DVRtmpBuffer:(DVRtmpBuffer *)rtmpBuffer 30 | bufferOverMaxCount:(NSArray *)bufferList 31 | deleteBuffer:(void(^)(NSArray *))deleteBlock; 32 | 33 | @end 34 | 35 | 36 | 37 | #pragma mark - <-------------------- Class --------------------> 38 | @interface DVRtmpBuffer : NSObject 39 | 40 | #pragma mark - <-- Property --> 41 | /// 监听缓冲变化状态 42 | @property(nonatomic, weak, nullable) id delegate; 43 | /// 最大缓冲数量, 默认: 25 FPS x 60s = 1500 44 | @property(nonatomic, assign) NSUInteger bufferMaxCount; 45 | 46 | /// 缓冲区 47 | @property(nonatomic, strong, readonly) NSArray *bufferList; 48 | /// 缓冲数量 49 | @property(nonatomic, assign, readonly) NSUInteger bufferCount; 50 | 51 | 52 | #pragma mark - <-- Method --> 53 | - (void)pushBuffer:(DVRtmpPacket *)buffer; 54 | - (nullable DVRtmpPacket *)popBuffer; 55 | - (void)removeAllBuffer; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Buffer/NSMutableArray+DVRtmpBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+DVRtmpBuffer.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/23. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSMutableArray (DVRtmpBuffer) 14 | 15 | - (nullable ObjectType)popFirstBuffer; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Buffer/NSMutableArray+DVRtmpBuffer.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // NSMutableArray+DVRtmpBuffer.m 4 | // iOS_Test 5 | // 6 | // Created by DV on 2019/10/23. 7 | // Copyright © 2019 iOS. All rights reserved. 8 | // 9 | 10 | #import "NSMutableArray+DVRtmpBuffer.h" 11 | 12 | @implementation NSMutableArray (DVRtmpBuffer) 13 | 14 | - (id)popFirstBuffer { 15 | id buffer = nil; 16 | if (self.count > 0) { 17 | buffer = self.firstObject; 18 | [self removeObjectAtIndex:0]; 19 | } 20 | return buffer; 21 | } 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/DVRtmpKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRtmpKit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/16. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVRtmpKit_h 10 | #define DVRtmpKit_h 11 | 12 | #define RTMP_TIMESTAMP_NOW (CACurrentMediaTime()*1000) 13 | 14 | #import "DVFlvKit.h" 15 | #import "DVRtmp.h" 16 | #import "DVRtmpSocket.h" 17 | //#import "DVFFRtmpSocket.h" 18 | 19 | #endif /* DVRtmpKit_h */ 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Debug/DVRtmpError.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRtmpError.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/24. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSInteger, DVRtmpErrorType) { 14 | DVRtmpErrorNotErr = 0, 15 | DVRtmpErrorFailToSendPacket = -30000, 16 | DVRtmpErrorFailToSendMetaHeader = -30001, 17 | DVRtmpErrorFailToSendVideoHeader = -30002, 18 | DVRtmpErrorFailToSendAudioHeader = -30003, 19 | DVRtmpErrorURLFormatIncorrect = -30004, 20 | DVRtmpErrorFailToSetURL = -30005, 21 | DVRtmpErrorFailToConnectServer = -30006, 22 | DVRtmpErrorFailToConnectStream = -30007, 23 | }; 24 | 25 | void RtmpCheckStatus(int status, NSString *message); 26 | 27 | 28 | @interface DVRtmpError : NSError 29 | 30 | @property(nonatomic, assign, readonly) DVRtmpErrorType errorType; 31 | 32 | - (instancetype)initWithType:(DVRtmpErrorType)errorType; 33 | 34 | + (instancetype)errorWithType:(DVRtmpErrorType)errorType; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Packet/DVRtmpPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRtmpPacket.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/24. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVFlvKit.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #pragma mark - <-------------------- Protocol --------------------> 15 | @interface DVRtmpPacket : NSObject 16 | 17 | @property(nonatomic, assign) uint32_t timeStamp; 18 | @property(nonatomic, strong, nullable) DVVideoFlvTagData *videoData; 19 | @property(nonatomic, strong, nullable) DVAudioFlvTagData *audioData; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Packet/DVRtmpPacket.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVRtmpPacket.m 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/24. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVRtmpPacket.h" 10 | 11 | @implementation DVRtmpPacket 12 | 13 | - (void)dealloc { 14 | _videoData = nil; 15 | _audioData = nil; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Socket/FFRtmpSocket/DVFFRtmpSocket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVFFRtmpSocket.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/18. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVRtmp.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVFFRtmpSocket : NSObject 15 | 16 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 17 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Socket/FFRtmpSocket/FFRtmp.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // FFRtmp.cpp 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/11/4. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #include "FFRtmp.hpp" 10 | 11 | 12 | 13 | //MARK: - <-- Initializer --> 14 | FFRtmp::FFRtmp() { 15 | av_register_all(); 16 | avformat_network_init(); 17 | 18 | 19 | 20 | this->formatCtx = avformat_alloc_context(); 21 | } 22 | 23 | FFRtmp::~FFRtmp() { 24 | avformat_network_deinit(); 25 | } 26 | 27 | 28 | //MARK: - <-- Public --> 29 | int FFRtmp::connectToUrl(char* url) { 30 | return this->openSocket(url); 31 | } 32 | 33 | int FFRtmp::disconnect() { 34 | return this->closeSocket(); 35 | } 36 | 37 | 38 | int FFRtmp::sendData(char *bytes, size_t size) { 39 | 40 | AVPacket pkt; 41 | 42 | memcpy(&pkt, bytes, size); 43 | pkt.size = (int)size; 44 | 45 | 46 | av_write_frame(this->formatCtx, &pkt); 47 | 48 | 49 | 50 | return 1; 51 | } 52 | 53 | 54 | //MARK: - <-- Private --> 55 | int FFRtmp::openSocket(char* url) { 56 | int ret = 0; 57 | 58 | ret = avformat_open_input(&this->formatCtx, NULL, NULL, NULL); 59 | ret = avformat_alloc_output_context2(&this->formatCtx, NULL, "flv", url); 60 | 61 | ret = avformat_write_header(this->formatCtx, NULL); 62 | 63 | return 0; 64 | } 65 | 66 | int FFRtmp::closeSocket() { 67 | 68 | av_write_trailer(this->formatCtx); 69 | 70 | 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Socket/FFRtmpSocket/FFRtmp.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // FFRtmp.hpp 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/11/4. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef FFRtmp_hpp 10 | #define FFRtmp_hpp 11 | 12 | #include 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #ifdef __cplusplus 25 | }; 26 | #endif 27 | 28 | 29 | class FFRtmp { 30 | public: 31 | FFRtmp(); 32 | ~FFRtmp(); 33 | 34 | int connectToUrl(char* url); 35 | int disconnect(); 36 | 37 | int sendData(char *bytes,size_t size); 38 | 39 | private: 40 | AVFormatContext *formatCtx; 41 | AVPacket packet; 42 | 43 | int openSocket(char* url); 44 | int closeSocket(); 45 | }; 46 | 47 | 48 | #endif /* FFRtmp_hpp */ 49 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/RTMP/Socket/RtmpSocket/DVRtmpSocket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRtmpSocket.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/17. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVRtmp.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVRtmpSocket : NSObject 15 | 16 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 17 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/Capture/DVVideoCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoCamera.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoCamera : NSObject 15 | 16 | /// 分辨率 17 | @property(nonatomic, copy) AVCaptureSessionPreset sessionPreset; 18 | /// 摄像头前后 19 | @property(nonatomic, assign, readonly) AVCaptureDevicePosition position; 20 | /// 显示方向 21 | @property (nonatomic, assign) AVCaptureVideoOrientation orientation; 22 | /// 帧率 23 | @property (nonatomic, assign) NSUInteger fps; 24 | /// gop 最大关键帧间隔,一般设定为 fps 的2倍 25 | @property (nonatomic, assign) NSUInteger gop; 26 | /// 码率,单位是 bps 27 | @property (nonatomic, assign) NSUInteger bitRate; 28 | /// 自适应码率开关 29 | @property(nonatomic, assign) BOOL adaptiveBitRate; 30 | /// 输出图像是否等比例,默认为NO 31 | @property (nonatomic, assign) BOOL isAspectRatio; 32 | /// 自动旋转(这里只支持 left 变 right portrait 变 portraitUpsideDown) 33 | @property (nonatomic, assign) BOOL isAutoRotate; 34 | 35 | ///< 是否是横屏 36 | @property (nonatomic, assign, readonly) BOOL isLandscape; 37 | 38 | @property(nonatomic, assign) BOOL alwaysDiscardsLateVideoFrames; 39 | 40 | @property (nonatomic, assign) BOOL mirror; 41 | 42 | @property(nonatomic, assign) AVCaptureVideoStabilizationMode stabilizationMode; 43 | 44 | @property(nonatomic, assign) AVCaptureFlashMode flashMode; 45 | 46 | @property(nonatomic, assign) AVCaptureTorchMode torchMode; 47 | 48 | @property(nonatomic, assign) AVCaptureFocusMode focusMode; 49 | 50 | @property(nonatomic, assign) AVCaptureWhiteBalanceMode whiteBalanceMode; 51 | 52 | @property(nonatomic, assign) CGFloat videoZoomFactor; 53 | 54 | @property(nonatomic, assign) BOOL adjustHDR; 55 | @property(nonatomic, assign) BOOL videoHDREnabled; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/Capture/DVVideoCapture.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoCapture.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/27. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVVideoConfig.h" 11 | #import "DVVideoCamera.h" 12 | #import "DVVideoError.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | #pragma mark - <-------------------- Delegate --------------------> 17 | @class DVVideoCapture; 18 | @protocol DVVideoCaptureDelegate 19 | 20 | - (void)DVVideoCapture:(DVVideoCapture *)capture 21 | outputSampleBuffer:(CMSampleBufferRef)sampleBuffer 22 | error:(nullable DVVideoError *)error; 23 | 24 | @end 25 | 26 | 27 | #pragma mark - <-------------------- Class --------------------> 28 | @interface DVVideoCapture : NSObject 29 | 30 | #pragma mark - <-- Property --> 31 | @property(nonatomic, assign, readonly) BOOL isRunning; 32 | @property(nonatomic, strong, readonly) UIView *preView; 33 | @property(nonatomic, strong, readonly) DVVideoCamera *camera; 34 | 35 | @property(nonatomic, weak) id delegate; 36 | 37 | 38 | 39 | #pragma mark - <-- Initializer --> 40 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 41 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 42 | 43 | - (instancetype)initWithConfig:(DVVideoConfig *)config delegate:(id)delegate; 44 | 45 | 46 | 47 | #pragma mark - <-- Method --> 48 | - (void)start; 49 | - (void)stop; 50 | 51 | - (void)updateConfig:(DVVideoConfig *)config; 52 | - (void)updateCamera:(void(^ _Nullable)(DVVideoCamera *camera)) block; 53 | 54 | - (void)changeToFrontCamera; 55 | - (void)changeToBackCamera; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/DVVideoToolKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoToolKit.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/26. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVVideoToolKit_h 10 | #define DVVideoToolKit_h 11 | 12 | 13 | 14 | #pragma mark - <-- Define --> 15 | #import "DVVideoError.h" 16 | 17 | 18 | #pragma mark - <-- Configuration --> 19 | #import "DVVideoConfig.h" 20 | 21 | #import "DVVideoCapture.h" 22 | 23 | #import "DVVideoCoderKit.h" 24 | 25 | #import "DVVideoPacket.h" 26 | 27 | #endif /* DVVideoToolKit_h */ 28 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/Other/DVVideoError.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoError.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/9/27. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSInteger, DVVideoErrorType) { 14 | DVVideoError_notErr = 0, 15 | DVVideoError_DropSample = 20000, 16 | }; 17 | 18 | 19 | void VideoCheckStatus(OSStatus status, NSString *message); 20 | 21 | 22 | @interface DVVideoError : NSError 23 | 24 | @property(nonatomic, assign, readonly) DVVideoErrorType errorType; 25 | 26 | - (instancetype)initWithType:(DVVideoErrorType)errorType; 27 | 28 | + (instancetype)errorWithType:(DVVideoErrorType)errorType; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/Packet/DVVideoPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoPacket.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/4/8. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoPacket : NSObject 15 | 16 | @property(nonatomic, weak, readonly) NSData *data; 17 | 18 | @property(nonatomic, assign) uint8_t *mData; 19 | @property(nonatomic, assign) int mSize; 20 | 21 | @property(nonatomic, assign) int64_t pts; 22 | @property(nonatomic, assign) int64_t dts; 23 | 24 | 25 | - (instancetype)initWithData:(uint8_t *)mData size:(UInt32)mSize; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/Packet/DVVideoPacket.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoPacket.m 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/4/8. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVVideoPacket.h" 10 | 11 | @implementation DVVideoPacket 12 | 13 | - (instancetype)initWithData:(uint8_t *)mData size:(UInt32)mSize { 14 | self = [super init]; 15 | if (self) { 16 | _mData = (uint8_t *)malloc(mSize * sizeof(uint8_t)); 17 | memcpy(_mData, mData, mSize); 18 | _mSize = mSize; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)dealloc 24 | { 25 | free(_mData); 26 | _mData = nil; 27 | } 28 | 29 | - (NSData *)data { 30 | // 不复制 data内存,只存指针地址 31 | return [NSData dataWithBytesNoCopy:_mData length:_mSize freeWhenDone:NO]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/Utils/DVVideoUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoUtils.h 3 | // DVAVKit 4 | // 5 | // Created by DV on 2019/4/1. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoUtils : NSObject 15 | 16 | + (UIImage *)convertToImageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer; 17 | 18 | + (void)saveVideoToPhotoAlbum:(NSString *)filePath completion:(void(^)(BOOL finished))completion; 19 | 20 | + (void)saveImageToPhotoAlbum:(UIImage *)image completion:(void (^)(BOOL finished))completion; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/VideoCoder/DVVideoCoderKit.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // DVVideoCoderKit.h 4 | // iOS_Test 5 | // 6 | // Created by DV on 2019/10/9. 7 | // Copyright © 2019 iOS. All rights reserved. 8 | // 9 | 10 | #ifndef DVVideoCoderKit_h 11 | #define DVVideoCoderKit_h 12 | 13 | #import "DVVideoH264HardwareEncoder.h" 14 | #import "DVVideoHEVCHardwareEncoder.h" 15 | 16 | #import "DVVideoH264HardwareDecoder.h" 17 | #import "DVVideoHEVCHardwareDecoder.h" 18 | 19 | #endif /* DVVideoCoderKit_h */ 20 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/VideoCoder/DVVideoDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoDecoder.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/9. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "DVVideoConfig.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | #pragma mark - <-------------------- DVVideoEncoderDelegate --------------------> 16 | @protocol DVVideoDecoder; 17 | @protocol DVVideoDecoderDelegate 18 | 19 | - (void)DVVideoDecoder:(id)decoder 20 | decodecBuffer:(nullable CMSampleBufferRef)buffer 21 | isFirstFrame:(BOOL)isFirstFrame 22 | userInfo:(nullable void *)userInfo; 23 | 24 | @end 25 | 26 | 27 | #pragma mark - <-------------------- DVVideoEncoder --------------------> 28 | @protocol DVVideoDecoder 29 | @optional 30 | 31 | @property(nonatomic, weak) id delegate; 32 | 33 | - (void)decodeVideoData:(NSData *)data 34 | pts:(int64_t)pts 35 | dts:(int64_t)dts 36 | fps:(int)fps 37 | userInfo:(nullable void *)userInfo; 38 | 39 | - (void)closeDecoder; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/VideoCoder/Decoder/DVVideoH264HardwareDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoH264HardwareDecoder.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/23. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVVideoDecoder.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoH264HardwareDecoder : NSObject 15 | 16 | #pragma mark - <-- Initializer --> 17 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 18 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 19 | 20 | - (instancetype)initWithSps:(NSData *)sps 21 | pps:(NSData *)pps 22 | delegate:(id)delegate; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/VideoCoder/Decoder/DVVideoHEVCHardwareDecoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoHEVCHardwareDecoder.h 3 | // DVAVKit 4 | // 5 | // Created by 施达威 on 2019/3/23. 6 | // Copyright © 2019 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVVideoDecoder.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoHEVCHardwareDecoder : NSObject 15 | 16 | #pragma mark - <-- Initializer --> 17 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 18 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 19 | 20 | - (instancetype)initWithVps:(NSData *)vps 21 | sps:(NSData *)sps 22 | pps:(NSData *)pps 23 | delegate:(id)delegate; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/VideoCoder/Encoder/DVVideoH264HardwareEncoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoH264HardwareEncoder.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/11. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVVideoEncoder.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoH264HardwareEncoder : NSObject 15 | 16 | #pragma mark - <-- Initializer --> 17 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 18 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Utils/VideoTool/VideoCoder/Encoder/DVVideoHEVCHardwareEncoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVVideoHEVCHardwareEncoder.h 3 | // iOS_Test 4 | // 5 | // Created by DV on 2019/10/11. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVVideoEncoder.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVVideoHEVCHardwareEncoder : NSObject 15 | 16 | #pragma mark - <-- Initializer --> 17 | - (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; 18 | + (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavcodec/jni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JNI public API functions 3 | * 4 | * Copyright (c) 2015-2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_JNI_H 24 | #define AVCODEC_JNI_H 25 | 26 | /* 27 | * Manually set a Java virtual machine which will be used to retrieve the JNI 28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning 29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer 30 | * however it will error out if you try to set a different Java VM. 31 | * 32 | * @param vm Java virtual machine 33 | * @param log_ctx context used for logging, can be NULL 34 | * @return 0 on success, < 0 otherwise 35 | */ 36 | int av_jni_set_java_vm(void *vm, void *log_ctx); 37 | 38 | /* 39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm. 40 | * 41 | * @param vm Java virtual machine 42 | * @return a pointer to the Java virtual machine 43 | */ 44 | void *av_jni_get_java_vm(void *log_ctx); 45 | 46 | #endif /* AVCODEC_JNI_H */ 47 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_adler32 24 | * Public header for Adler-32 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_ADLER32_H 28 | #define AVUTIL_ADLER32_H 29 | 30 | #include 31 | #include "attributes.h" 32 | 33 | /** 34 | * @defgroup lavu_adler32 Adler-32 35 | * @ingroup lavu_hash 36 | * Adler-32 hash function implementation. 37 | * 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Calculate the Adler32 checksum of a buffer. 43 | * 44 | * Passing the return value to a subsequent av_adler32_update() call 45 | * allows the checksum of multiple buffers to be calculated as though 46 | * they were concatenated. 47 | * 48 | * @param adler initial checksum value 49 | * @param buf pointer to input buffer 50 | * @param len size of input buffer 51 | * @return updated checksum 52 | */ 53 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 54 | unsigned int len) av_pure; 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | #endif /* AVUTIL_ADLER32_H */ 61 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffconf */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 1 6 | #endif /* AVUTIL_AVCONFIG_H */ 7 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated by version.sh, do not manually edit! */ 2 | #ifndef AVUTIL_FFVERSION_H 3 | #define AVUTIL_FFVERSION_H 4 | #define FFMPEG_VERSION "3.4" 5 | #endif /* AVUTIL_FFVERSION_H */ 6 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/hwcontext_cuda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H 21 | #define AVUTIL_HWCONTEXT_CUDA_H 22 | 23 | #ifndef CUDA_VERSION 24 | #include 25 | #endif 26 | 27 | #include "pixfmt.h" 28 | 29 | /** 30 | * @file 31 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA. 32 | * 33 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 34 | * AVBufferRefs whose data pointer is a CUdeviceptr. 35 | */ 36 | 37 | typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal; 38 | 39 | /** 40 | * This struct is allocated as AVHWDeviceContext.hwctx 41 | */ 42 | typedef struct AVCUDADeviceContext { 43 | CUcontext cuda_ctx; 44 | AVCUDADeviceContextInternal *internal; 45 | } AVCUDADeviceContext; 46 | 47 | /** 48 | * AVHWFramesContext.hwctx is currently not used 49 | */ 50 | 51 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */ 52 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/hwcontext_qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_QSV_H 20 | #define AVUTIL_HWCONTEXT_QSV_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV. 27 | * 28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must 29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVQSVDeviceContext { 36 | mfxSession session; 37 | } AVQSVDeviceContext; 38 | 39 | /** 40 | * This struct is allocated as AVHWFramesContext.hwctx 41 | */ 42 | typedef struct AVQSVFramesContext { 43 | mfxFrameSurface1 *surfaces; 44 | int nb_surfaces; 45 | 46 | /** 47 | * A combination of MFX_MEMTYPE_* describing the frame pool. 48 | */ 49 | int frame_type; 50 | } AVQSVFramesContext; 51 | 52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */ 53 | 54 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/hwcontext_vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H 20 | #define AVUTIL_HWCONTEXT_VDPAU_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. 27 | * 28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 29 | * AVBufferRefs whose data pointer is a VdpVideoSurface. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVVDPAUDeviceContext { 36 | VdpDevice device; 37 | VdpGetProcAddress *get_proc_address; 38 | } AVVDPAUDeviceContext; 39 | 40 | /** 41 | * AVHWFramesContext.hwctx is currently not used 42 | */ 43 | 44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */ 45 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | /** 29 | * @addtogroup preproc_misc Preprocessor String Macros 30 | * 31 | * String manipulation macros 32 | * 33 | * @{ 34 | */ 35 | 36 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 37 | #define AV_TOSTRING(s) #s 38 | 39 | #define AV_GLUE(a, b) a ## b 40 | #define AV_JOIN(a, b) AV_GLUE(a, b) 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | #define AV_PRAGMA(s) _Pragma(#s) 47 | 48 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) 49 | 50 | #endif /* AVUTIL_MACROS_H */ 51 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/random_seed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Baptiste Coudurier 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libavutil/replaygain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_REPLAYGAIN_H 20 | #define AVUTIL_REPLAYGAIN_H 21 | 22 | #include 23 | 24 | /** 25 | * ReplayGain information (see 26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 27 | * The size of this struct is a part of the public ABI. 28 | */ 29 | typedef struct AVReplayGain { 30 | /** 31 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 32 | * Should be set to INT32_MIN when unknown. 33 | */ 34 | int32_t track_gain; 35 | /** 36 | * Peak track amplitude, with 100000 representing full scale (but values 37 | * may overflow). 0 when unknown. 38 | */ 39 | uint32_t track_peak; 40 | /** 41 | * Same as track_gain, but for the whole album. 42 | */ 43 | int32_t album_gain; 44 | /** 45 | * Same as track_peak, but for the whole album, 46 | */ 47 | uint32_t album_peak; 48 | } AVReplayGain; 49 | 50 | #endif /* AVUTIL_REPLAYGAIN_H */ 51 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/include/libswresample/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SWRESAMPLE_VERSION_H 22 | #define SWRESAMPLE_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #include "libavutil/avutil.h" 30 | 31 | #define LIBSWRESAMPLE_VERSION_MAJOR 2 32 | #define LIBSWRESAMPLE_VERSION_MINOR 9 33 | #define LIBSWRESAMPLE_VERSION_MICRO 100 34 | 35 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ 36 | LIBSWRESAMPLE_VERSION_MINOR, \ 37 | LIBSWRESAMPLE_VERSION_MICRO) 38 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ 39 | LIBSWRESAMPLE_VERSION_MINOR, \ 40 | LIBSWRESAMPLE_VERSION_MICRO) 41 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT 42 | 43 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) 44 | 45 | #endif /* SWRESAMPLE_VERSION_H */ 46 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavcodec.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavcodec.a -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavdevice.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavdevice.a -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavformat.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavformat.a -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavutil.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libavutil.a -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libswresample.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libswresample.a -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libswscale.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKit/DVAVKit/Vendor/FFmpeg-iOS/lib/libswscale.a -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/pili-librtmp/error.c: -------------------------------------------------------------------------------- 1 | #include "error.h" 2 | #include 3 | #include 4 | 5 | void RTMPError_Alloc(RTMPError *error, size_t msg_size) { 6 | RTMPError_Free(error); 7 | 8 | error->code = 0; 9 | error->message = (char *)malloc(msg_size + 1); 10 | memset(error->message, 0, msg_size); 11 | } 12 | 13 | void RTMPError_Free(RTMPError *error) { 14 | if (error) { 15 | if (error->message) { 16 | free(error->message); 17 | error->message = NULL; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/pili-librtmp/error.h: -------------------------------------------------------------------------------- 1 | #ifndef __ERROR_H__ 2 | #define __ERROR_H__ 3 | 4 | #include 5 | 6 | typedef struct RTMPError { 7 | int code; 8 | char *message; 9 | } RTMPError; 10 | 11 | void RTMPError_Alloc(RTMPError *error, size_t msg_size); 12 | void RTMPError_Free(RTMPError *error); 13 | 14 | // error defines 15 | enum { 16 | RTMPErrorUnknow = -1, // "Unknow error" 17 | RTMPErrorUnknowOption = -999, // "Unknown option %s" 18 | RTMPErrorAccessDNSFailed = -1000, // "Failed to access the DNS. (addr: %s)" 19 | RTMPErrorFailedToConnectSocket = 20 | -1001, // "Failed to connect socket. %d (%s)" 21 | RTMPErrorSocksNegotiationFailed = -1002, // "Socks negotiation failed" 22 | RTMPErrorFailedToCreateSocket = 23 | -1003, // "Failed to create socket. %d (%s)" 24 | RTMPErrorHandshakeFailed = -1004, // "Handshake failed" 25 | RTMPErrorRTMPConnectFailed = -1005, // "RTMP connect failed" 26 | RTMPErrorSendFailed = -1006, // "Send error %d (%s), (%d bytes)" 27 | RTMPErrorServerRequestedClose = -1007, // "RTMP server requested close" 28 | RTMPErrorNetStreamFailed = -1008, // "NetStream failed" 29 | RTMPErrorNetStreamPlayFailed = -1009, // "NetStream play failed" 30 | RTMPErrorNetStreamPlayStreamNotFound = 31 | -1010, // "NetStream play stream not found" 32 | RTMPErrorNetConnectionConnectInvalidApp = 33 | -1011, // "NetConnection connect invalip app" 34 | RTMPErrorSanityFailed = 35 | -1012, // "Sanity failed. Trying to send header of type: 0x%02X" 36 | RTMPErrorSocketClosedByPeer = -1013, // "RTMP socket closed by peer" 37 | RTMPErrorRTMPConnectStreamFailed = -1014, // "RTMP connect stream failed" 38 | RTMPErrorSocketTimeout = -1015, // "RTMP socket timeout" 39 | 40 | // SSL errors 41 | RTMPErrorTLSConnectFailed = -1200, // "TLS_Connect failed" 42 | RTMPErrorNoSSLOrTLSSupport = -1201, // "No SSL/TLS support" 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKit/Vendor/pili-librtmp/http.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTMP_HTTP_H__ 2 | #define __RTMP_HTTP_H__ 3 | /* 4 | * Copyright (C) 2010 Howard Chu 5 | * Copyright (C) 2010 Antti Ajanki 6 | * 7 | * This file is part of librtmp. 8 | * 9 | * librtmp is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as 11 | * published by the Free Software Foundation; either version 2.1, 12 | * or (at your option) any later version. 13 | * 14 | * librtmp is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with librtmp see the file COPYING. If not, write to 21 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 | * Boston, MA 02110-1301, USA. 23 | * http://www.gnu.org/copyleft/lgpl.html 24 | */ 25 | 26 | typedef enum { 27 | HTTPRES_OK, /* result OK */ 28 | HTTPRES_OK_NOT_MODIFIED, /* not modified since last request */ 29 | HTTPRES_NOT_FOUND, /* not found */ 30 | HTTPRES_BAD_REQUEST, /* client error */ 31 | HTTPRES_SERVER_ERROR, /* server reported an error */ 32 | HTTPRES_REDIRECTED, /* resource has been moved */ 33 | HTTPRES_LOST_CONNECTION /* connection lost while waiting for data */ 34 | } HTTPResult; 35 | 36 | struct HTTP_ctx { 37 | char *date; 38 | int size; 39 | int status; 40 | void *data; 41 | }; 42 | 43 | typedef size_t(HTTP_read_callback)(void *ptr, size_t size, size_t nmemb, 44 | void *stream); 45 | 46 | HTTPResult HTTP_get(struct HTTP_ctx *http, const char *url, 47 | HTTP_read_callback *cb); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /DVAVKit/DVAVKitBundle/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | NSHumanReadableCopyright 22 | Copyright © 2019 DVKit. All rights reserved. 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo.xcodeproj/project.xcworkspace/xcuserdata/mlgPro.xcuserdatad/IDEFindNavigatorScopes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo.xcodeproj/project.xcworkspace/xcuserdata/mlgPro.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo.xcodeproj/project.xcworkspace/xcuserdata/mlgPro.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo.xcodeproj/xcuserdata/mlgPro.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DVAVKitDemo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | FF90E1AF241F615F00BCA018 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/AOP/AOPKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // AOPKit.h 3 | // iOS_Template_Objc 4 | // 5 | // Created by DV on 2019/8/21. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef AOPKit_h 10 | #define AOPKit_h 11 | 12 | #import "UIViewController+AOP.h" 13 | 14 | 15 | #endif /* AOPKit_h */ 16 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/AOP/UIViewController+AOP.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+AOP.h 3 | // French 4 | // 5 | // Created by DV on 2019/7/31. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIViewController (AOP) 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/AppDelegate/AppDelegate+Notification.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate+Notification.h 3 | // MM 4 | // 5 | // Created by DV on 2019/8/27. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AppDelegate (Notification) 14 | 15 | /// 添加全局通知监听 16 | - (void)addGlobalNotification; 17 | 18 | /// 移除全局通知监听,一般情况下不用移除 19 | - (void)removeGlobalNotification; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/AppDelegate/AppDelegate+UISetting.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate+UISetting.h 3 | // 4 | // Created by David.Shi on 2018/1/27. 5 | // Copyright © 2018年 iOS. All rights reserved. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface AppDelegate (UISetting) 13 | 14 | /// 全局UI设置 15 | - (void)UISetting; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/AppDelegate/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DVDataBindDemo 4 | // 5 | // Created by David.Shi on 2018/3/16. 6 | // Copyright © 2018 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/AppDelegate/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DVDataBindDemo 4 | // 5 | // Created by David.Shi on 2018/3/16. 6 | // Copyright © 2018 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "RootNavigationController.h" 11 | #import "MainViewController.h" 12 | #import "AppDelegate+UISetting.h" 13 | #import "AppDelegate+Notification.h" 14 | 15 | @interface AppDelegate () 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | 24 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 25 | [self.window setBackgroundColor:[UIColor whiteColor]]; 26 | [self initMainViewController:self.window]; 27 | [self.window makeKeyAndVisible]; 28 | 29 | [self UISetting]; 30 | [self addGlobalNotification]; 31 | 32 | return YES; 33 | } 34 | 35 | - (void)initMainViewController:(UIWindow *)window { 36 | MainViewController *mainVC = [[MainViewController alloc] init]; 37 | RootNavigationController *rootNC = [[RootNavigationController alloc] initWithRootViewController:mainVC]; 38 | 39 | [window setRootViewController:rootNC]; 40 | } 41 | 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/DVCategoryKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVCategoryKit.h 3 | // DVLibrary 4 | // 5 | // Created by DV on 2019/12/31. 6 | // Copyright © 2019 DVLibrary. All rights reserved. 7 | // 8 | 9 | #ifndef DVCategoryKit_h 10 | #define DVCategoryKit_h 11 | 12 | // UI 13 | #import "UIColor+Common.h" 14 | #import "UIColor+BaseColor.h" 15 | #import "UIImage+Common.h" 16 | #import "UIButton+Common.h" 17 | #import "UIBarButtonItem+Common.h" 18 | #import "UILabel+Common.h" 19 | #import "UIView+Common.h" 20 | #import "UITableView+Common.h" 21 | #import "UICollectionView+Common.h" 22 | #import "UITextField+Common.h" 23 | #import "UIViewController+Common.h" 24 | #import "UINavigationController+Common.h" 25 | #import "UITabBarController+Common.h" 26 | #import "UIToolbar+Common.h" 27 | #import "UIPanGestureRecognizer+Common.h" 28 | 29 | //#endif 30 | 31 | 32 | #endif /* DVCategoryKit_h */ 33 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIBarButtonItem+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItem+Common.h 3 | // French 4 | // 5 | // Created by DV on 2019/3/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIBarButtonItem (Common) 14 | 15 | + (instancetype)spaceItem; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIBarButtonItem+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItem+Common.m 3 | // French 4 | // 5 | // Created by DV on 2019/3/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "UIBarButtonItem+Common.h" 10 | 11 | @implementation UIBarButtonItem (Common) 12 | 13 | + (instancetype)spaceItem { 14 | return [[self alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIButton+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+Common.h 3 | // iOS_Template_Objc 4 | // 5 | // Created by DV on 2018/1/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIButton (Common) 12 | 13 | @property(nonatomic, strong) NSString *title; 14 | @property(nonatomic, strong) NSString *titleForHighlighted; 15 | 16 | @property(nonatomic, strong) UIImage *image; 17 | @property(nonatomic, strong) UIImage *imageForHighlighted; 18 | @property(nonatomic, strong) UIImage *imageForSelected; 19 | 20 | @property(nonatomic, strong) UIImage *backgroundImage; 21 | @property(nonatomic, strong) UIImage *backgroundImageForHighlighted; 22 | 23 | @property(nonatomic, strong) UIColor *titleColor; 24 | @property(nonatomic, strong) UIColor *titleColorForHighlighted; 25 | 26 | - (void)constraintToFit; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UICollectionView+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionView+Common.h 3 | // French 4 | // 5 | // Created by DV on 2019/3/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UICollectionView (Common) 14 | 15 | #pragma mark - <-- Method --> 16 | /** 17 | * 获取已注册的Cell,若为nil,自动初始化 18 | * @param cellClass 已注册Cell的类 19 | */ 20 | - (__kindof UICollectionViewCell *)dequeueReusableCellWithClass:(Class)cellClass 21 | forIndexPath:(NSIndexPath *)indexPath; 22 | 23 | /// 24 | - (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind 25 | withClass:(Class)viewClass 26 | forIndexPath:(NSIndexPath *)indexPath; 27 | 28 | /// 29 | - (void)registerClass:(Class)cellClass; 30 | 31 | /// 32 | - (void)registerClassForSectionHeader:(Class)viewClass; 33 | 34 | /// 35 | - (void)registerClassForSectionFooter:(Class)viewClass; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIColor+BaseColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+BaseColor.h 3 | // MM 4 | // 5 | // Created by DV on 2019/8/30. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIColor (BaseColor) 14 | 15 | #pragma mark - <-- 基础色 --> 16 | @property(nonatomic, class, readonly) UIColor *Blue; 17 | @property(nonatomic, class, readonly) UIColor *Blue1; 18 | @property(nonatomic, class, readonly) UIColor *Blue2; 19 | 20 | @property(nonatomic, class, readonly) UIColor *Green; 21 | @property(nonatomic, class, readonly) UIColor *Green1; 22 | @property(nonatomic, class, readonly) UIColor *Green2; 23 | 24 | @property(nonatomic, class, readonly) UIColor *Red; 25 | @property(nonatomic, class, readonly) UIColor *Red1; 26 | @property(nonatomic, class, readonly) UIColor *Red2; 27 | 28 | @property(nonatomic, class, readonly) UIColor *Orange; 29 | @property(nonatomic, class, readonly) UIColor *Orange1; 30 | @property(nonatomic, class, readonly) UIColor *Orange2; 31 | 32 | @property(nonatomic, class, readonly) UIColor *Gray; 33 | @property(nonatomic, class, readonly) UIColor *Gray1; 34 | @property(nonatomic, class, readonly) UIColor *Gray2; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIColor+BaseColor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+BaseColor.m 3 | // MM 4 | // 5 | // Created by DV on 2019/8/30. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "UIColor+BaseColor.h" 10 | 11 | @implementation UIColor (BaseColor) 12 | 13 | #pragma mark - <-- 基础色 --> 14 | + (UIColor *)Blue { 15 | return [UIColor colorWithHex:0x3489FF]; 16 | } 17 | 18 | + (UIColor *)Blue1 { 19 | return [UIColor colorWithHex:0x90C3FF]; 20 | } 21 | 22 | + (UIColor *)Blue2 { 23 | return [UIColor colorWithHex:0xE8F2FF]; 24 | } 25 | 26 | 27 | + (UIColor *)Green { 28 | return [UIColor colorWithHex:0x58BA2D]; 29 | } 30 | 31 | + (UIColor *)Green1 { 32 | return [UIColor colorWithHex:0xDAF1CF]; 33 | } 34 | 35 | + (UIColor *)Green2 { 36 | return [UIColor colorWithHex:0xEDF8E6]; 37 | } 38 | 39 | 40 | + (UIColor *)Orange { 41 | return [UIColor colorWithHex:0xDE912F]; 42 | } 43 | 44 | + (UIColor *)Orange1 { 45 | return [UIColor colorWithHex:0xF8E8CF]; 46 | } 47 | 48 | + (UIColor *)Orange2 { 49 | return [UIColor colorWithHex:0xFCF4E7]; 50 | } 51 | 52 | 53 | + (UIColor *)Red { 54 | return [UIColor colorWithHex:0xF05459]; 55 | } 56 | 57 | + (UIColor *)Red1 { 58 | return [UIColor colorWithHex:0xFCDADB]; 59 | } 60 | 61 | + (UIColor *)Red2 { 62 | return [UIColor colorWithHex:0xFDECEC]; 63 | } 64 | 65 | 66 | + (UIColor *)Gray { 67 | return [UIColor colorWithHex:0x7E8087]; 68 | } 69 | 70 | + (UIColor *)Gray1 { 71 | return [UIColor colorWithHex:0xE4E3E6]; 72 | } 73 | 74 | + (UIColor *)Gray2 { 75 | return [UIColor colorWithHex:0xF1F1F2]; 76 | } 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIColor+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Common.h 3 | // iOS_Template_Objc 4 | // 5 | // Created by DV on 2018/1/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (Common) 12 | 13 | #pragma mark - <-- Property --> 14 | /// UIColor 颜色调至暗点 15 | @property(nonatomic, strong, readonly) UIColor *darkColor; 16 | 17 | /// UIColor 随机颜色 18 | @property(nonatomic, class, readonly) UIColor *randomColor; 19 | 20 | /// UIColor 转换为 RGB 21 | @property(nonatomic, strong, readonly) NSArray *RGB; 22 | 23 | 24 | #pragma mark - <-- Instance --> 25 | /** 26 | * RGB 转换为 UIColor 27 | * @param rgba @[@(r),@(g),@(b),@(alpha)] 28 | * r g b 类型:float 取值范围:[0,255] 29 | * alpha 类型:float 取值范围:[0,1] 可选写 30 | * 举例: [UIColor colorWithRGB: @[@(1),@(2),@(3),@(0.4)]]; 31 | */ 32 | + (instancetype)colorWithRGBA:(NSArray *)rgba; 33 | 34 | /** 35 | * 16进制 转为 UIColor 36 | * @param hex 16进制 0x000000 37 | * @return UIColor 38 | */ 39 | + (instancetype)colorWithHex:(UInt32)hex; 40 | 41 | /** 42 | * 16进制 转换为 UIColor 43 | * @param hex 16进制 0x000000 44 | * @param opacity 透明度 45 | * @return UIColor 46 | */ 47 | + (instancetype)colorWithHex:(UInt32)hex alpha:(float)opacity; 48 | 49 | /** 50 | * 16进制颜色(html颜色值)字符串 转为 UIColor 51 | * @param hexString 16进制字符串 @"0x000000" @"#000000" 52 | * @return UIColor 53 | */ 54 | + (instancetype)colorWithHexString:(NSString *)hexString; 55 | 56 | /** 57 | * 16进制颜色(html颜色值)字符串 转为 UIColor 58 | * @param hexString 16进制字符串 @"0x000000" @"#000000" 59 | * @param opacity 透明度 60 | * @return UIColor 61 | */ 62 | + (instancetype)colorWithHexString:(NSString *)hexString alpha:(float)opacity; 63 | 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIImage+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Common.h 3 | // 4 | // 5 | // Created by DV on 2019/2/25. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIImage (Common) 14 | 15 | #pragma mark - <-- Instance --> 16 | + (instancetype)imageWithColor:(UIColor *)color; 17 | 18 | + (instancetype)imageWithColor:(UIColor *)color size:(CGSize)size; 19 | 20 | /// 渲染模式:Original 21 | + (instancetype)imageWithOriginal:(NSString *)name; 22 | 23 | 24 | #pragma mark - <-- Method --> 25 | /// 根据面积 改变图片尺寸 26 | - (UIImage *)resizeImageWithSize:(CGSize)size; 27 | 28 | /// 根据比例 改变图片尺寸 29 | - (UIImage *)resizeImageWithScale:(CGFloat)scale; 30 | 31 | /// 剪切成圆形 32 | - (UIImage *)clipToCircleImage; 33 | 34 | - (UIImage *)addText:(NSString *)text fontColor:(UIColor *)fontColor fontSize:(CGFloat)fontSize; 35 | 36 | /// 保存至系统相册 37 | - (void)saveToPhotoAlbum:(nullable void(^)(BOOL finished))completion; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UILabel+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+DV.h 3 | // 4 | // 5 | // Created by 施达威 on 2018/2/8. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (Common) 12 | 13 | @property(nonatomic, assign) CGFloat fontSize; 14 | 15 | - (CGFloat)heightFromFitWidth:(CGFloat)width; 16 | 17 | 18 | /// 自动根据宽度适应字间距 19 | - (void)wordSpaceToFitWidth:(CGFloat)width; 20 | 21 | 22 | /// 改变行间距 23 | - (void)changeLineSpace:(float)space; 24 | 25 | /// 改变字间距 26 | - (void)changeWordSpace:(float)space; 27 | 28 | /// 改变行间距和字间距 29 | - (void)changeLineSpace:(float)lineSpace wordSpace:(float)wordSpace; 30 | 31 | - (void)addUnderLineWithString:(NSString *)string; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UINavigationController+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+DV.h 3 | // 4 | // 5 | // Created by DV on 2018/2/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationController (Common) 12 | 13 | #pragma mark - <-- Method --> 14 | - (void)pushViewControllerWithStoryBoard:(NSString *)storyBoardName 15 | identifier:(NSString *)identifier 16 | animated:(BOOL)flag; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UINavigationController+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+DV.m 3 | // 4 | // 5 | // Created by DV on 2018/2/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import "UINavigationController+Common.h" 10 | 11 | @implementation UINavigationController (Common) 12 | 13 | - (void)pushViewControllerWithStoryBoard:(NSString *)storyBoardName 14 | identifier:(NSString *)identifier 15 | animated:(BOOL)flag { 16 | UIStoryboard *sb = [UIStoryboard storyboardWithName:storyBoardName bundle:nil]; 17 | UIViewController *vc = [sb instantiateViewControllerWithIdentifier:identifier]; 18 | [self pushViewController:vc animated:flag]; 19 | } 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIPanGestureRecognizer+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPanGestureRecognizer+Common.h 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2020/1/18. 6 | // Copyright © 2020 DVKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIPanGestureRecognizer (Common) 14 | 15 | - (void)setXTranslationWithView:(UIView *)view; 16 | - (void)setYTranslationWithView:(UIView *)view; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIPanGestureRecognizer+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIPanGestureRecognizer+Common.m 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2020/1/18. 6 | // Copyright © 2020 DVKit. All rights reserved. 7 | // 8 | 9 | #import "UIPanGestureRecognizer+Common.h" 10 | 11 | @implementation UIPanGestureRecognizer (Common) 12 | 13 | - (void)setXTranslationWithView:(UIView *)view { 14 | CGPoint transPoint = [self translationInView:view]; 15 | view.transform = CGAffineTransformTranslate(view.transform, transPoint.x, 0); 16 | [self setTranslation:CGPointZero inView:view]; 17 | } 18 | 19 | - (void)setYTranslationWithView:(UIView *)view { 20 | CGPoint transPoint = [self translationInView:view]; 21 | view.transform = CGAffineTransformTranslate(view.transform, 0, transPoint.y); 22 | [self setTranslation:CGPointZero inView:view]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UITabBarController+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarController+Common.h 3 | // French 4 | // 5 | // Created by DV on 2019/3/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Define --------------------> 14 | @protocol UITabBarControllerDataSource 15 | 16 | - (NSUInteger)numberOfTabItems; 17 | 18 | - (UIViewController *)tabItemAtIndex:(NSUInteger)index; 19 | 20 | @end 21 | 22 | 23 | #pragma mark - <-------------------- Class --------------------> 24 | @interface UITabBarController (Common) 25 | 26 | @property(nonatomic, weak) id dataSource; 27 | 28 | - (void)reload; 29 | 30 | - (void)setTabBarItems:(NSArray *)viewControllers; 31 | - (void)insertTabItem:(UIViewController *)viewController atIndex:(NSInteger)index; 32 | - (void)insertTabItemAtFirst:(UIViewController *)viewController; 33 | - (void)insertTabItemAtLast:(UIViewController *)viewController; 34 | 35 | - (void)removeAllTabItems; 36 | - (void)removeTabItem:(NSInteger)index; 37 | - (void)removeFirstTabItem; 38 | - (void)removeLastTabItem; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UITableView+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+DV.h 3 | // 4 | // 5 | // Created by DV on 2018/2/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #pragma mark - <-------------------- UITableView (Common) --------------------> 12 | @interface UITableView (Common) 13 | 14 | /** 15 | * 获取已注册的Cell,若为nil,自动初始化 16 | * @param cellClass 已注册Cell的类 17 | */ 18 | - (__kindof UITableViewCell *)dequeueReusableCellWithClass:(Class)cellClass 19 | forIndexPath:(NSIndexPath *)indexPath; 20 | 21 | - (void)registerClass:(Class)cellClass; 22 | 23 | - (void)registerNibWithClass:(Class)cellClass; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UITableView+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+DV.m 3 | // 4 | // 5 | // Created by DV on 2018/2/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import "UITableView+Common.h" 10 | 11 | @implementation UITableView (Common) 12 | 13 | - (UITableViewCell *)dequeueReusableCellWithClass:(Class)cellClass forIndexPath:(NSIndexPath *)indexPath { 14 | UITableViewCell *cell = [self dequeueReusableCellWithIdentifier:NSStringFromClass(cellClass) 15 | forIndexPath:indexPath]; 16 | 17 | return cell ? cell : [[cellClass alloc] initWithStyle:UITableViewCellStyleDefault 18 | reuseIdentifier:NSStringFromClass(cellClass)]; 19 | } 20 | 21 | - (void)registerClass:(Class)cellClass { 22 | [self registerClass:cellClass forCellReuseIdentifier:NSStringFromClass(cellClass)]; 23 | } 24 | 25 | - (void)registerNibWithClass:(Class)cellClass { 26 | NSString *cellName = NSStringFromClass(cellClass); 27 | UINib *nib = [UINib nibWithNibName:cellName bundle:nil]; 28 | [self registerNib:nib forCellReuseIdentifier:cellName]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UITextField+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+DV.h 3 | // 4 | // 5 | // Created by DV on 2018/2/9. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UITextField (Common) 12 | 13 | ///自动隐藏键盘 14 | @property(nonatomic, assign) BOOL isHiddenKeyBoardByReturnKeyDone; 15 | 16 | ///增加左边View 17 | - (void)addLeftView:(UIView *)view; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UITextField+Common.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // UITextField+DV.m 4 | // 5 | // 6 | // Created by DV on 2018/2/9. 7 | // Copyright © 2018年 iOS. All rights reserved. 8 | // 9 | 10 | #import "UITextField+Common.h" 11 | 12 | @implementation UITextField (Common) 13 | 14 | #pragma mark - <-- Property --> 15 | - (BOOL)isHiddenKeyBoardByReturnKeyDone { 16 | return [self targetForAction:@selector(handleKeyboardHiddenEvent:) withSender:self] != nil; 17 | } 18 | 19 | - (void)setIsHiddenKeyBoardByReturnKeyDone:(BOOL)isHiddenKeyBoardByReturnKeyDone { 20 | if (isHiddenKeyBoardByReturnKeyDone == YES) { 21 | self.returnKeyType = UIReturnKeyDone; 22 | [self addTarget:self action:@selector(handleKeyboardHiddenEvent:) forControlEvents:UIControlEventEditingDidEndOnExit]; 23 | } else { 24 | self.returnKeyType = UIReturnKeyDefault; 25 | [self removeTarget:self action:@selector(handleKeyboardHiddenEvent:) forControlEvents:UIControlEventEditingDidEndOnExit]; 26 | } 27 | } 28 | 29 | - (void)handleKeyboardHiddenEvent:(id)sender { 30 | [self resignFirstResponder]; 31 | } 32 | 33 | 34 | #pragma mark - <-- Method --> 35 | - (void)addLeftView:(UIView *)view { 36 | UIView *leftView = self.leftView != nil ? self.leftView : [[UIView alloc] init]; 37 | 38 | if (self.leftView != nil) { 39 | view.frame = CGRectMake(leftView.width, 0, view.width, self.height); 40 | leftView.frame = CGRectMake(0, 0, leftView.width+view.width, self.height); 41 | } else { 42 | view.frame = CGRectMake(0, 0, view.width, self.height); 43 | leftView.frame = CGRectMake(0, 0, view.width, self.height); 44 | } 45 | 46 | [leftView addSubview:view]; 47 | self.leftView = leftView; 48 | self.leftViewMode = UITextFieldViewModeAlways; 49 | } 50 | 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIToolbar+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIToolbar+Common.h 3 | // French 4 | // 5 | // Created by DV on 2019/3/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIToolbar (Common) 14 | 15 | - (void)spaceToFit; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIToolbar+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIToolbar+Common.m 3 | // French 4 | // 5 | // Created by DV on 2019/3/29. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "UIToolbar+Common.h" 10 | 11 | @implementation UIToolbar (Common) 12 | 13 | - (void)spaceToFit { 14 | if (self.items && self.items.count > 1) { 15 | NSUInteger count = self.items.count * 2 - 1; 16 | 17 | UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 18 | NSMutableArray *items = [self.items mutableCopy]; 19 | 20 | for (NSUInteger i = 1; i < count; i+=2) { 21 | [items insertObject:spaceItem atIndex:i]; 22 | } 23 | 24 | [self setItems:[items copy] animated:NO]; 25 | } 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIView+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Common.h 3 | // iOS_Template_Objc 4 | // 5 | // Created by DV on 2018/1/10. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (Common) 12 | 13 | #pragma mark - <-- Frame --> 14 | @property(nonatomic, assign, readonly) CGFloat x; 15 | @property(nonatomic, assign, readonly) CGFloat y; 16 | 17 | @property(nonatomic, assign, readonly) CGFloat width; 18 | @property(nonatomic, assign, readonly) CGFloat height; 19 | 20 | @property(nonatomic, assign, readonly) CGFloat minX; 21 | @property(nonatomic, assign, readonly) CGFloat midX; 22 | @property(nonatomic, assign, readonly) CGFloat maxX; 23 | 24 | @property(nonatomic, assign, readonly) CGFloat minY; 25 | @property(nonatomic, assign, readonly) CGFloat midY; 26 | @property(nonatomic, assign, readonly) CGFloat maxY; 27 | 28 | @property(nonatomic, assign, readonly) CGPoint origin; 29 | @property(nonatomic, assign, readonly) CGSize size; 30 | 31 | @property(nonatomic, assign) BOOL isDisplay; 32 | 33 | @property(nonatomic, assign, readonly) CGRect lastFrame; 34 | 35 | 36 | #pragma mark - <-- Common --> 37 | ///截图 38 | @property(nonatomic, strong, readonly) UIImage *screenShotImage; 39 | 40 | + (instancetype)viewWithNib; 41 | 42 | ///显示边框 43 | - (void)showBorder; 44 | 45 | - (void)showAllSubViewBorder; 46 | 47 | - (void)addShadow:(UIColor *)shadowColor frame:(CGRect)frame; 48 | 49 | - (void)updateSubViewLayout:(NSArray<__kindof UIView *> *)subViews margin:(CGFloat)margin; 50 | 51 | - (void)layoutIfNeededForSafeArea; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Category/UI/UIViewController+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Common.h 3 | // iOS_Template_Objc 4 | // 5 | // Created by DV on 2018/1/10. 6 | // Copyright © 2018年 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIViewController (Common) 14 | 15 | #pragma mark - <-- Property --> 16 | /** 导航栏是否隐藏 */ 17 | @property(nonatomic, assign) BOOL isHiddenNavBar; 18 | 19 | /** 导航栏透明度 */ 20 | @property(nonatomic, assign) CGFloat navBarAlpha; 21 | 22 | 23 | #pragma mark - <-- Method --> 24 | + (instancetype)viewControlWithStoryBoard; 25 | 26 | + (instancetype)storyBoardWithName:(NSString *)storyBoardName identifier:(NSString *)identifier; 27 | 28 | - (void)presentViewControllerWithStoryBoard:(NSString *)storyBoardName 29 | identifier:(NSString *)identifier 30 | animated:(BOOL)flag 31 | completion:(void (^ __nullable)(void))completion; 32 | 33 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; 34 | 35 | - (void)pushViewControllerWithClassName:(NSString *)className animated:(BOOL)animated; 36 | 37 | - (void)popViewControllerAnimated:(BOOL)animated; 38 | 39 | - (void)setTabBarItemWithTitle:(NSString *)title 40 | fontSize:(CGFloat)fontSize 41 | image:(UIImage *)image; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Define/Header.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Header.pch 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #ifndef Header_pch 10 | #define Header_pch 11 | 12 | #import "DVCategoryKit.h" 13 | #import "DVFrame.h" 14 | #import "DVInfo.h" 15 | #import "DVManager.h" 16 | #import "DVRuntimeKit.h" 17 | #import "AOPKit.h" 18 | #import "DVGCDKit.h" 19 | #import "DVColor.h" 20 | #import "DVNoticeViewKit.h" 21 | #import 22 | 23 | #endif /* Header_pch */ 24 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Manager/DVAPPManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVAPPManager.h 3 | // 4 | // 5 | // Created by mlgPro on 2019/2/28. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DVAPPManager : NSObject 15 | 16 | #pragma mark - <-- Property --> 17 | @property(nonatomic, weak) AppDelegate *appDelegate; 18 | 19 | /// 当前ViewController 20 | @property(nonatomic, weak) UIViewController *currentViewController; 21 | 22 | @property(nonatomic, weak) UIViewController *topViewController; 23 | 24 | @property(nonatomic, strong) NSMutableArray *viewControllerStack; 25 | 26 | #pragma mark - <-- SharedInstance --> 27 | + (instancetype)sharedInstance; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Manager/DVAPPManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVAPPManager.m 3 | // 4 | // 5 | // Created by mlgPro on 2019/2/28. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVAPPManager.h" 10 | 11 | @implementation DVAPPManager 12 | 13 | + (instancetype)sharedInstance { 14 | static dispatch_once_t onceToken; 15 | static DVAPPManager *instance = nil; 16 | dispatch_once(&onceToken,^{ 17 | instance = [[super allocWithZone:NULL] init]; 18 | }); 19 | return instance; 20 | } 21 | 22 | + (id)allocWithZone:(struct _NSZone *)zone{ 23 | return [self sharedInstance]; 24 | } 25 | 26 | 27 | #pragma mark - <-- Property --> 28 | - (NSMutableArray *)viewControllerStack { 29 | if (!_viewControllerStack) { 30 | _viewControllerStack = [NSMutableArray array]; 31 | } 32 | return _viewControllerStack; 33 | } 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Manager/DVManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVManager.h 3 | // 4 | // 5 | // Created by mlgPro on 2018/1/9. 6 | // Copyright © 2018年 com.znjk.test. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVAPPManager.h" 11 | 12 | 13 | /** 14 | * APP运行时 生命周期内 数据管理 数据缓存 中间态 其他类型管理 15 | * APP关闭将失去所有数据 不保存 16 | * APP 中间件管理 17 | */ 18 | //TODO: Manager 尽量是 变量 或者 实现Delegate 的 服务管理 类,尽量少写方法,方法封装成工具类 19 | @interface DVManager : NSObject 20 | 21 | /// APP管理 22 | @property(nonatomic, class, readonly) DVAPPManager *app; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Manager/DVManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVManager.m 3 | // 4 | // 5 | // Created by mlgPro on 2018/1/9. 6 | // Copyright © 2018年 com.znjk.test. All rights reserved. 7 | // 8 | 9 | #import "DVManager.h" 10 | 11 | @implementation DVManager 12 | 13 | + (DVAPPManager *)app { 14 | return [DVAPPManager sharedInstance]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Other/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DVDataBindDemo 4 | // 5 | // Created by David.Shi on 2018/3/16. 6 | // Copyright © 2018 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Project/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Project/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Resource/image/icon-dog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Resource/image/icon-dog.jpg -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Resource/image/password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Resource/image/password.png -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Resource/image/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Resource/image/user.png -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/MainViewController/View/MainTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainTableView.h 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @class MainTableView; 14 | @protocol MainTableViewDelegate 15 | 16 | - (void)MainTableView:(MainTableView *)view didSelectItem:(NSString *)item; 17 | 18 | @end 19 | 20 | 21 | @interface MainTableView : UITableView 22 | 23 | @property(nonatomic, weak) id mtvDelegate; 24 | @property(nonatomic, strong) NSDictionary *models; 25 | 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/MainViewController/ViewController/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface MainViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/MainViewController/ViewController/MainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.m 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "MainViewController.h" 10 | #import "MainTableView.h" 11 | #import "MainViewModel.h" 12 | 13 | @interface MainViewController () 14 | 15 | @property(nonatomic, strong) MainTableView *mainView; 16 | 17 | @property(nonatomic, strong) MainViewModel *mainViewModel; 18 | 19 | @end 20 | 21 | @implementation MainViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | 26 | 27 | [self initViews]; 28 | [self initModels]; 29 | [self loadData]; 30 | } 31 | 32 | #pragma mark - <-- Init --> 33 | - (void)initViews { 34 | self.mainView = ({ 35 | MainTableView *v; 36 | v = [[MainTableView alloc] initWithFrame:DVFrame.frame_not_nav]; 37 | v.mtvDelegate = self; 38 | v; 39 | }); 40 | 41 | [self.view addSubview:self.mainView]; 42 | } 43 | 44 | - (void)initModels { 45 | self.mainViewModel = [[MainViewModel alloc] init]; 46 | } 47 | 48 | - (void)loadData { 49 | self.mainView.models = self.mainViewModel.tableItems; 50 | } 51 | 52 | 53 | #pragma mark - <-- Delegate --> 54 | - (void)MainTableView:(MainTableView *)view didSelectItem:(NSString *)item { 55 | Class class = NSClassFromString(item); 56 | if (!class) return; 57 | 58 | __kindof UIViewController *vc = [[class alloc] init]; 59 | [self.navigationController pushViewController:vc animated:YES]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/MainViewController/ViewModel/MainViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewModel.h 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface MainViewModel : NSObject 14 | 15 | - (NSDictionary *)tableItems; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/MainViewController/ViewModel/MainViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewModel.m 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "MainViewModel.h" 10 | 11 | @implementation MainViewModel 12 | 13 | - (NSDictionary *)tableItems { 14 | return @{ 15 | @"直播" : @"LiveListViewController", 16 | @"录音" : @"RecordViewController", 17 | }; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/RootNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootNavigationController.h 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface RootNavigationController : UINavigationController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/RootNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootNavigationController.m 3 | // DVDataBindDemo 4 | // 5 | // Created by mlgPro on 2020/3/16. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "RootNavigationController.h" 10 | 11 | @interface RootNavigationController () 12 | 13 | @end 14 | 15 | @implementation RootNavigationController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | /* 23 | #pragma mark - Navigation 24 | 25 | // In a storyboard-based application, you will often want to do a little preparation before navigation 26 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 27 | // Get the new view controller using [segue destinationViewController]. 28 | // Pass the selected object to the new view controller. 29 | } 30 | */ 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/录音/ViewController/RecordViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RecordViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/9/11. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface RecordViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/H264 HEVC拉流/ViewController/H264HEVCLivePlayerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // H264LivePlayerViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "LivePlayerViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface H264HEVCLivePlayerViewController : LivePlayerViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/H264推流/ViewController/H264LiveViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // H264LiveViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "LiveViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface H264LiveViewController : LiveViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/HEVC推流/ViewController/HEVCLiveViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HEVCLiveViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "LiveViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HEVCLiveViewController : LiveViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/Template/LivePlayerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LivePlayerViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface LivePlayerViewController : UIViewController 14 | 15 | @property(nonatomic, copy) NSString *url; 16 | 17 | @property(nonatomic, strong) UIButton *btnRecord; 18 | @property(nonatomic, strong) UIButton *btnScreenShot; 19 | 20 | - (void)initBtnScreenShot; 21 | - (void)initBtnRecord; 22 | 23 | - (void)onClickForScreenShot:(UIButton *)sender; 24 | - (void)onClickForRecord:(UIButton *)sender; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/Template/LivePlayerViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/Template/LiveViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LiveViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface LiveViewController : UIViewController 14 | 15 | @property(nonatomic, copy) NSString *url; 16 | 17 | @property(nonatomic, strong) UIBarButtonItem *barBtn; 18 | 19 | @property(nonatomic, strong) UIButton *btnChangeCamera; 20 | - (void)initBtnChangeCamera; 21 | - (void)onClickForChangeCamera:(UIButton *)sender; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/Template/LiveViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LiveViewController.m 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "LiveViewController.h" 10 | 11 | @interface LiveViewController () 12 | 13 | @end 14 | 15 | @implementation LiveViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | self.barBtn = [[UIBarButtonItem alloc] initWithTitle:@"" style:(UIBarButtonItemStylePlain) target:nil action:nil]; 21 | self.navigationItem.rightBarButtonItem = self.barBtn; 22 | } 23 | 24 | - (void)viewWillAppear:(BOOL)animated { 25 | [super viewWillAppear:animated]; 26 | [UIApplication sharedApplication].idleTimerDisabled = YES; 27 | self.isHiddenNavBar = YES; 28 | } 29 | 30 | - (void)viewWillDisappear:(BOOL)animated { 31 | [super viewWillDisappear:animated]; 32 | [UIApplication sharedApplication].idleTimerDisabled = NO; 33 | self.isHiddenNavBar = NO; 34 | } 35 | 36 | 37 | - (void)initBtnChangeCamera { 38 | self.btnChangeCamera = ({ 39 | UIButton *b = [[UIButton alloc] initWithFrame:CGRectMake(self.view.width - 20 - 100, 40 | self.view.height - 80, 41 | 100, 42 | 40)]; 43 | b.title = @"翻转镜头"; 44 | b.titleColor = [UIColor whiteColor]; 45 | b.titleColorForHighlighted = [UIColor grayColor]; 46 | [b addTarget:self action:@selector(onClickForChangeCamera:) forControlEvents:UIControlEventTouchUpInside]; 47 | b; 48 | }); 49 | [self.view addSubview:self.btnChangeCamera]; 50 | } 51 | 52 | - (void)onClickForChangeCamera:(UIButton *)sender { 53 | 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/Template/LiveViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/View/LiveListView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LiveView.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface LiveListView : UIView 14 | @property (weak, nonatomic) IBOutlet UILabel *lblTitle; 15 | @property (weak, nonatomic) IBOutlet UITextField *liveURLText; 16 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/View/LiveListView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LiveView.m 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "LiveListView.h" 10 | 11 | @implementation LiveListView 12 | 13 | #pragma mark - <-- --> 14 | - (void)awakeFromNib { 15 | [super awakeFromNib]; 16 | 17 | } 18 | 19 | - (void)dealloc 20 | { 21 | if (_tableView) { 22 | _tableView.delegate = nil; 23 | _tableView.dataSource = nil; 24 | } 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/ViewController/LiveListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LiveViewController.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface LiveListViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/ViewModel/LiveListViewModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // LiveViewModel.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface LiveListViewModel : NSObject 14 | 15 | - (NSDictionary *)tableItems; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/ViewModel/LiveListViewModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // LiveViewModel.m 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "LiveListViewModel.h" 10 | 11 | @implementation LiveListViewModel 12 | 13 | - (NSDictionary *)tableItems { 14 | return @{ 15 | @"H264推流" : @"H264LiveViewController", 16 | @"HEVC推流" : @"HEVCLiveViewController", 17 | @"H264 HEVC拉流" : @"H264HEVCLivePlayerViewController", 18 | }; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/UI/直播/ViewModel/LiveTableDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // LiveTableDataSource.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/10. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - <-------------------- Protocol --------------------> 14 | @class LiveTableDataSource; 15 | @protocol LiveTableDelegate 16 | 17 | - (void)LiveTable:(LiveTableDataSource *)liveTable didSelectItem:(NSString *)item; 18 | 19 | @end 20 | 21 | 22 | #pragma mark - <-------------------- Class --------------------> 23 | @interface LiveTableDataSource : NSObject 24 | 25 | #pragma mark - <-- Property --> 26 | @property(nonatomic, weak) UITableView *tableView; 27 | 28 | @property(nonatomic, copy, readonly) NSString *identifier; 29 | @property(nonatomic, strong) NSDictionary *models; 30 | 31 | @property(nonatomic, weak) id delegate; 32 | 33 | 34 | #pragma mark - <-- Initializer --> 35 | - (instancetype)initWithTableView:(UITableView *)tableView; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Color/DVColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyTheme.h 3 | // 4 | // 5 | // Created by My on 2017/11/29. 6 | // Copyright © 2017年 com.znjk.test. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DVColor : UIColor 12 | 13 | #pragma mark - <-- Custom --> 14 | @property(nonatomic, class, readonly) UIColor *theme; 15 | @property(nonatomic, class, readonly) UIColor *grayBackgroundColor; 16 | @property(nonatomic, class, readonly) UIColor *collectionViewBackgroundColor; 17 | @property(nonatomic, class, readonly) UIColor *cellViewBackgroundColor; 18 | 19 | @property(nonatomic, class, readonly) UIColor *black1; //2c2c2c 20 | @property(nonatomic, class, readonly) UIColor *black2; //515151 21 | @property(nonatomic, class, readonly) UIColor *black3; //707070 22 | @property(nonatomic, class, readonly) UIColor *black4; //8a8a8a 23 | @property(nonatomic, class, readonly) UIColor *black5; //bfbfbf 24 | @property(nonatomic, class, readonly) UIColor *black6; //cdcdcd 25 | @property(nonatomic, class, readonly) UIColor *black7; //dbdbdb 26 | @property(nonatomic, class, readonly) UIColor *black8; //e6e6e6 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Color/DVColor.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyTheme.m 3 | // 4 | // 5 | // Created by My on 2017/11/29. 6 | // Copyright © 2017年 com.znjk.test. All rights reserved. 7 | // 8 | 9 | #import "DVColor.h" 10 | 11 | @implementation DVColor 12 | 13 | #pragma mark - <-- Custom --> 14 | + (UIColor *)theme { 15 | // return [UIColor colorWithHex:0x16AEB8]; 16 | return [UIColor colorWithHex:0x131426]; 17 | } 18 | 19 | + (UIColor *)grayBackgroundColor { 20 | return [UIColor colorWithHex:0xF2F2F7]; 21 | } 22 | 23 | + (UIColor *)collectionViewBackgroundColor { 24 | return [UIColor whiteColor]; 25 | } 26 | 27 | + (UIColor *)cellViewBackgroundColor { 28 | return [UIColor whiteColor]; 29 | } 30 | 31 | 32 | #pragma mark - <-------------------- Black --------------------> 33 | + (UIColor *)black1 { 34 | return [UIColor colorWithHex:0x2c2c2c]; 35 | } 36 | 37 | + (UIColor *)black2 { 38 | return [UIColor colorWithHex:0x515151]; 39 | } 40 | 41 | + (UIColor *)black3 { 42 | return [UIColor colorWithHex:0x707070]; 43 | } 44 | 45 | + (UIColor *)black4 { 46 | return [UIColor colorWithHex:0x8a8a8a]; 47 | } 48 | 49 | + (UIColor *)black5 { 50 | return [UIColor colorWithHex:0xbfbfbf]; 51 | } 52 | 53 | + (UIColor *)black6 { 54 | return [UIColor colorWithHex:0xcdcdcd]; 55 | } 56 | 57 | + (UIColor *)black7 { 58 | return [UIColor colorWithHex:0xdbdbdb]; 59 | } 60 | 61 | + (UIColor *)black8 { 62 | return [UIColor colorWithHex:0xe6e6e6]; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/GCD/DVGCD+Class.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGCD+Class.h 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2017/3/6. 6 | // Copyright © 2017 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGCD.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGCD (Class) 14 | 15 | ///单次 16 | + (void)once:(dispatch_block_t)block; 17 | 18 | 19 | + (void)main_async_delay:(NSTimeInterval)timeInterval block:(dispatch_block_t)block; 20 | 21 | ///异步 主线程 串行 22 | + (void)main_async:(dispatch_block_t)block; 23 | 24 | ///异步 后台 并行 (优先级 DEFAULT) 25 | + (void)global_async:(dispatch_block_t)block; 26 | 27 | ///异步 后台 并行 (优先级 HIGH) 28 | + (void)global_high_async:(dispatch_block_t)block; 29 | 30 | ///异步 后台 并行 (优先级 LOW) 31 | + (void)global_low_async:(dispatch_block_t)block; 32 | 33 | ///异步 后台 并行 (优先级 BACKGROUND) 34 | + (void)global_background_async:(dispatch_block_t)block; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/GCD/DVGCD+Class.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVGCD+Class.m 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2017/3/6. 6 | // Copyright © 2017 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGCD+Class.h" 10 | 11 | @implementation DVGCD (Class) 12 | 13 | + (void)once:(dispatch_block_t)block { 14 | static dispatch_once_t onceToken; 15 | dispatch_once(&onceToken, block); 16 | } 17 | 18 | + (void)main_async_delay:(NSTimeInterval)timeInterval block:(dispatch_block_t)block { 19 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeInterval * NSEC_PER_SEC)), 20 | dispatch_get_main_queue(), 21 | block); 22 | } 23 | 24 | + (void)main_async:(dispatch_block_t)block { 25 | dispatch_async(dispatch_get_main_queue(), block); 26 | } 27 | 28 | + (void)global_async:(dispatch_block_t)block { 29 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); 30 | } 31 | 32 | + (void)global_high_async:(dispatch_block_t)block { 33 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), block); 34 | } 35 | 36 | + (void)global_low_async:(dispatch_block_t)block { 37 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), block); 38 | } 39 | 40 | + (void)global_background_async:(dispatch_block_t)block { 41 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), block); 42 | } 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/GCD/DVGCD+CountDown.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGCD+CountDown.h 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2017/1/10. 6 | // Copyright © 2017 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGCD.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGCD (CountDown) 14 | 15 | /** 16 | 倒计时器 17 | @param duration 倒计时总时长 18 | @param timeInterval 时间间隔 19 | @param block 每经过一个时间间隔回调一次, return YES 继续, return NO 结束 20 | @param endBlock 倒计时结束回调 21 | */ 22 | - (void)countDownWithDuration:(NSTimeInterval)duration 23 | timeInterval:(NSTimeInterval)timeInterval 24 | block:(void(^)(NSTimeInterval timeLeft))block 25 | end:(void(^)(void))endBlock; 26 | 27 | - (void)cancelCountDown; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/GCD/DVGCD+CountDown.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVGCD+CountDown.m 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2017/1/10. 6 | // Copyright © 2017 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGCD+CountDown.h" 10 | 11 | @interface DVGCD () 12 | 13 | @property(nonatomic, strong) __block dispatch_source_t countDownSource; 14 | 15 | @end 16 | 17 | @implementation DVGCD (CountDown) 18 | 19 | - (void)countDownWithDuration:(NSTimeInterval)duration 20 | timeInterval:(NSTimeInterval)timeInterval 21 | block:(void (^)(NSTimeInterval))block 22 | end:(void (^)(void))endBlock { 23 | 24 | if (duration <= 0 || timeInterval <= 0 || duration < timeInterval) { 25 | NSLog(@"[DVGCD ERROR]: 设置倒计时器失败-> duration:%f timeInterval:%f", duration, timeInterval); 26 | return; 27 | } 28 | 29 | if (self.countDownSource) { 30 | [self cancelCountDown]; 31 | } 32 | 33 | __block NSTimeInterval tmpDuration = duration; 34 | NSTimeInterval tmpTimeInterval = timeInterval; 35 | 36 | __weak __typeof(self)weakSelf = self; 37 | self.countDownSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.queue); 38 | dispatch_source_set_timer(self.countDownSource, DISPATCH_TIME_NOW, tmpTimeInterval * NSEC_PER_SEC, 0); 39 | dispatch_source_set_event_handler(self.countDownSource , ^{ 40 | tmpDuration -= tmpTimeInterval; 41 | if (tmpDuration < tmpTimeInterval) { 42 | dispatch_source_cancel(weakSelf.countDownSource); 43 | endBlock(); 44 | weakSelf.countDownSource = nil; 45 | } 46 | }); 47 | dispatch_resume(self.countDownSource ); 48 | } 49 | 50 | - (void)cancelCountDown { 51 | if (self.countDownSource) { 52 | dispatch_source_cancel(self.countDownSource); 53 | self.countDownSource = nil; 54 | } 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/GCD/DVGCD+Timer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGCD+Timer.h 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2017/1/10. 6 | // Copyright © 2017 DVKit. All rights reserved. 7 | // 8 | 9 | #import "DVGCD.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVGCD (Timer) 14 | 15 | /** 16 | 定时器 (suspend 暂停, resume 恢复) 17 | @param timeInterval 时间间隔 18 | @param block 每经过一个时间间隔回调一次, return YES 继续, return NO 结束 19 | */ 20 | - (void)timerWithTimeInterval:(NSTimeInterval)timeInterval block:(void(^)(void))block; 21 | 22 | /// 恢复定时器 23 | - (BOOL)resumeTimer; 24 | 25 | /// 暂停定时器 26 | - (BOOL)pauseTimer; 27 | 28 | /// 立即触发定时器闭包 29 | - (BOOL)fireTimer; 30 | 31 | /// 重新开始定时器 32 | - (BOOL)restartTimer; 33 | 34 | /// 立即取消定时器, 想开始再次调用 timerWithTimeInterval:block: 35 | - (BOOL)cancelTimer; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/GCD/DVGCDKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVGCDKit.h 3 | // DVKit 4 | // 5 | // Created by mlgPro on 2017/1/10. 6 | // Copyright © 2017 DVKit. All rights reserved. 7 | // 8 | 9 | #ifndef DVGCDKit_h 10 | #define DVGCDKit_h 11 | 12 | #import "DVGCD.h" 13 | #import "DVGCD+Class.h" 14 | #import "DVGCD+Timer.h" 15 | #import "DVGCD+CountDown.h" 16 | 17 | #endif /* DVGCDKit_h */ 18 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/AlertView/DVNoticeAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVNoticeAlertView.h 3 | // MM 4 | // 5 | // Created by DV on 2016/9/9. 6 | // Copyright © 2016 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVNoticeAlertView : UIView 14 | 15 | @property(nonatomic, copy) NSString *title; 16 | @property(nonatomic, copy) NSString *content; 17 | 18 | @property(nonatomic, copy) void(^confirmBlock)(void); 19 | @property(nonatomic, copy) void(^cancelBlock)(void); 20 | 21 | 22 | - (instancetype)initWithTitle:(NSString *)title 23 | content:(NSString *)content 24 | confirm:(void(^)(void))confirmBlock 25 | cancel:(void(^)(void))cancelBlock; 26 | 27 | - (void)present; 28 | 29 | - (void)dismiss; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Category/CALayer+DVNotice.h: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+DVNotice.h 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/14. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface CALayer (DVNotice) 14 | 15 | - (void)dv_beginAnimation; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Category/CALayer+DVNotice.m: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+DVNotice.m 3 | // DVAVKitDemo 4 | // 5 | // Created by mlgPro on 2020/4/14. 6 | // Copyright © 2020 DVUntilKit. All rights reserved. 7 | // 8 | 9 | #import "CALayer+DVNotice.h" 10 | 11 | @implementation CALayer (DVNotice) 12 | 13 | - (void)dv_beginAnimation { 14 | if (self.speed == 0.0) { 15 | CFTimeInterval pausedTime = [self timeOffset]; 16 | self.speed = 1.0; 17 | self.timeOffset = 0.0; 18 | self.beginTime = 0.0; 19 | CFTimeInterval timeSincePause = [self convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; 20 | self.beginTime = timeSincePause; 21 | } 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/DVNotice.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVNotice.h 3 | // MM 4 | // 5 | // Created by DV on 2016/9/9. 6 | // Copyright © 2016 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVNotice : NSObject 14 | 15 | #pragma mark - <-------------------- MessageView --------------------> 16 | + (void)presentMessageToRootView:(NSString *)message type:(DVNoticeMessageType)type; 17 | + (void)presentMessageToRootViewForSuccess:(NSString *)message; 18 | + (void)presentMessageToRootViewForInfo:(NSString *)message; 19 | + (void)presentMessageToRootViewForWarn:(NSString *)message; 20 | + (void)presentMessageToRootViewForError:(NSString *)message; 21 | 22 | 23 | #pragma mark - <-------------------- AlertView --------------------> 24 | + (void)presentAlertToRootView:(NSString *)title 25 | content:(NSString *)content 26 | confirm:(void(^_Nullable)(void))confirmBlock 27 | cancel:(void(^_Nullable)(void))cancelBlock; 28 | + (void)dismissAlertToRootView; 29 | 30 | #pragma mark - <-------------------- LoadingView --------------------> 31 | + (void)presentLoadingToRootView:(NSTimeInterval)duration complete:(void(^_Nullable)(void))completeBlock; 32 | + (void)dismissLoadingToRootView; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/DVNoticeViewKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVNoticeViewKit.h 3 | // MM 4 | // 5 | // Created by DV on 2016/9/9. 6 | // Copyright © 2016 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVNoticeViewKit_h 10 | #define DVNoticeViewKit_h 11 | 12 | #import "DVNoticeDefine.h" 13 | #import "DVNotice.h" 14 | 15 | #endif /* DVNoticeViewKit_h */ 16 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Define/DVNoticeDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVNoticeDefine.h 3 | // DVLibrary 4 | // 5 | // Created by DV on 2020/1/2. 6 | // Copyright © 2020 DVLibrary. All rights reserved. 7 | // 8 | 9 | #ifndef DVNoticeDefine_h 10 | #define DVNoticeDefine_h 11 | 12 | typedef NS_ENUM(NSUInteger, DVNoticeMessageType) { 13 | DVNoticeMessageType_Success, 14 | DVNoticeMessageType_Info, 15 | DVNoticeMessageType_Warn, 16 | DVNoticeMessageType_Error, 17 | }; 18 | 19 | #endif /* DVNoticeDefine_h */ 20 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/LoadingView/DVNoticeLoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVNoticeLoadingView.h 3 | // MM 4 | // 5 | // Created by DV on 2016/9/9. 6 | // Copyright © 2016 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVNoticeLoadingView : UIView 14 | 15 | @property(nonatomic, copy, nullable) void(^completeBlock)(void); 16 | @property(nonatomic, assign) NSTimeInterval duration; 17 | 18 | - (instancetype)initWithFrame:(CGRect)frame 19 | duration:(NSTimeInterval)duration 20 | complete:(void(^_Nullable)(void))completeBlock; 21 | 22 | - (void)present; 23 | 24 | - (void)dismiss; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/MessageView/DVNoticeMessageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVNoticeMessageView.h 3 | // MM 4 | // 5 | // Created by DV on 2016/9/9. 6 | // Copyright © 2016 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVNoticeMessageView : UIView 14 | 15 | @property(nonatomic, assign) DVNoticeMessageType type; 16 | @property(nonatomic, copy) NSString *message; 17 | 18 | - (instancetype)initWithMessage:(NSString *)message type:(DVNoticeMessageType)type; 19 | 20 | - (void)present; 21 | 22 | - (void)dismiss; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_error.png -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_info.png -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_success.png -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shidavid/DVTest/56d35339eba16383f5ddf2b7ed6768daf26fcdde/DVAVKitDemo/DVAVKitDemo/Utils/NoticeView/Reesource/icon_message_warn.png -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Runtime/Category/NSObject+Runtime_Class.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Runtime_Class.h 3 | // French 4 | // 5 | // Created by DV on 2019/8/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSObject (Runtime_Class) 14 | 15 | #pragma mark - <-- 获取信息 --> 16 | /// 获取本类 17 | - (Class)getClass; 18 | 19 | /// 获取本类 20 | + (Class)getClass; 21 | 22 | 23 | /// 获取元类 24 | - (Class)getMetaClass; 25 | 26 | /// 获取元类 27 | + (Class)getMetaClass; 28 | 29 | 30 | ///获取本类的类名 31 | - (NSString *)getClassName; 32 | 33 | ///获取本类的类名 34 | + (NSString *)getClassName; 35 | 36 | 37 | #pragma mark - <-- Method --> 38 | - (void)changeToClass:(Class)aClass; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Runtime/Category/NSObject+Runtime_Class.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Runtime_Class.m 3 | // French 4 | // 5 | // Created by DV on 2019/8/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "NSObject+Runtime_Class.h" 10 | #import 11 | 12 | @implementation NSObject (Runtime_Class) 13 | 14 | #pragma mark - <-- 获取信息 --> 15 | - (Class)getClass { 16 | return [self class]; 17 | } 18 | 19 | + (Class)getClass { 20 | return [self class]; 21 | } 22 | 23 | - (Class)getMetaClass { 24 | return object_getClass([self class]); 25 | } 26 | 27 | + (Class)getMetaClass { 28 | return object_getClass([self class]); 29 | } 30 | 31 | - (NSString *)getClassName { 32 | return NSStringFromClass([self class]); 33 | } 34 | 35 | + (NSString *)getClassName { 36 | return NSStringFromClass([self class]); 37 | } 38 | 39 | 40 | #pragma mark - <-- Method --> 41 | - (void)changeToClass:(Class)aClass { 42 | object_setClass(self, aClass); 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Runtime/Category/NSObject+Runtime_VAR.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Runtime_VAR.h 3 | // French 4 | // 5 | // Created by DV on 2019/8/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DVRuntimeObjectModel.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | @class DVRuntimeObjectModel; 14 | 15 | @interface NSObject (Runtime_VAR) 16 | 17 | /// 获取属性property类型, 只能对于对象 18 | @property(nonatomic, assign, readonly) PropertyType propertyType; 19 | 20 | /// 获取属性property列表 21 | @property(nonatomic, copy, readonly) NSArray *propertyList; 22 | 23 | /// 获取所有成员属性列表 (包括property) 24 | @property(nonatomic, copy, readonly) NSArray *ivarList; 25 | 26 | /// 获取所有Property详细信息 27 | @property(nonatomic, copy, readonly) NSArray *propertyListInDetail; 28 | 29 | /// 获取所有Ivar详细信息 (包括property) 30 | @property(nonatomic, copy, readonly) NSArray *ivarListInDetail; 31 | 32 | /// 获取所有Property和Ivar详细信息 33 | @property(nonatomic, copy, readonly) NSArray *allListInDetail; 34 | 35 | 36 | ///将所有property的值清空 37 | - (void)cleanAllProperyValue; 38 | 39 | ///将所有ivar的值清空 40 | - (void)cleanAllIvarValue; 41 | 42 | /// 获取属性property类型, 任意类型 43 | - (PropertyType)getPropertyTypeWithName:(NSString *)propertyName; 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Runtime/DVRuntime.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRuntime.h 3 | // French 4 | // 5 | // Created by DV on 2019/8/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DVRuntime : NSObject 14 | 15 | #pragma mark - <-- Class --> 16 | + (Class)newSubClassWithName:(NSString *)subClassName base:(Class)baseClass; 17 | 18 | + (void)deleteClass:(Class)aClass; 19 | 20 | + (void)deleteClassWithName:(NSString *)className; 21 | 22 | 23 | #pragma mark - <-- Method --> 24 | + (const char *)getMethodTypeWithProtocol:(Protocol *)protocol 25 | selector:(SEL)selector 26 | isRequired:(BOOL)isRequiredMethod 27 | isInstanceMethod:(BOOL)isInstanceMethod; 28 | 29 | + (const char *)getMethodTypeWithClass:(Class)aClass 30 | selector:(SEL)selector 31 | isInstanceMethod:(BOOL)isInstanceMethod; 32 | 33 | + (void)exchangeInstanceMethodWithOriginalClass:(Class)oClass 34 | originalSel:(SEL)originalSelector 35 | swizzledClass:(Class)sClass 36 | swizzledSel:(SEL)swizzledSelector; 37 | 38 | + (SEL)convertGetSelFromSetSel:(SEL)setSel; 39 | 40 | + (NSString *)convertGetNameFromSetName:(NSString *)setName; 41 | 42 | #pragma mark - <-- Var --> 43 | 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Runtime/DVRuntimeKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVRuntimeKit.h 3 | // iOS_Template_Objc 4 | // 5 | // Created by DV on 2019/8/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #ifndef DVRuntimeKit_h 10 | #define DVRuntimeKit_h 11 | 12 | #import "DVRuntime.h" 13 | #import "DVRuntimeObjectModel.h" 14 | #import "NSObject+Runtime_Class.h" 15 | #import "NSObject+Runtime_Method.h" 16 | #import "NSObject+Runtime_VAR.h" 17 | 18 | #endif /* DVRuntimeKit_h */ 19 | -------------------------------------------------------------------------------- /DVAVKitDemo/DVAVKitDemo/Utils/Runtime/Model/DVRuntimeObjectModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVRuntimeObjectModel.m 3 | // French 4 | // 5 | // Created by DV on 2019/8/12. 6 | // Copyright © 2019 iOS. All rights reserved. 7 | // 8 | 9 | #import "DVRuntimeObjectModel.h" 10 | 11 | @implementation DVRuntimeObjectModel 12 | 13 | - (NSString *)description { 14 | NSDictionary *dict = @{ 15 | @"name" : self.name, 16 | @"value" : self.value != nil ? self.value : @"nil", 17 | @"className" : self.className, 18 | }; 19 | 20 | return [dict description]; 21 | } 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------